MySQL Replication and disappearing relay logs

A recent reboot of a server highlighted an issue with MySQL 5.045 on CentOS 5.3. On this particular setup, MySQL seems to place relay logs in /var/run/mysqld/. Unfortunately, this will mean that when the machine is rebooted, the relay log will get deleted.

When MySQL attempts to start up again, it won’t be able to find the relay log and replication will fail. The error messages in /var/log/mysqld.log might look something like:

The pre-emptive fix is to tell MySQL to store the logs elsewhere (/var/lib/mysql/ perhaps) using the relay-log configuration option. If you’ve already suffered this problem, then the most straight forward fix is to start again; do a show master statusflush logs and then a mysqldump to get a fresh starting point on the master, and then copy the new dump over to the slave.

More information on the mysql bug report.

Tagged with: , ,
Posted in Linux

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">