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.