Différences entre les versions de « MySQL/Réplication »

164 octets supprimés ,  il y a 8 ans
</source>
 
=== Configuration onde eachchaque slave ===
 
InDans <code>/etc/mysql/my.cnf</code>, in thesection <code>[mysqld]</code> section:
* Définir un identifiant de serveur différent du master et des autres slaves :
* Define a server identifier, different than the master (and different than the other slaves):
server-id = 2
* Vérifier avec :
* Verify with:
<source lang=sql>
SHOW VARIABLES LIKE 'server_id';
</source>
* YouIl canest alsoaussi declarepossible thede slavedéclarer hostnamele tonom thede la machine slave dans le master (cf. <code>SHOW SLAVE HOSTS</code> below) :
report-host=slave1
 
DeclareDéclarer thele master :
<source lang=sql>
CHANGE MASTER TO MASTER_HOST='master_addr', MASTER_USER='myreplication', MASTER_PASSWORD='mypass';
</source>
 
IfSi settingla upréplication replicationsert fromde backup, specifyspécifier startle point (addde todépart previous command):
<source lang=sql>
MASTER_LOG_FILE='<binary_log_from_master>', MASTER_LOG_POS=<master_binary_log_position>;
</source>
 
Start the replication:
Démarrer la réplication :
<source lang=sql>
START SLAVE;
</source>
ThisCela willva createcréer aun file namedfichier <code>master.info</code>, in your data directory,typiquement typicallydans <code>/var/lib/mysql/master.info</code> ; thiscontenant filela willconfiguration contain the slave configurationet andle statusstatut.
 
{{remarque|Si la réplication tombe en panne par la suite, il est possible de la réparer en le relançant :
TODO:
<source lang=sql>
Oct 15 21:11:19 builder mysqld[4266]: 101015 21:11:19 [Warning] Neither --relay-log nor --relay-log-index were used; so
START STOP;
replication may break when this MySQL server acts as a slave and has his hostname changed!! Please use
START SLAVE;
'--relay-log=mysqld-relay-bin' to avoid this problem.
</source>
}}
 
=== Check the replication ===