The mysql-bin files using up a lot of free space

  • 7012442
  • 20-May-2013
  • 11-Jun-2013

Environment

Novell Filr 1.0

Situation

Server quickly running out of free space.
A lot of space being used by /vastorage/mysql/.
The mysql-bin.* files can be almost 10G in size.

Resolution

Updated - June 11th 2013 - Fixes have been checked into 1.1 and should be available in the near future.

These files need to be kept, however, Novell believes that these logs can be expired after 7 days.  DO NOT delete these files by hand.

To clean these up:

To expire the logs automatically after 7 days, edit the /etc/my.cnf file and add "expire_logs_days = <numberOfDays>" global variable in the [mysqld] section.  For example - using "expire_logs_days = 7" will cause all mysql-bin* files that are older than 7 days to be purged.

After, restart mysql with /etc/init.d/mysql restart

Cause

The mysql-bin files are needed for database replication or recovery, and can grow quite large when recording data.

Additional Information

The importance of mysql-bin or "mysql binary log files:
Data Recovery: It may be used for data recovery operations. After a backup file has been restored, the events in the binary log that were recorded after the backup was made are re-executed. These events bring databases up to date from the point of the backup.
Replication: The binary log is used on master replication servers as a record of the statements to be sent to slave servers. The master server sends the events contained in its binary log to its slaves, which execute those events to make the same data changes that were made on the master

See http://serverfault.com/questions/82093/are-mysql-bins-safe-to-remove for additional information.