Nuclear Rooster

6Mar/092

Relay log issues when starting MySQL replication slave

I just ran into a little issue setting up a MySQL slave. I have done this a least a have dozen times before, and it is always pretty painless, but this time, I kept getting hung up on error that looked like this:

071118 16:44:10 [ERROR] Failed to open the relay log './-relay-bin.003525'
(relay_log_pos 22940879)
071118 16:44:10 [ERROR] Could not find target log during relay log initialization
071118 16:44:10 [ERROR] Failed to initialize the master info structure

Googling a little turned up this mysql forum,

http://forums.mysql.com/read.php?26,112490,223025#msg-223025

Which then led me to this mysql doc page

http://dev.mysql.com/doc/refman/5.0/en/replication-howto-additionalslaves.html

This was confusing, and didn't really seem like it got to the root of the problem. Why would one slave care about another, if they were both reading from the master? I think that article would more accurately be called "Making a slave of a slave" or some such, because "Introducing Additional Slaves to an Existing Replication Environment" does not convey that they are talking about a slave of a slave (which I think they are).

Anyway, long and short of it, I removed the 'master.info' 'mysqld-relay-bin.*' 'relay-log.info' 'relay-log-index.*' from the MySQL data directory, restarted mysql ('/etc/init.d/mysql restart'), and off to the races.

Sometimes, depending on the order you do edit the configs or restart mysql, you can get bad data in those files, and it can lead to crpytic errors. Remove those, and you can always start fresh.

Comments (2) Trackbacks (0)
  1. That really helped – mine broke with a 5.0 to 5.1 upgrade on the slave (master is still 5.0). Deleted files, started, (it tried to play from beginning of relay logs, with duplicate errors), stop slave, change master to previously shown master position, start slave – and it’s all good. Whew

  2. Thanks you made my Friday.
    My instance pointed to the default relay log, even though I had defined a different one.
    Deleting them worked for me too.


Leave a comment


No trackbacks yet.