expire_logs_days ignored in my.cnf
Mysql (community) Version 8.0.17-1.sles12 - OpenSUSE tumbleweed 2019.10.02
mysql> SET GLOBAL expire_logs_days = 4;
ERROR 3683 (HY000): The option expire_logs_days and binlog_expire_logs_seconds
cannot be used together. Please use binlog_expire_logs_seconds to set the expire
time (expire_logs_days is deprecated)
..
Facts From Your Question
- Binary Logs cannot rotate out
- You said you can run PURGE BINARY LOGS
Here is my Working Theory
Since you can erase binary logs using PURGE BINARY LOGS;
, I have two places for you to look that you have not mentioned
PLACE #1 : mysql-bin.index
This file contains the location of all binary logs. When expire_logs_days is set, mysqld will open this text file, check the datetime stamps in each file until it encounters a binary logs that has a timestamp less than NOW() - INTERVAL expire_logs_days DAY)
.
The binary logs in mysql-bin.index is expected to be numerically consecutive. If the binary logs are not numerically consecutive, log rotation is disabled.
PLACE #2 : /var/log/mysql
folder
According to your my.cnf
, This folder holds all the binary logs.
Here are 2 questions:
- Are there any binary logs in
/var/log/mysql
that are not numerically consecutive? - Are there any binary logs in
/var/log/mysql
that are NOT INmysql-bin.index
?
Why would these situations come up ?
Sometimes, people delete binary logs in the OS. This can throw off mysqld since mysqld uses mysql-bin.index
to internally track the existence of binary logs. Simply deleting binary logs with rm -f
logically breaking the log rotation mechanism as mysqld knows it.
RECOMMENDATION
If either or both are the case, you can clean this up as follows:
mysql -ANe"RESET MASTER"
service mysql stop
cd /var/log/mysql
rm -f mysql-bin.*
cd
service mysql start
After this, you should have a brand spanking new binary log setup.
Give it a Try !!!