Search code examples
mysqlbinaryreplicationmariadbdiskspace

Auto-purge of mariadb binary logs


I'm using two mariadb-server (v 10.0.17) in a master-slave environment. From time to time I have to purge the "old" binary logs on the master which have already been fetched by the slave.

I wounder if there is a hidden setting in mariadb to auto-purge these binary logs. I think the master knows the amount of slaves and the log an position every slave has reached.

On the on hand its quite useful because you can easily set up another slave if you want and use the existin binary logs for getting to the same position as the master but on the other hand it fills up my diskspace which is sometimes very low.

Thanks for responding.


Solution

  • expire_logs_days = 7 -- purge binlogs after a week.

    max_binlog_size can be lowered if you need it to be finer grained.