Documentation Home
MySQL Replication
Related Documentation Download this Excerpt
PDF (US Ltr) - 1.4Mb
PDF (A4) - 1.4Mb
HTML Download (TGZ) - 330.2Kb
HTML Download (Zip) - 336.5Kb


MySQL Replication  /  ...  /  Adding GTID-Based Sources to a Multi-Source Replica

2.5.3 Adding GTID-Based Sources to a Multi-Source Replica

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

Use the CHANGE MASTER TO statement to configure a replication channel for each source on the replica (see Section 5.2, “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 source (see Section 2.3.3, “GTID Auto-Positioning”). The MASTER_AUTO_POSITION option is set to specify the use of auto-positioning.

For example, to add source1 and source2 as sources to the replica, use the mysql client to issue the CHANGE MASTER TO statement twice on the replica, like this:

mysql> CHANGE MASTER TO MASTER_HOST="source1", MASTER_USER="ted", \
MASTER_PASSWORD="password", MASTER_AUTO_POSITION=1 FOR CHANNEL "source_1";
mysql> CHANGE MASTER TO MASTER_HOST="source2", MASTER_USER="ted", \
MASTER_PASSWORD="password", MASTER_AUTO_POSITION=1 FOR CHANNEL "source_2";

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