0

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?

M4rk
  • 2,172
  • 5
  • 36
  • 70
  • 1
    I don't think this makes any sense. The description of GTID says that it's unique across the entire replication set, so it has to be created on the master. – Barmar May 12 '22 at 17:51

1 Answers1

2

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

M4rk
  • 2,172
  • 5
  • 36
  • 70
Bill Karwin
  • 538,548
  • 86
  • 673
  • 828
  • Hi Bill, thanks. The reason unfortunately is a very critical large 5.7 system. It's unfortunate that 8 is required. – M4rk May 12 '22 at 20:53
  • Then read https://dev.mysql.com/doc/refman/5.7/en/replication-mode-change-online-enable-gtids.html. It is possible to convert a running 5.7 system to GTID mode with no downtime. At my last job, we converted thousands of MySQL 5.7 replica-sets to GTID mode en masse. Obviously, practice this conversion with a few non-critical systems first, until you are confident in the steps, before attempting it on your critical system. And always have a back-out plan. – Bill Karwin May 12 '22 at 21:45