New MySQL 5.6 Replication Utilities – mysqlfailover and mysqlrpladmin

With all of the new news coming out right now, it can be easy to miss or overlook some of the new features.

While there’s been a lot of talk about MySQL 5.6 Replication, I specifically wanted to mention the new ‘mysqlfailover’ and ‘mysqlrpladmin’ utilities.

These are two new MySQL replication utilities (results of the new Global Transaction Identifiers (GTIDs) in MySQL 5.6).

Let me quote the MySQL 5.6 Replication article for both of these utilities:

mysqlfailover

“Provides continuous monitoring of the replication topology, enabling failover to a slave in the event of an outage on the master.

The default behavior is to promote the most up-to-date slave, based on the sets of GTIDs that have been applied, but the promotion policies are fully configurable. Therefore, a user can nominate a specific candidate slave to become the new master (i.e. because it is configured in a certain way or has better performing hardware), and the utility will automatically poll the other slaves to retrieve any events so far not replicated to the candidate slave’s relay log.

This ensures no replicated transactions are lost, even if the candidate is not the most current slave when failover is initiated.”

mysqlrpladmin

“If a user needs to take a master offline for scheduled maintenance, mysqlrpladmin can perform a switchover to a slave, defaulting to the most recent slave, or to a nominated candidate slave. It can also perform a manual failover in the event a master server has gone offline.

The utility can also be used to start and stop slaves, as well as provide slave discovery and basic monitoring, including

  • Status of the slave and its I/O and SQL threads;
  • Status of replication processing through the topology, including any lag or errors;
  • Configuration of slave promotion policies.

With either of these utilities, the user may register scripts to be called in the event of a slave promotion – for example to redirect an application to use the new master for writes and for reads that must always be consistent.”

The new MySQL Utilities are only included in MySQL Workbench, which you can download from:

http://www.mysql.com/downloads/workbench/

Again, I should note this functionality is included in 5.6, which is not GA, so I certainly don’t recommend this for production usage.

I’ve not had a chance to test these out yet myself, but Dr. Chuck Bell has posted some usage/results here, which I think you’ll find useful.

Hope this helps.