MySQL Blog Archive
For the latest blogs go to blogs.oracle.com/mysql
New MySQL Utility to Relocate Binary Logs

We are very happy to introduce a new MySQL utility named “mysqlbinlogmove“, which is used to relocate binary log files. This utility is one of two new utilities included in MySQL Utilities release-1.6.0 Alpha. The other utility is “mysqlgrants“, which is used to display the privileges (grants) of database objects.

Note: I use “binary log” to refer to both “kinds” of binary log files (binlog and relay log files) in general, and use “binlog” to refer specifically to those that are not “relay log” files.

The mysqlbinlogmove utility allows you to move binary log files to a new location taking care of correctly updating the respective index file for you. This utility can be very useful if you want to change the location to store the binlog file and you want to move all of the binary log files. It is also handy to archive older binary log files to a new location thereby saving disk space in the server’s partition.

Main Features

Here is a summary of the main features of the mysqlbinlogmove utility:

  • Moves binary log files to a specified source directory, allowing to relocate all files to a new location. For example, with the server stopped before changing the –log-bin option.
  • Moves binary log files using the server connection specified, allowing to easily archive files no longer in use based on the server settings (e.g., log_bin_basename, log_bin_index, relay_log_basename, relay_log_index).
  • Allows you to specify the type of files to move, binlog files (default), relay log files, or both.
  • Provides options to restrict the files to be move based on their sequence number or modified date.

Requirements

The mysqlbinlogmove utility must be executed on the local server and it requires read and write access to the binary logs and index files, as well as the destination directory to move the files.

Examples

Here is an example of the execution of the utility to move all binlog files from a stopped server, simply specifying the source binlog directory and target destination:

Now, let’s look at another example to move all binary log files modified two days ago from a running slave, specifying the server connection instead of the source directory:

In this case, the –log-type option with the value ‘all’ was used to indicate that both binlog and relay log files will be moved, and the –modified-before option to restrict the files by their modified date.

In this example, it is also possible to observe the flush of binary logs. This operation is required in order to refresh the server’s data. The flush operation can be skipped with the –skip-flush-binlogs options.

Do you want to know more ?

Try it now and send us your feedback

MySQL Utilities release-1.6.0 alpha is available for download from the following links.

MySQL developers website: http://dev.mysql.com/downloads/tools/utilities/
Launchpad project: https://launchpad.net/mysql-utilities

The documentation of MySQL Utilities can be obtained from the following link:
http://dev.mysql.com/doc/index-utils-fabric.html

Contributing Ideas:

Meet us at MySQL Central @ Oracle OpenWorld

Do you want to get your hands dirty and ask your questions directly to the MySQL Utilities team?

Participate in the Hands-on Lab session “DevOps Made Easy with MySQL Utilities” at the 2014 MySQL Central @ OpenWorld conference. See this link for details about the session:
https://oracleus.activeevents.com/2014/connect/sessionDetail.ww?SESSION_ID=9234

MySQL Community Reception at Oracle OpenWorld:
http://eventreg.oracle.com/profile/web/index.cfm?PKWebId=0x11859974f4