Installing and Managing Multi Master Replication Manager(MMM) for MySQL High Availability

4 min read

(Read more interesting articles on MySQL High Availability here.)

Multi Master Replication Manager (MMM): initial installation

This setup is asynchronous, and a small number of transactions can be lost in the event of the failure of the master. If this is not acceptable, any asynchronous replication-based high availability technique is not suitable.

Over the next few recipes, we shall configure a two-node cluster with MMM.

It is possible to configure additional slaves and more complicated topologies. As the focus of this article is high availability, and in order to keep this recipe concise, we shall not mention these techniques (although, they all are documented in the manual available at

MMM consists of several separate Perl scripts, with two main ones:

  1. mmmd_mon: Runs on one node, monitors all nodes, and takes decisions.
  2. mmmd_agent: Runs on each node, monitors the node, and receives instructions from mmm_mon.

In a group of MMM-managed machines, each node has a node IP, which is the normal server IP address. In addition, each node has a “read” IP and a “write” IP. Read and write IPs are moved around depending on the status of each node as detected and decided by mmmd_mon, which migrates these IP address around to ensure that the write IP address is always on an active and working master, and that all read IPs are connected to another master that is in sync (which does not have out-of-date data).

mmmd_mon should not run on the same server as any of the databases to ensure good availability. Thus, the best practice would be to keep a minimum number of three nodes.

In the examples of this article, we will configure two MySQL servers, node 5 and node 6 ( and 6) with a virtual writable IP of and two read-only IPs of and, using a monitoring node node 4 ( We will use RedHat / CentOS provided software where possible.

If you are using the same nodes to try out any of the other recipes discussed in this article, be sure to remove MySQL Cluster RPMs and /etc/my.cnf before attempting to follow this recipe

There are several phases to set up MMM. Firstly, the MySQL and monitoring nodes must have MMM installed, and each node must be configured to join the cluster. Secondly, the MySQL server nodes must have MySQL installed and must be configured in a master-master replication agreement. Thirdly, a monitoring node (which will monitor the cluster and take actions based on what it sees) must be configured. Finally, the MMM monitoring node must be allowed to take control of the cluster.

In this article, each of the previous four steps is a recipe. The first recipe covers the initial installation of MMM on the nodes.

How to do it…

The MMM documentation provides a list of required Perl modules. With one exception, all Perl modules currently required for both monitoring agents and server nodes can be found in either the base CentOS / RHEL repositories, or the EPEL library (see the Appendices for instructions on configuration of this repository), and will be installed with the following yum command:

[root@node6 ~]# yum -y install perl-Algorithm-Diff
perl-Class-Singleton perl-DBD-MySQL perl-Log-Log4perl
perl-Log-Dispatch perl-Proc-Daemon perl-MailTools

Not all of the package names are obvious for each module; fortunately, the actual perl module name is stored in the Other field in the RPM spec file, which can be searched using this syntax:

[root@node5 mysql-mmm-2.0.9]# yum whatprovides "*File::
Loaded plugins: fastestmirror
4:perl-5.8.8-18.el5.x86_64 : The Perl programming language
Matched from:
Other : perl(File::stat) = 1.00
Filename : /usr/share/man/man3/File::stat.3pm.gz

This shows that the Perl File::stat module is included in the base perl package (this command will dump once per relevant file; in this case, the first file that matches is in fact the manual page).

The first step is to download the MMM source code onto all nodes:

[root@node4 ~]# mkdir mmm
[root@node4 ~]# cd mmm
[root@node4 mmm]# wget
13:44:45 (383 KB/s) - `mysql-mmm-2.0.9.tar.gz' saved [50104/50104]

Then we extract it using the tar command:

[root@node4 mmm]# tar zxvf mysql-mmm-2.0.9.tar.gz
[root@node4 mmm]# cd mysql-mmm-2.0.9

Now, we need to install the software, which is simply done with the make file provided:

[root@node4 mysql-mmm-2.0.9]# make install
mkdir -p /usr/lib/perl5/vendor_perl/5.8.8/MMM /usr/bin/mysql-mmm
/usr/sbin /var/log/mysql-mmm /etc /etc/mysql-mmm
/usr/bin/mysql-mmm/agent/ /usr/bin/mysql-mmm/monitor/
[ -f /etc/mysql-mmm/mmm_tools.conf ] || cp etc/mysql-mmm/
mmm_tools.conf /etc/mysql-mmm/

Ensure that the exit code is 0 and that there are no errors:

[root@node4 mysql-mmm-2.0.9]# echo $?

Any errors are likely caused as a result of dependencies—ensure that you have a working yum configuration (refer to Appendices) and have run the correct yum install command.


Please enter your comment!
Please enter your name here