Wednesday, June 28, 2017

Fast Method to repair MySQL Master-Master Replication

Fast Method to repair Master-Master Replication

1. On th Good Server
a. mysqldump --add-drop-table --master-data  --quick -u root -p databaseName > databaseName.sql
b. bzip2 databaseName.sql
c.  scp databaseName.sql.bz2 -P port username@192.168.100.5:


2. On Bad Server
bunzip2 databaseName.sql.bz2

mysql> stop slave;
mysql -u root -p databaseName < databaseName.sql
mysql> start slave;
mysql> show slave status\G

You should see Slave_IO_Running: Yes and Slave_SQL_Running: Yes.

Now --
mysql> flush tables with read lock;
mysql> show master status;

Make a note of the File and Position rows.

mysql-bin.000044 | 11726351


3. On the Good Server
mysql> stop slave;
mysql> change master to master_log_file='mysql-bin.000044',
master_log_pos=11726351;
mysql> start slave;
mysql> show slave status\G

You should see Slave_IO_Running: Yes and Slave_SQL_Running: Yes.

4. on the Bad Server
mysql> unlock tables;

No comments:

Post a Comment