Operating System » Linux » Linux Ubuntu Server » MySQL Replication » How to resynchronize the slave

How to resynchronize the slave

Step 1. On the Slave
Issue the following commands to mysql:
STOP SLAVE; # stop the Slave I/O threads
RESET SLAVE; # forget about all the relay log files
/etc/init.d/mysql stop # stop the database

Step 2. On the Master
Issue the following commands to mysql:
mysql> RESET MASTER; # reset the bin log counter and wipe out bin log files
mysql> FLUSH TABLES WITH READ LOCK; # flush buffers and LOCK tables (both MyISAM and InnoDB)
mysql> show master status\G
Plaase take note of the file (mysql-bin.0???) and the position (???). You’ll need it later on the slave.

mysqldump "“databases "“lock-all-tables DBNAME1 [DBNAME2...] > dumpfile.sql ).

Copy the dumps and the archives of the databases you made in previous steps on the master to the slave.

Step 3.

mysql> CHANGE MASTER TO MASTER_LOG_FILE=’mysql-bin.000001’, MASTER_LOG_POS=98;
mysql> SLAVE START;

mysql> show slave status\G
....
Slave_IO_Running: Yes
Slave_SQL_Running: Yes

Updated On: 12.10.01