O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required