HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

MySQL : 30GB of binlogs in 6 Hours

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
hours30gbmysqlbinlogs

Problem

I have a mysql master/master setup with tungsten replicator. My server is reaching out of space, occupied around 30G in 6 hours. I'm not sure how to handle this. Would be great if some one can help me out of this.

Thanks,
Swaroop.

Solution

If you want to erase all binary logs older than 30 minutes, do this

mysql> PURGE BINARY LOGS BEFORE NOW() - INTERVAL 30 MINUTE;


If you want to erase all binary logs except the last one, do this

mysql> PURGE BINARY LOGS BEFORE NOW();


If you want to erase all binary logs before midnight, do this

mysql> PURGE BINARY LOGS BEFORE DATE(NOW()) + INTERVAL 0 SECOND;


If you want to erase all binary logs before midnight 3 days ago, do this

mysql> PURGE BINARY LOGS BEFORE DATE(NOW()) + INTERVAL 0 SECOND - INTERVAL 3 DAY;


I have discussed deleting binary logs like this before

  • Apr 26, 2013 ; Is it safe to delete mysql-bin files?



  • May 28, 2014 : Freeing up disk space in 'mysql\data'



Give it a Try !!!

Code Snippets

mysql> PURGE BINARY LOGS BEFORE NOW() - INTERVAL 30 MINUTE;
mysql> PURGE BINARY LOGS BEFORE NOW();
mysql> PURGE BINARY LOGS BEFORE DATE(NOW()) + INTERVAL 0 SECOND;
mysql> PURGE BINARY LOGS BEFORE DATE(NOW()) + INTERVAL 0 SECOND - INTERVAL 3 DAY;

Context

StackExchange Database Administrators Q#68067, answer score: 9

Revisions (0)

No revisions yet.