最近发现mysql的binlog日志一直在被删除中。。。导致从机出错后没法排查问题。
查阅资料后,发现配置文件的expire_logs_days的参数是保存binlog日志的时间参数。
mysql> show variables like '%expire_logs_days%'; +------------------+-------+ | Variable_name | Value | +------------------+-------+ | expire_logs_days | 7 | +------------------+-------+
这个是只是保存了七天。
把这个参数修改大,为30天
mysql> set global expire_logs_days=30; Query OK, 0 rows affected (0.00 sec) mysql> show variables like '%expire_logs_days%'; +------------------+-------+ | Variable_name | Value | +------------------+-------+ | expire_logs_days | 30 | +------------------+-------+ 1 row in set (0.00 sec)
这样就改成了30天。
但这样只是临时变量,要要完整保持30需要咋配置问my.cnf中修改
搞定~