Haha, last article of the year. Finish writing this afternoon off.
MMM Official introduction:
MMM (multi-master Replication Manager for MySQL) are a set of flexible scripts to perform monitoring/failover and managemen T of MySQL Master-master replication configurations (with only one node writable in any time).
The toolset also have the ability to read balance standard master/slave configurations with any number of slaves, so CA n use it to move virtual IP addresses around a group of servers depending on whether they is behind in replication.
The current version of this software are stable, but the authors would appreciate any comments, suggestions, bug reports AB Out the this version of make it even better. Current version 2.0 development are led by Pascal Hofmann. If you require support, advice or assistance with deployment, please contact Percona or Open Query.
Installation Environment:
One monitor, two MySQL server mutual master from
Monitor:os:redhat6.3name:zbdba1ip:192.168.56.170mysql Server1:os:redhat6.3name:zbdba2ip:192.168.56.171mysql server2:os:redhat6.3name:zbdba3ip:192.168.56.172
1, install MMM monitoring
2. Install MMM agent
3. Install MySQL
4, the configuration of the main from
5. Create user
6. Configuration
7. Start MMM
8. Testing
1, install MMM monitoring
The Epel yum source is installed here, but the following packages are still missing:
RPM-IVH ftp://195.220.108.108/linux/dag/redhat/el6/en/x86_64/extras/RPMS/perl-Algorithm-Diff-1.1902-1.el6.rfx.noarch.rpm
RPM-IVH http://pkgs.repoforge.org/perl-Email-Date-Format/perl-Email-Date-Format-1.002-1.el6.rfx.noarch.rpm
Local Source: Yum Install rrdtool*
RPM-IVH rrdtool-perl-1.3.8-6.el6.x86_64.rpm
At last:
Yum Install mysql-mmm*
2. Install MMM agent
It's the same as before the first step.
Yum-y Install Mysql-mmm-agent
3. Install MySQL
4, the configuration of the main from
These two steps are not explained in detail.
5. Create user
In any single database:
GRANT SUPER, REPLICATION CLIENT, PROCESS on *. * to ' mmm_agent ' @ ' 192.168.56.% ' identified by ' MySQL '; GRANT REPLICATION CLIENT on * * to ' mmm_monitor ' @ ' 192.168.56.% ' identified by ' MySQL ';
6. Configuration
Cat/etc/mysql-mmm/mmm_common.conf[[email protected] mysql-mmm]# cat/etc/mysql-mmm/mmm_common.confactive_ Master_role writer
7. Start MMM
To start the agent node:
[[email protected] default]#/etc/init.d/mysql-mmm-agent start
[[email protected] default]#/etc/init.d/mysql-mmm-agent start
To start the Monitoring node:
[[email protected] default]#/etc/init.d/mysql-mmm-monitor start
View Status:
[[email protected] mysql-mmm]# Mmm_control show DB1 (192.168.56.171) master/online. Roles:reader (192.168.56.175), writer (192.168.56.173) DB2 (192.168.56.172) master/online. Roles:reader (192.168.56.174) [[email protected] default]# IP a1:lo: <LOOPBACK,UP,LOWER_UP> MTU 16436 Qdisc Noqueue State UNKNOWN link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo Inet6 :: 1/128 Scope host Valid_lft forever Preferred_lft Forever2:eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU 1500 Qdisc pfifo_fast State up Qlen link/ether 08:00:27:70:d2:ad brd ff:ff:ff:ff:ff:ff inet 192.168.56.171/24 BRD 19 2.168.56.255 Scope Global eth0 inet 192.168.56.175/32 scope global eth0 inet 192.168.56.173/32 scope Global eth0 Inet6 fe80::a00:27ff:fe70:d2ad/64 scope link Valid_lft forever preferred_lft forever3:eth1: <broadcast,multicast ,up,lower_up> MTU Qdisc Pfifo_fast State up Qlen-Link/ether 08:00:27:57:10:81 BRD ff:ff:ff:ff:ff:ff inet 192.168.253.111/24 BRD 192.168.253.255 scope global eth1 Inet6 fe80::a00:27ff:fe57:1081 /64 scope link Valid_lft forever preferred_lft forever[[email protected] mysql-mmm]# IP a1:lo: <loopback,up ,lower_up> MTU 16436 qdisc noqueue State UNKNOWN link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00:00 inet 127.0 .0.1/8 Scope Host lo inet6:: 1/128 scope host Valid_lft forever Preferred_lft Forever2:eth0: <broadcast,multi Cast,up,lower_up> MTU Qdisc Pfifo_fast State up Qlen, Link/ether 08:00:27:39:b0:e7 BRD FF:FF:FF:FF:FF:FF inet 192.168.56.172/24 BRD 192.168.56.255 scope global eth0 inet 192.168.56.174/32 scope global eth0 Inet6 fe80::a0 0:27FF:FE39:B0E7/64 scope link Valid_lft forever preferred_lft forever3:eth1: <BROADCAST,MULTICAST,UP,LOWER_UP&G T MTU Qdisc Pfifo_fast State up Qlen link/ether 08:00:27:08:3b:71 BRD ff:ff:ff:ff:ff:ff inet 192.168.253.112 /24 BRD 192.168.253.2The scope global eth1 inet6 fe80::a00:27ff:fe08:3b71/64 scope link Valid_lft forever Preferred_lft forever
Discover ZBDBA2 becomes read node, Zbdba3 as Write node
8. Testing
Close the Zbdba2 MySQL
[[Email protected] default]# service MySQL stop
Shutting down MySQL ... success!
Check the monitor status again:
[[email protected] mysql-mmm]# Mmm_control show DB1 (192.168.56.171) master/hard_offline. ROLES:DB2 (192.168.56.172) master/online. Roles:reader (192.168.56.174), Reader (192.168.56.175), writer (192.168.56.173) [[email protected] mysql-mmm]# IP A1:lo: <LOOPBACK,UP,LOWER_UP> MTU 16436 qdisc noqueue State UNKNOWN link/loopback 00:00:00:00:00:00 BRD 00:00:00 : 00:00:00 inet 127.0.0.1/8 Scope host lo inet6:: 1/128 scope host Valid_lft forever Preferred_lft Forever2:et H0: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU Qdisc Pfifo_fast State up Qlen, Link/ether 08:00:27:39:b0:e7 b Rd FF:FF:FF:FF:FF:FF inet 192.168.56.172/24 BRD 192.168.56.255 scope global eth0 inet 192.168.56.174/32 scope Global Eth0 inet 192.168.56.175/32 Scope global eth0 inet 192.168.56.173/32 scope global eth0 Inet6 fe80::a00:27ff:fe39 : b0e7/64 scope link Valid_lft forever preferred_lft forever3:eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU 1500 Qdisc Pfifo_fAST state up Qlen link/ether 08:00:27:08:3b:71 brd ff:ff:ff:ff:ff:ff inet 192.168.253.112/24 BRD 192.168.253.25 5 Scope Global eth1 INET6 fe80::a00:27ff:fe08:3b71/64 scope link Valid_lft forever Preferred_lft forever
All the VIPs were found drifting to zbdba3.
Install Mysql MMM on Redhat6.3