MySQL 5.7 Traditional Replication to GTID Online Switch
Requires MySQL 5.7.6 and later versions.
All members in the group gtid_mode are off.
All Server execution
set @@global.enforce_gtid_consistency = warn;
Special Note: This step is a step of Guan Jian and can not be used without warning.
2.Execute on all servers:
set @@global.enforce_gtid_consistency = on;
3.Execute on all Servers (do not care about the first and the last, but the execution must be finished):
set @@global.gtid_mode = off_permissive;
In fact, the logs generated in this step are all logs with GTID.This step claims to not care about any nodes, but it is recommended to execute it on the slave first and then execute it on the master in terms of management.
Confirm that the traditional binlog is copied, the value is 0
show status like'ongoing_anonymous_transaction_count';
All nodes need to be confirmed as 0.
All nodes judge show status like'ongoing_anonymous_transaction_count'; is zero
All nodes can also execute: flush logs; Used to switch logs.
All nodes enable gtid_mode
Write gtid_mode = on related configuration into the configuration file
Enable Gtid's automatic discovery node replication:
change master to master_auto_position=1;
complete. Good Luck.