简体   繁体   English

MySQL 在 Replica MySQL 实例上启用 GTID

[英]MySQL enable GTID on Replica MySQL instance

We are currently using binary replication from our master to slave.我们目前正在使用从主服务器到从服务器的二进制复制。

Is it possible to enable the GTID on the slave only ?是否可以在从站上启用 GTID? (this is required from some other application reading from the replicas, but we don't want to make changes to master) (这是从副本读取的其他应用程序所必需的,但我们不想对主服务器进行更改)

Are there any reasons why this should not be possible?有什么理由不应该这样做吗?

See https://dev.mysql.com/doc/refman/8.0/en/replication-mode-change-online-enable-gtids.html :请参阅https://dev.mysql.com/doc/refman/8.0/en/replication-mode-change-online-enable-gtids.html

From MySQL 8.0.23, you can set up replication channels to assign a GTID to replicated transactions that do not already have one.从 MySQL 8.0.23 开始,您可以设置复制通道以将 GTID 分配给尚未复制的事务。 This feature enables replication from a source server that does not use GTID-based replication, to a replica that does.此功能允许从不使用基于 GTID 的复制的源服务器复制到使用基于 GTID 的副本。

Read the rest of the documentation I linked to for more details.阅读我链接到的其余文档以获取更多详细信息。 I understand this paragraph to mean you cannot do what you describe on a version older than 8.0.23.我理解这一段意味着你不能在 8.0.23 之前的版本上做你描述的事情。 If you want to do this, you must upgrade at least the replica to 8.0.23.如果要执行此操作,您必须至少将副本升级到 8.0.23。

However, I'd recommend that you enable GTID on your source instance, not just the replica.但是,我建议您在源实例上启用 GTID,而不仅仅是副本。 You can do this on older MySQL versions, and there are other advantages to using GTID throughout your replica-set.您可以在较旧的 MySQL 版本上执行此操作,并且在整个副本集中使用 GTID 还有其他优势。 I don't know why you don't want to do this, but I'm not able to think of a good reason.我不知道你为什么不想这样做,但我想不出一个好的理由。

In case of MySQL 5.7, it is not possible to enable the GTID in replica only.在 MySQL 5.7 的情况下,不能仅在副本中启用 GTID。 Follow this guide to enable the GTID: https://dev.mysql.com/doc/refman/5.7/en/replication-mode-change-online-enable-gtids.html按照本指南启用 GTID: https ://dev.mysql.com/doc/refman/5.7/en/replication-mode-change-online-enable-gtids.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM