Rechercher dans le manuel MySQL
17.1.4.2 Multi-Source Replication Tutorials
This section provides tutorials on how to configure masters and slaves for multi-source replication, and how to start, stop and reset multi-source slaves.
17.1.4.2.1 Configuring Multi-Source Replication
This section explains how to configure a multi-source replication topology, and provides details about configuring masters and slaves. Such a topology requires at least two masters and one slave configured.
Masters in a multi-source replication topology can be configured to use either global transaction identifier (GTID) based replication, or binary log position-based replication. See Section 17.1.3.4, “Setting Up Replication Using GTIDs” for how to configure a master using GTID based replication. See Section 17.1.2.1, “Setting the Replication Master Configuration” for how to configure a master using file position based replication.
Slaves in a multi-source replication topology require
TABLE
repositories for the master info log
and relay log info log, which are the default in MySQL
8.0. Multi-source replication is not compatible
with FILE
based repositories, and the FILE
setting for the --master-info-repository
and
--relay-log-info-repository
options is now
deprecated.
To modify an existing replication slave that is using a
FILE
repository for the slave status logs to
use TABLE
repositories, convert the existing
replication repositories dynamically by running the following
commands:
This section assumes you have enabled GTID based transactions on
the master using gtid_mode=ON
,
enabled a replication user, and ensured that the slave is using
TABLE
based replication repositories. Use the
CHANGE MASTER TO
statement to add
a new master to a channel by using a FOR CHANNEL
clause. For more
information on replication channels, see
Section 17.2.3, “Replication Channels”
channel
For example, to add a new master with the host name
master1
using port
3451
to a channel called
master-1
:
- MASTER_AUTO_POSITION = 1 FOR CHANNEL 'master-1';
Multi-source replication is compatible with auto-positioning. See Section 13.4.2.1, “CHANGE MASTER TO Syntax” for more information.
Repeat this process for each extra master that you want to add to a channel, changing the host name, port and channel as appropriate.
This section assumes that binary logging is enabled on the
master (which is the default), the slave is using
TABLE
based replication repositories (which
is the default in MySQL 8.0), and that you have
enabled a replication user and noted the current binary log
position. You need to know the current
MASTER_LOG_FILE
and
MASTER_LOG_POSITION
. Use the
CHANGE MASTER TO
statement to add a new master to a channel by specifying a
FOR CHANNEL
clause. For
example, to add a new master with the host name
channel
master1
using port
3451
to a channel called
master-1
:
- MASTER_LOG_FILE='master1-bin.000006', MASTER_LOG_POS=628 FOR CHANNEL 'master-1';
Repeat this process for each extra master that you want to add to a channel, changing the host name, port and channel as appropriate.
Once you have added all of the channels you want to use as
replication masters, use a START SLAVE
statement to
start replication. When you have enabled multiple channels on a
slave, you can choose to either start all channels, or select a
specific channel to start.
thread_types
Use the thread_types
option to choose
specific threads you want the above statements to start on the
slave. See Section 13.4.2.6, “START SLAVE Syntax” for more information.
The STOP SLAVE
statement can be used to stop
a multi-source replication slave. By default, if you use the
STOP SLAVE
statement on a multi-source
replication slave all channels are stopped. Optionally, use the
FOR CHANNEL
clause to stop only
a specific channel.
channel
To stop all currently configured replication channels:
- STOP SLAVE thread_types;
To stop only a named channel, use a
FOR CHANNEL
clause:channel
- STOP SLAVE thread_types FOR CHANNEL channel;
Use the thread_types
option to choose
specific threads you want the above statements to stop on the
slave. See Section 13.4.2.7, “STOP SLAVE Syntax” for more information.
The RESET SLAVE
statement can be used to
reset a multi-source replication slave. By default, if you use
the RESET SLAVE
statement on a multi-source
replication slave all channels are reset. Optionally, use the
FOR CHANNEL
clause to reset
only a specific channel.
channel
To reset all currently configured replication channels:
- RESET SLAVE;
To reset only a named channel, use a
FOR CHANNEL
clause:channel
- RESET SLAVE FOR CHANNEL channel;
See Section 13.4.2.4, “RESET SLAVE Syntax” for more information.
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 26/06/2006, zuletzt geändert 26/10/2018
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/mysql-rf-replication-multi-source-tutorials.html/.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.