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:

  1. Check all MySQL servers for version compatibility (see Section 22.6.2, “General Requirements for NDB Cluster Replication”).

  2. Create a slave account on the master Cluster with the appropriate privileges:

    1. mysqlM> GRANT REPLICATION SLAVE
    2.      -> ON *.* TO 'slave_user'@'slave_host'
    3.      -> 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, and slave_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 named rep-slave, and using the password 53cr37, use the following GRANT statement:

    1. mysqlM> GRANT REPLICATION SLAVE
    2.      -> ON *.* TO 'myslave'@'rep-slave'
    3.      -> IDENTIFIED BY '53cr37';

    For security reasons, it is preferable to use a unique user account—not employed for any other purpose—for the replication slave account.

  3. Configure the slave to use the master. Using the MySQL Monitor, this can be accomplished with the CHANGE MASTER TO statement:

    1. mysqlS> CHANGE MASTER TO
    2.      -> MASTER_HOST='master_host',
    3.      -> MASTER_PORT=master_port,
    4.      -> MASTER_USER='slave_user',
    5.      -> 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, and slave_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:

    1. mysqlS> CHANGE MASTER TO
    2.      -> MASTER_HOST='rep-master',
    3.      -> MASTER_PORT=3306,
    4.      -> MASTER_USER='myslave',
    5.      -> 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's my.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”.

  4. 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, and db_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”.

    Note

    If 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 include skip-slave-start in the slave's my.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.

  5. 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.


Rechercher dans le manuel MySQL

Traduction non disponible

Le manuel MySQL n'est pas encore traduit en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

Document créé le 26/06/2006, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/mysql-rf-mysql-cluster-replication-preparation.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :en Manuel MySQL : https://dev.mysql.com/

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.

Table des matières Haut