mmmf - multi-master mysql failover
# failover mysql cluster (as configured in /etc/mmmf.conf) # to the new master SLAVE_ID # mmmf --cfg /etc/mmmf.conf --failover-to <SLAVE_ID> [--debug]
mmmf is a proof of concept tool implementing mmmf algorithm described here: http://www.nigilist.ru/nit/mmmf/
Please note that currently the tool is a proof of concept only and should not be used in production environment as it does not implement a lot of error and random conditions checking.
If you need in-depth explanation of the algorithm, please check out this video recorded specially for Mysql & friends devroom of FOSDEM 2011:
http://www.youtube.com/watch?v=Qzht1B7p0yQ
Find below sample configuration file, you can copy and adjust it according to your configuration. It should list all of your databases (master and slaves). The file is sourced into mmmf, so you have to respect perl syntax in it.
If the database is local 'sock' option is required, otherwise it can be left empty.
#!/usr/bin/perl { package mmmf; $LOG = "/tmp/mmmf.log"; $db = { 'test1' => { 'host' => "localhost", 'port' => 33001, 'user' => "root", 'pass' => "", 'sock' => "/var/lib/mysql1/mysqld.sock", 'encoding' => "utf8", }, 'test2' => { 'host' => "localhost", 'port' => 33002, 'user' => "root", 'pass' => "", 'sock' => "/var/lib/mysql2/mysqld.sock", 'encoding' => "utf8", }, 'test3' => { 'host' => "localhost", 'port' => 33003, 'user' => "root", 'pass' => "", 'sock' => "/var/lib/mysql3/mysqld.sock", 'encoding' => "utf8", }, }; } 1;
Thanks to the whole Yandex team and personally to the following people (in alphabetic order):
Andrey Grunau Dmitry Parfenov Pavel Pushkarev Alexey Simakov
for their ideas and support.
Petya Kohts <petya@kohts.ru>
Copyright 2011 Petya Kohts.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install mmmf, copy and paste the appropriate command in to your terminal.
cpanm
cpanm mmmf
CPAN shell
perl -MCPAN -e shell install mmmf
For more information on module installation, please visit the detailed CPAN module installation guide.