Documentation Home
MySQL 5.7 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 39.1Mb
PDF (A4) - 39.1Mb
PDF (RPM) - 38.3Mb
HTML Download (TGZ) - 10.7Mb
HTML Download (Zip) - 10.8Mb
HTML Download (RPM) - 9.4Mb
Man Pages (TGZ) - 223.5Kb
Man Pages (Zip) - 331.4Kb
Info (Gzip) - 3.6Mb
Info (Zip) - 3.6Mb
Excerpts from this Manual

MySQL 5.7 Reference Manual  /  ...  /  Adding GTID-Based Masters to a Multi-Source Replication Slave

16.1.4.3 Adding GTID-Based Masters to a Multi-Source Replication Slave

These steps assume you have enabled GTIDs for transactions on the masters using gtid_mode=ON, created a replication user, ensured that the slave is using TABLE based replication repositories, and provisioned the slave with data from the masters if appropriate.

Use the CHANGE MASTER TO statement to configure a replication channel for each master on the replication slave (see Section 16.2.3, “Replication Channels”). The FOR CHANNEL clause is used to specify the channel. For GTID-based replication, GTID auto-positioning is used to synchronize with the master (see Section 16.1.3.3, “GTID Auto-Positioning”). The MASTER_AUTO_POSITION option is set to specify the use of auto-positioning.

For example, to add master1 and master2 as masters to the replication slave, use the mysql client to issue the CHANGE MASTER TO statement twice on the slave, like this:

mysql> CHANGE MASTER TO MASTER_HOST="master1", MASTER_USER="ted", \
MASTER_PASSWORD="password", MASTER_AUTO_POSITION=1 FOR CHANNEL "master_1";
mysql> CHANGE MASTER TO MASTER_HOST="master2", MASTER_USER="ted", \
MASTER_PASSWORD="password", MASTER_AUTO_POSITION=1 FOR CHANNEL "master_2";

For the full syntax of the CHANGE MASTER TO statement and other available options, see Section 13.4.2.1, “CHANGE MASTER TO Statement”.