By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,592 Members | 1,931 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,592 IT Pros & Developers. It's quick & easy.

replication bin logs issue

P: n/a
Hi,

We are in the process of setting my mysql replication on mysql ver
4.1.18. However we have noticed an odd bug that occurs every so often.

Every hour we issue flush logs to mysql so that we can move the bin
logs to our backup server. In our mysql logs we notice the following;

060526 12:00:02 [ERROR] Failed to open log (file
'/srv/backup/mysql/mysql-bin.000068', errno 2)

This doesn't happen on each flush. This is resulting in us losing an
hours bin logs at a time which then causes replication to break (rows
are inserted during this time and as they are not logged to the bin
logs they never make it to the slaves).

errno 2 is "No such file or directory" however the structure is correct
and this is confirmed by the fact that the bin log rotation/flushing
does work correctly most of the time.

Does any one have any ideas why this may be taking place?

Mike

May 26 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Okay so we worked this out.

If you ever see this type of problem you should watch out of the easy
mistake that we made.

We were issuing the flush logs to rotate the binary logs, mysql keeps
track of the binary logs that it has to rotate. If the file is
expecting to rotate is not there then it fails with the error in my
previous post. Our backup was moving the file as part of the whole
flush logs process.

Net effect was mysql hadn't moved the bin log (probably because some
transaction was taking place) by the time our process has moving it and
deleting it.

duh!

Mike

May 30 '06 #2

P: n/a
> Okay so we worked this out.

If you ever see this type of problem you should watch out of the easy
mistake that we made.

We were issuing the flush logs to rotate the binary logs, mysql keeps
track of the binary logs that it has to rotate. If the file is
expecting to rotate is not there then it fails with the error in my
previous post. Our backup was moving the file as part of the whole
flush logs process.

Net effect was mysql hadn't moved the bin log (probably because some
transaction was taking place) by the time our process has moving it and
deleting it.

Hi Mike,

I'd recommend that you use MySQL's binary log handling tools (i.e.,
never remove the logs by hand or in a script, instead use the
appropriate 'PURGE MASTER' statements within the mysql client to do so.
This will ensure that MySQL knows that the log has been deleted, and
since it'll be deleting/removing the logs you shouldn't ever run into
issues where a log isn't available.

Ideally, your log rotation application would query the server to
determine the current log in use (show master logs), check all of the
slaves to ensure they are using the current log (to make sure you don't
break replication by deleting a log that a slave depends on), and only
then purge the logs that aren't in use ('PURGE MASTER LOGS TO
'log-bin.000012';).

If you need MySQL (or PostgreSQL) training, we offer a wide range of
both. (http://www.otg-nc.com)

--
Chander Ganesan
Open Technology Group, Inc.
One Copley Parkway, Suite 210
Morrisville, NC 27560
Phone: 877-258-8987/919-463-0999
duh!

Mike


Jun 5 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.