mysql 5.7 disable GTID replication

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/shaochenshuo/article/details/54907841
mysql 5.7 disable GTID replication


mysql 5.7.6及以后版本支持在线disable GTID replication,所以你可以使用传统的方法或者在线方法 disable GTID replication




一:传统方法disable GTID replication


参考 mysql 5.6 disable GTID replication




二:online disable GTID replication


1. Execute the following on each slave, and if you using multi-source replication, do it for each channel and include the FOR CHANNEL channel clause:

STOP SLAVE [FOR CHANNEL 'channel'];
CHANGE MASTER TO MASTER_AUTO_POSITION = 0, MASTER_LOG_FILE = file, \
MASTER_LOG_POS = position [FOR CHANNEL 'channel'];
START SLAVE [FOR CHANNEL 'channel'];
##如果你使用了多源复制,那么为每个channel执行如上操作  

2. On each server, execute:

SET @@GLOBAL.GTID_MODE = ON_PERMISSIVE;

3. On each server, execute:

SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE;

4. On each server, wait until the variable @@GLOBAL.GTID_OWNED is equal to the empty string. This can be checked using:

SELECT @@GLOBAL.GTID_OWNED;

NOTE:
On a replication slave, it is theoretically possible that this is empty and then nonempty again. This is not a problem, it suffices that it is empty once

5. 备份

If you use binary logs for anything else than replication, for example to do point in time backup or restore: wait until you do not need the old binary logs having GTID transactions.
如果你的binlog用于恢复,在执行完第四步后。在备份脚本所在实例执行flush logs;并进行一次全备

6. On each server, execute:

SET @@GLOBAL.GTID_MODE = OFF;

7. On each server, set gtid-mode=OFF in my.cnf.

在每个实例的配置文件中添加gtid-mode=OFF

8. 你也可以选择设置enforce_gtid_consistency为OFF

set global enforce_gtid_consistency=OFF(同时在配置文件中添加)



参考链接:

http://blog.csdn.net/shaochenshuo/article/details/54862603
http://blog.csdn.net/shaochenshuo/article/details/54138317
http://blog.csdn.net/shaochenshuo/article/details/54138317
http://dev.mysql.com/doc/mysql-replication-excerpt/5.6/en/replication-gtids-concepts.html
http://dev.mysql.com/doc/mysql-replication-excerpt/5.7/en/replication-gtids-concepts.html?ff=nopfpls
https://dev.mysql.com/worklog/task/?spm=5176.100239.blogcont41200.6.xtY06T&id=7083
http://dev.mysql.com/doc/refman/5.7/en/replication-mode-change-online-disable-gtids.html?ff=nopfpls

展开阅读全文

没有更多推荐了,返回首页