expire_logs_days

expire_logs_days
设置完这个参数之后需要执行flush logs

The number of days for automatic binary log file removal. The default is 0, which means “no automatic removal.” Possible removals happen at startup and when the binary log is flushed. Log flushing occurs as indicated in Section 5.2, “MySQL Server Logs”.
To remove binary log files manually, use the PURGE BINARY LOGS statement. See Section 12.5.1.1, “PURGE BINARY LOGS Syntax”.

In addition, the binary log is flushed when its size reaches the value of the max_binlog_size system variable.

max_binlog_size
If a write to the binary log causes the current log file size to exceed the value of this variable, the server rotates the binary logs (closes the current file and opens the next one). The minimum value is 4096 bytes. The maximum and default value is 1GB.

You might face sutch a problem if the mysql-bin.index file is no longer matching the reality (for exemple, if you manually deleted logs files).

cat your /var/log/mysql/mysql-bin.index (or whatever your .index file is), it is a text file that contains the names of all used binary log files. There shouldn't be a difference between its content and the list of log files on your filesystem.

You might try this (changing the paths according to your configuration) :
# /bin/ls -1 /var/log/mysql/mysql-bin.[0-9]* | diff /var/log/mysql/mysql-bin.index -


If there is a difference, try this :
- stop your mysql server
- backup your mysql-bin.index file
- re-create a file with the logs that still exists
- start your mysql server

Example (again, you might change the paths according to your own configuration) :
# /etc/init.d/mysql stop
# cd /var/log/mysql
# cp mysql-bin.index mysql-bin.index-
# ls -1 /var/log/mysql/mysql-bin.[0-9]* > mysql-bin.index
# /etc/init.d/mysql start

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值