Introduction

If replication is broken because of some common errors such as 1032 or 1062, we can repair it by skipping those errors

Log in to MYSQL   by opening a command prompt and going to C:\Program Files\Deepnet DualShield\mysql\bin> mysql u- root -p

The issue

Once logged into MySQL, run the show slave status command:

Show slave status\G

In the results check the the status of Slave_IO_Running and Slave_SQL_Running.  They should both say yes, however in my case only the Slave_IO_Running says Yes:

I now need to find the error which is causing this.  This will be displayed under slave status results.  The row titled Last_Errno will give you the last error number,  And beneath that the row called Last_Error will give a description of the problem.

So here we can see there was an issue updating records to a particular row.   This was actually caused by a power failure to my servers.

Repairing the Replication

This can easily be fixed by using just 5 simple commands on all servers.

  1.  The first thing we need to do is stop the slave

 stop slave;

2.  Now we tell the slave to skip the invalid entry:

set global sql_slave_skip_counter = 1;

3.  Now we need to reset the slave bin log positions

reset slave;

4a.  Quickly check the row Channel_Name in the slave status results:  

4b. Start the slave for this channel (for this example I will be using 'server-2' as that is the name of the channel of my slave server, but you will be using your own)

start slave for channel 'server-2';

5.  Now check the slave status on all servers again:

Show slave status\G

Hopefully both Slave_IO_Running and Slave_SQL_Running will be showing the word yes next to them, which means that replication is working again.


  • No labels