[ClusterLabs] Mysql M/S, binlogs - how to delete them safely without failing over first?

Attila Megyeri amegyeri at minerva-soft.com
Tue Aug 18 17:19:24 EDT 2015


Hi List,

We are using M/S replication in a couple of clusters, and there is an issue that has been causing headaches for me for quite some time.

My problem comes from the fact that binlog files grow very quickly on both the Master and Slave nodes.

Let's assume, that node 1 is the master - it logs all operations to binlog.
Node 2 is the slave, it replicates everything properly. (It is strange, however, that node2 must also generate and keep binlog files while it is a slave, but let's assume that this is by design).

There are ways to configure mysql to keep the binlog files only for some time, e.g. 10 days, but I had an issue with this:

To explain the issue, please consider the following case:
Let's say that both node1 and node2 are up-to-date, and we did a failover test on day 0.
DB1 is the master, DB2 is the slave.
DB1 has master position "A", DB1 has master position "B".

After 20 days, lots of binlog files exist on both servers, I would like to get rid of them, as the slave is up-to-date.

I decide to delete all binlog files older than 1 day by issuing "purge binary logs...".

I try to fail over so that DB2 becomes the master, but DB1 tries to connect to DB2 for replication and wants to replicate starting from a position that it "remembers" from the times when DB2 was the master, and starts to look for some binlog files that are 20 days old. Now, the issue is, that those old binlog files have been deleted since, and replication stops with error (cannot find binlogs).

Am I doing something wrong here, or is something configured badly?
OR am I assuming correctly that in order to purge the binlog files from both servers I need to make a failover first?


Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.clusterlabs.org/pipermail/users/attachments/20150818/67b7f5c5/attachment-0002.html>


More information about the Users mailing list