Mysql – Is this normal binary logging behaviour – maintaining one ever growing file despite expire_logs_days

backupMySQLpercona

I have a Percona MySQL DB running on a dedicated server.

I have in my.cnf

# REPLICATION #
log_bin=/var/lib/mysql/binlogs/mysql-bin
expire_logs_days=7

My issue is that the log file mysql-bin.000001 is ever growing in size.

I'm not sure if the expected behaviour is for it to start a new file each day on 7 day rotation, or to "trim from the top", but it doesn't seem to be doing either, as it's the only file been created and continues to grow in size beyond the 7 day boundary.

Any advice or clarification is much appreciated.

Best Answer

If the file hasn't exceeded max_binlog_size or if a log flushing event hasn't occurred then it won't start a new file. expire_logs_days only removes non-active binary logs (i.e. files other than the one that shows up under a "show master status;").