Slave db stopped on corrupted binlog

Use this procedure only if you are not losing data (use some binlog viewer to read last executed query)..

To force slave to move on the next binlog file (on slave server):

  1. enter into mysql shell (mysql -u db_user -p)
  2. show slave status\G;
  3. read the row similar to: Master_Log_File: mysql-bin.000196
  4. return to bash (exit)
  5. list binlogs file in your mysql directory: ll /var/lib/mysql  (is the default, but use your)
  6. check if exist the file mysql-bin.000197 (197 in this scenario, but look at the next progressive number of your logs)
  7. re-enter into mysql shell
  8. let’s stop the replication with: stop slave;
  9. change master to MASTER_LOG_FILE=’mysql-bin.000197′,MASTER_LOG_POS=4;
  10. and restart replica with: start slave;
  11. if you run a show slave status\G; you should see no more errors



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s