Online DDL gh-ost Tool test

Source: Internet
Author: User
Tags percona server

Os:centos 6.5

Db:percona Server 5.6.32

gh-ost:1.0.21

db-m:192.168.128.128

Db-s: 192.168.128.129

Brief introduction:

Gh-ost is an open source tool for online SQL execution on GitHub. Can be used for online table structure changes (especially large tables, for reasons below)

Online table structure changes, currently commonly used in the following ways:

1. Small table: Online DDL (5.6 and later versions)

Create a temporary table for the changed table structure, update the temporary table data, and record the new entry data for the original table into the in-memory alter Log,rename

2. Big table: Pt-ost tools. Trigger mechanism

3. Big table: Gh-ost. , create a temporary table. No trigger, according to Binlog mechanism

Test:

Test Library under USERTB table (1000w)

650) this.width=650; "alt=" gh-ost tool test-hine_t-time Restart "src=" http://img1.ph.126.net/IxF45gENOPYvdyYD9J2xTQ==/ 6632204660721849412.png "style=" line-height:28px;border:0px;height:auto;margin:0px 10px 0px 0px; "/>

Gh-ost Test:

Gh-ost \

--MAX-LOAD=THREADS_RUNNING=25 \

--CRITICAL-LOAD=THREADS_RUNNING=64 \

--chunk-size=1000 \

--throttle-control-replicas= "192.168.128.129:3306" \

--MAX-LAG-MILLIS=1500 \

--initially-drop-old-table \

--initially-drop-ghost-table \

--initially-drop-socket-file \

--ok-to-drop-table \

--conf= "/ETC/MY.CNF" \

--host= "192.168.128.129" \

--port=3306 \

--user= "root" \

--password= "thy" \

--database= "Test" \

--table= "USERTB" \

--verbose \

--alter= "Add ps_id int (TEN) default null" \

--SWITCH-TO-RBR \

--allow-master-master \

--cut-over=default \

--DEFAULT-RETRIES=120 \

--panic-flag-file=/tmp/ghost.panic.flag \

--postpone-cut-over-flag-file=/tmp/ghost.postpone.flag \

--execute

During the execution

128:

650) this.width=650; "src=" Http://img2.ph.126.net/e6LsWtROlLB8yW-19BRulQ==/6632114500768372136.png "style=" line-height:24.5px;border:0px;height:auto;margin:0px 10px 0px 0px; "alt=" 6632114500768372136.png "/>

129:

650) this.width=650; "src=" Http://img0.ph.126.net/DZ5l6Ik5ixs_z1aWEdYyUw==/6631813234585469670.png "style=" line-height:28px;border:0px;height:auto;margin:0px 10px 0px 0px; "alt=" 6631813234585469670.png "/>

At last:

650) this.width=650; "src=" Http://img2.ph.126.net/abAH5chcx0okVD3894p00A==/6631909991605606274.png "style=" line-height:28px;border:0px;height:auto;margin:0px 10px 0px 0px; "alt=" 6631909991605606274.png "/>

Conclusion: It can be seen that the principle of gh-ost is to utilize the working mode of M-s and Binlog, to minimize the intrusion of the main database and the MDL's protection to the source data, and to consider the tool of the large table DDL in the late stage without the trigger mechanism.

This article is from the "hiny_t blog" blog, make sure to keep this source http://hinyt.blog.51cto.com/12442113/1888032

Online DDL gh-ost Tool test

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.