MySQL GTID (ii)

Source: Internet
Author: User

MySQL GTID Series two or three. Convert GTID to traditional mode online

Environment See previous article series

Close the Gtid without stopping the service and not affecting the online business

3.1 Turn off Gtid replication, adjust to traditional replication
#SLVAE实例上停止复制 STOP SLAVE#SLVAE实例上查看复制的位置SHOW SLAVE STATUS \G# 查看 Master_Log_File 和 Read_Master_Log_Pos对应的值binlog.000012:1821#重新 CHANGE MASTERCHANGE MASTER TO MASTER_AUTO_POSITION=0,                 MASTER_LOG_FILE='binlog.000012',                 MASTER_LOG_POS=1821;#开启SLAVESTART SLAVE;
3.2 Set Gtid mode to on_permissive on all servers
SET @@GLOBAL.GTID_MODE=ON_PERMISSIVE;
3.3 Set Gtid mode to off_permissive on all servers
SET @@GLOBAL.GTID_MODE=OFF_PERMISSIVE;
3.4 Wait for the variable @ @GLOBAL on all servers. Gtid_owned is empty, which represents the global GTID collection being executed by the thread
mysql> SELECT @@GLOBAL.GTID_OWNED;+---------------------+| @@GLOBAL.GTID_OWNED |+---------------------+|                     |+---------------------+1 row in set (0.00 sec)
3.5 Wait for all slave to replicate to complete the anonymous transaction. 3.6 Shut down Gtid on all servers.
SET @@GLOBAL.GTID_MODE=OFF;
3.7 Modify the configuration file for the next reboot, the configuration is also in effect.
gtid_mode=OFFenforce_gtid_consistency=OFF
Four. Traditional mode conversion to Gtid mode

Support for online modification of Gtid mode after MySQL5.7.6 version

4.1 Set Enforce_gtid_consistency=warn on all servers so that all transactions allow violation of GTID consistency
SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY=WARN;
4.2 Set Enforce_gtid_consistency=on on all servers. Ensure that all transactions do not violate GTID consistency
SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY=ON;
4.3 Set gtid_mode=off_permissive on all servers
SET @@GLOBAL.GTID_MODE=OFF_PERMISSIVE;
4.4 Set gtid_mode=on_permissive on all servers
SET @@GLOBAL.GTID_MODE=ON_PERMISSIVE;
4.5 Waiting for all Ongoing_anonymous_transaction_count from library to 0
SHOW STATUS LIKE 'ONGOING_ANONYMOUS_TRANSACTION_COUNT';
4.6 Set Gtid_mode=on on all servers, turn on GTID
4.7 Modify the configuration file for the next reboot, the configuration is also in effect.
gtid_mode=ONenforce_gtid_consistency=1

MySQL GTID (ii)

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.