A multi-source replication topology requires at least two sources
and one replica configured. In these tutorials, we assume that you
have two sources
source2, and a replica
replicahost. The replica replicates one
database from each of the sources,
Sources in a multi-source replication topology can be configured to use either GTID-based replication, or binary log position-based replication. See Section 2.3.4, “Setting Up Replication Using GTIDs” for how to configure a source using GTID-based replication. See Section 2.2.1, “Setting the Replication Source Configuration” for how to configure a source using file position based replication.
Replicas in a multi-source replication topology require
TABLE repositories for the replica's connection
metadata repository and applier metadata repository, which are the
default in MySQL 8.0. Multi-source replication is not
compatible with file repositories, and the
setting for the
variables is now deprecated.
You can modify an existing replica that is using
FILE repositories for the replication applier
metadata repositories to use
repositories. To convert the existing repositories dynamically,
first stop replication by using the mysql
client to issue the
| SLAVE statement on the replica. Then issue the
mysql> SET GLOBAL master_info_repository = 'TABLE'; mysql> SET GLOBAL relay_log_info_repository = 'TABLE';
Create a suitable user account on all the sources that the replica
can use to connect. You can use the same account on all the
sources, or a different account on each. If you create an account
solely for the purposes of replication, that account needs only
REPLICATION SLAVE privilege.
For example, to set up a new user,
can connect from the replica
the mysql client to issue these statements on
each of the sources:
mysql> CREATE USER 'ted'@'replicahost' IDENTIFIED BY 'password'; mysql> GRANT REPLICATION SLAVE ON *.* TO 'ted'@'replicahost';
For more details, and important information on the default authentication plugin for new users from MySQL 8.0, see Section 2.2.3, “Creating a User for Replication”.