本文主要是介绍mysql在线变更gtid复制,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
show variables like 'enforce_gtid_consistency';
set @@global.enforce_gtid_consistency = WARN;
show variables like 'enforce_gtid_consistency';
select sleep(60);
grep -iE 'warn|note' /var/log/mysqld.log #查看是否有报错信息
set @@global.enforce_gtid_consistency = on;
show variables like 'enforce_gtid_consistency';
set @@global.gtid_mode = OFF_PERMISSIVE;
show variables like 'gtid_mode';
show global variables like 'gtid_executed'; #变量为空,未出现gtid事务,结果正常
set @@global.gtid_mode = ON_PERMISSIVE;
show variables like 'gtid_mode';
show global variables like 'gtid_executed'; #出现gtid事务,结果正常
show status like 'ongoing_anonymous_transaction_count'; #只要出现一次为零,才可进行下一步
show master status; #查询主库的二进制日志文件和位置
select master_pos_wait('mysql-bin.000004','2569'); #在从库执行,必须返回0,不为0重复执行该语句
flush logs;
show master status;
#在从库中执行mysqldump备份数据
set @@global.gtid_mode = ON;
show variables like 'gtid_mode';
vim /etc/my.cnf
[mysql]
gtid_mode = ON
enforce_gtid_consistency = ON
.......
:wq
stop slave; #从库执行以下操作
change master to master_auto_position =1; #从库更改为gtid复制模式
start slave;
show slave status\G
这篇关于mysql在线变更gtid复制的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!