MySQL plus field Pt-online-change-schema

Source: Internet
Author: User
Tags install perl percona

1, installing DBD perl-io-socket-ssl percona-toolkitYum list|grep dbdyum list|grep socket|grep SSL yum-y install perl-dbd-mysql.x86_64yum-y install Perl-io-socket-ssl.noarc Hyum-y Install "Perl (term::readkey)" Wget https://www.percona.com/downloads/percona-toolkit/2.2.17/RPM/ PERCONA-TOOLKIT-2.2.17-1.NOARCH.RPMRPM-IVH percona-toolkit-2.2.17-1.noarch.rpm 2. View Character SetShow variables like ' character% '; 3, start adding fields:Pt-online-schema-change \--user=root \--password= ' [email protected]%[email protected]# ' \--host=127.0.0.1 \--port= 3306 \--charset=utf8 \--alter= "Add index Idx_url_date (mg_url, Mg_datetime)" \d=spider,t=js_mogu_goods \--exec \-- Max-load threads_running=1000 \--critical-load= "threads_running:200" Related parameters:--nodrop-old-table do not delete table--max-load Threads _running= exceeding this value will pause--critical-load threads_running= more than this value will stop the values for 4,--alter-foreign-keys-method can be: auto, rebuild_constraints, Drop_swap, none1, when the business volume is large, the modification operation will wait for no data modification, and then perform the final rename operation. Therefore, when you modify the table structure, you should try to choose to perform more appropriately when the business is relatively idle, at least when the data operation on the table is low. 2, if the foreign key table operation, four kinds of foreign key operation types need to be based on the data volume and reliability of the table to choose. For reasons of reliability, use the rebuild_constraints type as much as possible and use the auto type if there is no reliability requirement. 3, when the--alter-foreign-keys-method=none, the foreign key index will be invalidated, the need to rebuild the foreign key index, can be used again 4, because there may be a certain risk, before the operation, the proposed data table backup, can make the operation more secure and reliable.

MySQL plus field Pt-online-change-schema

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.