Question

I have a master mysql server with only one attached slave.

I have configured my master server to keep logs for 2 day, but in a simple configuration like mine is possible to configure an environment where master logs are deleted as soon as be consumed by the ONLY ONE slave?

Was it helpful?

Solution

No, there is no option for what you're describing.

The reason is that replication is asynchronous. The master has no idea how many slaves are subscribed, it only knows which slaves are connected at any given time. That is, a slave could be offline and expect to reconnect and resume reading binlogs where it left off.

The only option in stock MySQL for binary log expiration is the config variable config_logs_days.

Percona Server adds another option, to expire binlogs if the number of files is more than max_binlog_files. This helps to avoid running out of disk space if you have a short burst of heavy traffic before expire_logs_days causes old logs to be expired.

OTHER TIPS

MySQL Utilities includes a command line tool to purge binlogs on a master that have been consumed by slaves.

http://dev.mysql.com/doc/mysql-utilities/1.6/en/mysqlbinlogpurge.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top