Rechercher dans le manuel MySQL
22.6.5 Preparing the NDB Cluster for Replication
Preparing the NDB Cluster for replication consists of the following steps:
Check all MySQL servers for version compatibility (see Section 22.6.2, “General Requirements for NDB Cluster Replication”).
Create a slave account on the master Cluster with the appropriate privileges:
- mysqlM> GRANT REPLICATION SLAVE
- -> IDENTIFIED BY 'slave_password';
In the previous statement,
slave_user
is the slave account user name,slave_host
is the host name or IP address of the replication slave, andslave_password
is the password to assign to this account.For example, to create a slave user account with the name
myslave
, logging in from the host namedrep-slave
, and using the password53cr37
, use the followingGRANT
statement:For security reasons, it is preferable to use a unique user account—not employed for any other purpose—for the replication slave account.
Configure the slave to use the master. Using the MySQL Monitor, this can be accomplished with the
CHANGE MASTER TO
statement:- -> MASTER_HOST='master_host',
- -> MASTER_PORT=master_port,
- -> MASTER_USER='slave_user',
- -> MASTER_PASSWORD='slave_password';
In the previous statement,
master_host
is the host name or IP address of the replication master,master_port
is the port for the slave to use for connecting to the master,slave_user
is the user name set up for the slave on the master, andslave_password
is the password set for that user account in the previous step.For example, to tell the slave to replicate from the MySQL server whose host name is
rep-master
, using the replication slave account created in the previous step, use the following statement:- -> MASTER_HOST='rep-master',
- -> MASTER_PORT=3306,
- -> MASTER_USER='myslave',
- -> MASTER_PASSWORD='53cr37';
For a complete list of options that can be used with this statement, see Section 13.4.2.1, “CHANGE MASTER TO Syntax”.
To provide replication backup capability, you also need to add an
--ndb-connectstring
option to the slave'smy.cnf
file prior to starting the replication process. See Section 22.6.9, “NDB Cluster Backups With NDB Cluster Replication”, for details.For additional options that can be set in
my.cnf
for replication slaves, see Section 17.1.6, “Replication and Binary Logging Options and Variables”.If the master cluster is already in use, you can create a backup of the master and load this onto the slave to cut down on the amount of time required for the slave to synchronize itself with the master. If the slave is also running NDB Cluster, this can be accomplished using the backup and restore procedure described in Section 22.6.9, “NDB Cluster Backups With NDB Cluster Replication”.
ndb-connectstring=management_host[:port]
In the event that you are not using NDB Cluster on the replication slave, you can create a backup with this command on the replication master:
shellM> mysqldump --master-data=1
Then import the resulting data dump onto the slave by copying the dump file over to the slave. After this, you can use the mysql client to import the data from the dumpfile into the slave database as shown here, where
dump_file
is the name of the file that was generated using mysqldump on the master, anddb_name
is the name of the database to be replicated:shellS> mysql -u root -p db_name < dump_file
For a complete list of options to use with mysqldump, see Section 4.5.4, “mysqldump — A Database Backup Program”.
NoteIf you copy the data to the slave in this fashion, you should make sure that the slave is started with the
--skip-slave-start
option on the command line, or else includeskip-slave-start
in the slave'smy.cnf
file to keep it from trying to connect to the master to begin replicating before all the data has been loaded. Once the data loading has completed, follow the additional steps outlined in the next two sections.Ensure that each MySQL server acting as a replication master is configured with a unique server ID, and with binary logging enabled, using the row format. (See Section 17.2.1, “Replication Formats”.) These options can be set either in the master server's
my.cnf
file, or on the command line when starting the master mysqld process. See Section 22.6.6, “Starting NDB Cluster Replication (Single Replication Channel)”, for information regarding the latter option.
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 26/06/2006 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/mysql-rf-mysql-cluster-replication-preparation.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.