How to do it...

Assume that the masters are master1 and master2.

Steps:

  1. Set up replication between master1 and master2 as described in Chapter 9, Replication.
  2. Make master2 read-only:
mysql> SET @@GLOBAL.READ_ONLY=ON;
  1. 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 ...

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.