是否必须使用GTID启用带有MySQL Replication的–log_slave_updates?

参见英文答案 > mysql 5.6 gtid replication: is log_slave_updates required?                                    1个
我正在设置5.6 Percona Mysql,为了启用GTID我是否必须在Master和Slave上启用log_slave_update?

如果我应该启用log_slave_update,那么我将其计为CONS以获得GTID.

另外,如果你能让我知道启用GTID的任何其他问题吗?

解决方法:

MySQL文档建议:见Setting Up Replication Using GTIDs

请记住,MySQL甚至不会启动它.为什么?从文档:

Step 3: Restart both servers with GTIDs enabled. To enable binary logging with global transaction identifiers, each server must be started with GTID mode, binary logging, slave update logging enabled, and with statements that are unsafe for GTID-based replication disabled. In addition, you should prevent unwanted or accidental updates from being performed on either server by starting both in read-only mode. This means that both servers must be started with (at least) the options shown in the following invocation of mysqld_safe:

shell> mysqld_safe –gtid_mode=ON –log-bin –log-slave-updates –enforce-gtid-consistency &

由于二进制日志记录在主服务器和从服务器上都是活动的,因此主服务器的二进制日志和从服务器的二进制日志都将记录GTID以及事务.这使得在启动复制时可以使用从站中的最新GTID将从站自动定位到其主站.其中一个关键步骤清楚地说明了same document page

Instruct the slave to use the master as the replication data source and to use auto-positioning, and then start the slave.

因此,必须启用–log-slave-updates才能使自动定位机制处于活动状态.即使只是在机制之外,@ jynus在他对mysql 5.6 gtid replication: is log_slave_updates required?的回答中指出,如果没有指定–log-slave-updates,mysqld甚至都不会开始.

上一篇:更新mysql 5.5服务器上的系统时间有任何风险吗?


下一篇:mysql – 使用数据库复制部署Django Server的多个实例的解决方案