Appendix A. Replication Tips and Tricks

The following is a collection of useful tips and tricks for running, diagnosing, repairing, and improving MySQL replication.

The tips in this chapter are intended to be supplemental material and, as such, may not contain all of the details needed for a full tutorial. Consult the online MySQL Reference Manual at http://dev.mysql.com/doc/refman/5.4/en/index.html for more details about MySQL replication.

You can also find the latest information and cutting-edge techniques at the replication development zone at http://dev.mysql.com/replication/.

The last few sections of this appendix describe features that will be offered by MySQL soon, but are not officially available at the time of this writing.

My Slave Stopped. Now What?

If your slave stops without warning and there is an error message, consult the documentation about the likely causes of the error and perform any repairs necessary.

Once you have corrected the error, follow this procedure to determine where to restart the slave after the event that caused the error:

  1. Check the position it stopped on using the following command:

    SHOW SLAVE STATUS
  2. Use Master_Log_File and Read_Master_Log_Pos to determine the next event to transfer from the master.

  3. Use Relay_Master_Log_File and Exec_Master_Log_Pos to determine the next event to apply for the master log.

  4. Use Relay_Log_File and Relay_Log_Pos to determine the next event to apply for the relay log.

  5. Use mysqlbinlog to read the contents:

    mysqlbinlog master-log.000001 ...

Get MySQL High Availability now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.