MySQL Online modify table structure tool Gh-ost

Source: Internet
Author: User
Tags mysql host rowcount stack trace server port

Gh-ost Use test:

gh-ost-host= ' 192.168.65.136 '-user=root-password= '-database= ' haha '-chunk-size=100000-allow-on-master-execute- Initially-drop-ghost-table-exact-rowcount--initially-drop-old-table-alter= ' modify Areaid varchar (ten) '-table= ' T_ Policyarea '

-allow-master-Master explicitly allows running in the primary primary cluster-allow-on-Master allows to run directly on the host, if no cluster uses this option, it is recommended to use on-machine-alterstring(mandatory parameter) ALTER statement such as ADD column_name type, change column_name column_name type, modify column_name type; ALTER TABLE string Required-assume-RBR Settings'true'When you are sure to use'ROW'Binlog_format. -chunk-sizeintthe number of rows processed per iteration, which is 1000 by default, allows the range ( --100000)-concurrent-RowCount ( with--exact-rowcount), whentrue: Count rows After row-copy begins, concurrently, and adjust row estimate later on; Defaultsfalse: First count rows, ThenStart Row Copy-confstringconfiguration file-critical-load--max-Load , set a threshold, and the application will automatically exit if the threshold value is exceeded.--max-load Same meaning-databasestringdatabase name must be field-Debug Debug Mode-default-retriesintnumber of retries before a variety of accidents (default -)    -exact-ROWCOUNT copy the number of row before the exact estimate, in order to facilitate accurate comment on the execution progress: this is not necessary, accurate statistics for large tables is also very time-consuming-execute actually executes the change, and if this option is not added by default it is tested and then exited, and the original table structure is not changed .-hoststringMySQL host name, preferably from the machine instead of the host (default"127.0.0.1")    -initially-drop-ghost-Table if you have run multiple changes to the same table, there will be a ghost table, using this option to delete the existing ghost table-initially-drop-old-table effect above, default is interrupt stop-initially-drop-socket-fileforcibly delete the existing socket file.            Caution: This may delete the socket file that is running the migration! -max-loadstringcommand format e.g:'threads_running=100,threads_connected=500'when the server reaches this load, it will reduce the resources used to modify-migrate-on-Replica has the migration run on a replica and not on the master. this would DoThe full migration on the replica includingCut-over (as opposed to--test-on-replica)- Nice-ratiofloatForce being' Nice', implySleep  TimePer chunk Time; Range: [0.0..100.0]. Example values:0Is aggressive.1: forEvery 1ms spent copying rows,SleepAdditional 1ms (effectively doubling runtime);0.7: forEvery 10ms spendincha rowcopy chunk, spend 7ms sleeping immediately after-ok-to-drop-Delete old table after table, because delete will have a long time lock, online operation is not recommended, default is False-panic-flag-file string when thisfileis created, gh-OST would immediately terminate, without cleanup-passwordstringMySQL server password-portintMySQL server port, recommended to operate from the machine-stack trace is added on error-switch-to-RBR let the tool automatically switch binary log format to'ROW'On the replica,ifNeeded. The format is not being switched back. I ' m too scared to DoThat, and wish to protect youifYou happen to execute another migration whileThis one is running-tablestringrequired parameter, table name-throttle-querystringdetect once per second to ensure that it is a lightweight query that does not have a large impact on the server-Tungsten explicitly let GH-ost know that is running on a tungsten-replication based topology (you is likely to also provide--assume-master-host)-userstringMySQL user-verbose redundant output details-Version number-test-on-Replica has the migration run on a replica and not on the master. At the end of migration replication was stopped, and tables are swapped and immediately swap-revert. Replication remains stopped and you can compare the both tables forBuilding Trust-test-on-replica-skip-replica-Stop when--test-on-replica is enabled, DoNot issue commands stop replication (requires--test-on-replica)-throttle-additional-flag-file stringoperation pauses when thisfileExists Hint:keep Default, use forThrottling multiple Gh-ost operations (default"/tmp/gh-ost.throttle")    -throttle-control-replicasstringList of Replicas onwhichTo check forLag Comma Delimited. Example:myhost1.com:3306, myhost2.com,myhost3.com:3307-throttle-flag-file stringoperation pauses when thisfileExists Hint:use AfileThat's specific to the table being altered-postpone-Cut-over-flag-file string         whileThisfileexists, migration would postpone the final stage of swapping tables, and would keep on syncing the ghost table. Cut-over/swapping would is ready to perform the moment thefileis deleted. -Quiet Quiet-replication-lag-querystringQuery that detects replication laginchSeconds. Result can is a floating point (by default gh-ost issues SHOW SLAVE STATUS and reads Seconds_behind_master). If You're using pt-heartbeat, query would be something Like:select ROUND (Unix_timestamp ()-MAX (Unix_timestamp (TS))) as Dela Y from My_schema.heartbeat-serve-socket-file stringUnix socketsfileTo serve on. default:auto-determined and advertised upon startup-serve-tcp-portintTCP port to serve on. Default:disabled-skip-renamed-Columns ALTERinch  CaseYour ALTER statement renames columns, Gh-ost would note that and an offer to its interpretation of the rename. By default Gh-ost does not proceed to execute. This flag tells Gh-ost to skip the renamed columns, i.e. to treat what gh-OST thinks is renamed columns as unrelated columns. Note:you may lose column data-approve-renamed-Columns ALTERinch  CaseYour ALTER statement renames columns, Gh-ost would note that and an offer to its interpretation of the rename. By default Gh-ost does not proceed to execute. This flag approves that Gh-ost's interpretation si correct-assume-master-hoststring(optional) explicitly tell GH-ost the identity of the master. format:some.host.com[:p ORT] This is usefulinchMaster-master setups where you wish to pick an explicit master, orinchA tungsten-replicator where gh-OST is unabel to determine the master-Cut-overstringChooseCut-over type (default|atomic, two-step) (default"Atomic")    -Cut-over-lock-timeout-secondsintMax number of seconds to hold locks on tables whileAttempting toCut-over (retry attempted when lock exceeds timeout) (default3)     -heartbeat-interval-millisintHow frequently would gh-ost inject a heartbeat value (default -)    -hooks-hintstringarbitrary message to being injected to hooks via Gh_ost_hooks_hint, forYour convenience-hooks-pathstringdirectory where hook files are found (default:empty, ie. hooks disabled). Hook files found on this path, and conforming to hook naming conventions would be executed-max-lag-millisintreplication Lag atwhichTo throttle operation (default the)      

MySQL Online modify table structure tool Gh-ost

Related Article

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.