MySQL enable GTID on Replica MySQL instance

926 views Asked by At

We are currently using binary replication from our master to slave.

Is it possible to enable the GTID on the slave only? (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?

1

There are 1 answers

2
Bill Karwin On

See 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. This feature enables replication from a source server that does not use GTID-based replication, to a replica that does.

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. If you want to do this, you must upgrade at least the replica to 8.0.23.

However, I'd recommend that you enable GTID on your source instance, not just the replica. You can do this on older MySQL versions, and there are other advantages to using GTID throughout your replica-set. 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. Follow this guide to enable the GTID: https://dev.mysql.com/doc/refman/5.7/en/replication-mode-change-online-enable-gtids.html