There are times when a MySQL replication can hog up a lot of disk space, due to a sudden burst of queries that are being logged into your binary logs to be executed on the slave MySQL server(s). On your filesystem, it will look like this.
-rw-rw---- 1 mysql mysql 501M Nov 15 08:15 mysql-bin.000044 -rw-rw---- 1 mysql mysql 501M Nov 15 10:42 mysql-bin.000045 -rw-rw---- 1 mysql mysql 501M Nov 15 12:50 mysql-bin.000046 -rw-rw---- 1 mysql mysql 501M Nov 15 15:02 mysql-bin.000047 -rw-rw---- 1 mysql mysql 501M Nov 15 17:14 mysql-bin.000048 -rw-rw---- 1 mysql mysql 501M Nov 15 19:28 mysql-bin.000049 -rw-rw---- 1 mysql mysql 501M Nov 15 21:43 mysql-bin.000050 -rw-rw---- 1 mysql mysql 501M Nov 15 23:58 mysql-bin.000051
Even with a normal value in the “expire_logs_days” (how long those logs should be kept), in a single day it can increase to massive amounts when you’re working with a lot of data.
If you want to manually purge those logs, because you’re safe (yeah right) and know you won’t be needing them anymore for data recovery (yeah right), you can run the following query in MySQL.
# mysql mysql> PURGE BINARY LOGS BEFORE '2011-11-16'; Query OK, 0 rows affected (0.57 sec) mysql> exit
Change the data of the “BEFORE” statement to when you actually want to clear them, and the binlogs will be cleaned up nicely.