In MySQL multi-source replication, a slave opens multiple replication channels, one for each master. The replication channels represent the path of transactions flowing from a master to the slave. Each replication channel has its own receiver (I/O) thread, one or more applier (SQL) threads, and relay log. When transactions from a master are received by a channel's receiver thread, they are added to the channel's relay log file and passed through to the channel's applier threads. This enables each channel to function independently.
This section describes how channels can be used in a replication topology, and the impact they have on single-source replication. For instructions to configure masters and slaves for multi-source replication, to start, stop and reset multi-source slaves, and to monitor multi-source replication, see Section 2.4, “MySQL Multi-Source Replication”.
The maximum number of channels that can be created on one slave in a multi-source replication topology is 256. Each replication channel must have a unique (nonempty) name, as explained in Section 5.3.4, “Replication Channel Naming Conventions”. The error codes and messages that are issued when multi-source replication is enabled specify the channel that generated the error.
Each channel on a multi-source replication slave must replicate from a different master. You cannot set up multiple replication channels from a single slave to a single master. This is because the server IDs of replication slaves must be unique in a replication topology. The master distinguishes slaves only by their server IDs, not by the names of the replication channels, so it cannot recognize different replication channels from the same slave.
A multi-source replication slave can also be set up as a
multi-threaded replication slave, by setting the
variable to a value greater than 0. When you do this on a
multi-source replication slave, each channel on the slave has the
specified number of applier threads, plus a coordinator thread to
manage them. You cannot configure the number of applier threads for
From MySQL 8.0, multi-source replication slaves can be configured with replication filters on specific replication channels. Channel specific replication filters can be used when the same database or table is present on multiple masters, and you only need the slave to replicate it from one master. For more information, see Section 5.5.4, “Replication Channel Based Filters”.
To provide compatibility with previous versions, the MySQL server
automatically creates on startup a default channel whose name is the
empty string (
""). This channel is always
present; it cannot be created or destroyed by the user. If no other
channels (having nonempty names) have been created, replication
statements act on the default channel only, so that all replication
statements from older slaves function as expected (see
Section 5.3.2, “Compatibility with Previous Replication Statements”. Statements
applying to replication channels as described in this section can be
used only when there is at least one named channel.