Setting up master-master replication
This recipe will interest many people since many of us try doing this. Let's get into the details of it.Â
How to do it...
Assume that the masters are master1 and master2.
Steps:
- Set up replication between
master1andmaster2as described in Chapter 9, Replication. - Make
master2Â read-only:
mysql> SET @@GLOBAL.READ_ONLY=ON;
- On
master2, check the current binary log coordinate.
mysql> SHOW MASTER STATUS; +----------------+----------+--------------+------------------+-------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +----------------+----------+--------------+------------------+-------------------+ | server1.000017 | 473 | | | | +----------------+----------+--------------+------------------+-------------------+ 1 row in set (0.00 sec)
From the preceding output, you can start the replication on master1 from server1.000017 and position 473.
- From the positions...