Restricting the number of binlog files

Maximum number of binlog files can now be restricted in Percona Server with max_binlog_files. When variable max_binlog_files is set to non-zero value, the server will remove the oldest binlog file(s) whenever their number exceeds the value of the variable.

This variable can be used with the existing max_binlog_size variable to limit the disk usage of the binlog files. If max_binlog_size is set to 1G and max_binlog_files to 20 this will limit the maximum size of the binlogs on disk to 20G. The actual size limit is not necessarily max_binlog_size * max_binlog_files. Server restart or FLUSH LOGS will make the server start a new log file and thus resulting in log files that are not fully written in these cases limit will be lower.

Version Specific Information

System Variables

variable max_binlog_files
Version Info:
Command Line:

Yes

Config File:

Yes

Scope:

Global

Dynamic:

Yes

Variable Type:

ULONG

Default Value:

0 (unlimited)

Range:

0-102400

Example

Number of the binlog files before setting this variable

$ ls -l mysql-bin.0* | wc -l
26

Variable max_binlog_files is set to 20:

max_binlog_files = 20

In order for new value to take effect FLUSH LOGS needs to be run. After that the number of binlog files is 20

$ ls -l mysql-bin.0* | wc -l
20
Percona Server
Call Us
+1-888-316-9775 (USA - Sales)
+1-208-473-2904 (USA - Sales)
+44-208-133-0309 (UK - Sales)
0-800-051-8984 (UK - Sales)
0-800-181-0665 (GER - Sales)
+1-877-862-4316 (Emergency)
+1-855-55TRAIN (Training)
+1-925-271-5054 (Training)

Table Of Contents

Previous topic

Improved MEMORY Storage Engine

Next topic

Ignoring missing tables in mysqldump

This Page



© Copyright Percona LLC and/or its affiliates 2009-2014.
Except where otherwise noted, this documentation is licensed under the following license:
CC Attribution-ShareAlike 2.0 Generic
Created using Sphinx 1.1.3.
This documentation is developed in Launchpad as part of the Percona Server source code.
If you spotted innacuracies, errors, don't understood it or you think something is missing or should be improved, please file a bug.
]]>