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

Attila Megyeri amegyeri at minerva-soft.com
Tue Aug 18 18:00:14 EDT 2015

Hi Brett,

Thanks for the quick response.

I am using the RAs from https://github.com/ClusterLabs/resource-agents/blob/master/heartbeat/mysql

I have no experience with the Percona agent so far. The clusterlabs RA also does the change master to on promote. I did not check with the most recent versions, but it definitively did not work properly before.
What is the expected behaviour? When there is a failover, the new slave should know what was the last master position of the old slave (that was still synced)?

How do you keep/maintain the binlog files in your environments?


From: Brett Moser [mailto:brett.moser at gmail.com]
Sent: Tuesday, August 18, 2015 11:35 PM
To: Cluster Labs - All topics related to open-source clustering welcomed <users at clusterlabs.org>
Subject: Re: [ClusterLabs] Mysql M/S, binlogs - how to delete them safely without failing over first?

Hi Attila,

It sounds like on failover the new slave is not having it's master replication file & position updated.

What Resource Agent are you using to control the M/S mysql resource?

Have you investigated the Percona agent?   I performs the CHANGE MASTER TO commands for you, and I have found it to be a good RA for my M/S MySQL purposes.


-Brett Moser

On Tue, Aug 18, 2015 at 2:19 PM, Attila Megyeri <amegyeri at minerva-soft.com<mailto:amegyeri at minerva-soft.com>> wrote:
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!

Users mailing list: Users at clusterlabs.org<mailto:Users at clusterlabs.org>

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://bugs.clusterlabs.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clusterlabs.org/pipermail/users/attachments/20150819/a413dceb/attachment-0003.html>

More information about the Users mailing list