How to do it...

If the replication is already set up between the servers, follow these steps:

  1. Enable GTIDs in my.cnf:
shell> sudo vi /etc/my.cnf[mysqld]gtid_mode=ONenforce-gtid-consistency=trueskip_slave_start
  1. Set the master as read-only and make sure that all the slaves catch up with the master. This is very important because there should not be any data inconsistency between master and slaves:
On mastermysql> SET @@global.read_only = ON;On Slaves (if replication is already setup)mysql> SHOW SLAVE STATUS\G
  1. Restart all the slaves to put GTID into effect. Since the skip_slave_start is given in the configuration file, the slave won't start until you specify the START SLAVE command. If you start the slave, it will fail with this error— ...

Get MySQL 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.