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

上一篇:《Crowd Counting and Density Estimation by Trellis Encoder-Decoder Networks》密集人群检测论文笔记


下一篇:python 中使用 'is' 要注意其判断值为对象,不要用来判断变量值是否相等