Install Mysql MMM On Redhat6.3

哈哈,年底最后一篇文章。写完今天下午放假。

MMM官方介绍:MMM (Multi-Master Replication Manager for MySQL) is a set of flexible scripts to perform monitoring/failover and management of MySQL master-master replication configurations (with only one node writable at any time).The toolset also has the ability to read balance standard master/slave configurations with any number of slaves, so you can use it to move virtual IP addresses around a group of servers depending on whether they are behind in replication.The current version of this software is stable, but the authors would appreciate any comments, suggestions, bug reports about this version to make it even better. Current version 2.0 development is led by Pascal Hofmann. If you require support, advice or assistance with deployment, please contact Percona or Open Query.

安装环境:一台监控,,两台mysql server互为主从

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.1721、安装MMM监控2、安装MMM agent3、安装mysql4、配置互为主从5、创建用户6、配置7、启动MMM8、测试

1、安装MMM监控这里安装epel的yum源,但是安装的是任然缺少以下几个包: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.rpmrpm -ivh 本地源:yum install rrdtool*rpm -ivh rrdtool-perl-1.3.8-6.el6.x86_64.rpm最后:yum install mysql-mmm*2、安装MMM agent跟第一步前面都是一样的yum -y install mysql-mmm-agent3、安装mysql4、配置互为主从这两步就不详细说明了。

5、创建用户在任意一台数据库中:

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、配置

cat /etc/mysql-mmm/mmm_common.conf[root@zbdba1 mysql-mmm]# cat /etc/mysql-mmm/mmm_common.confactive_master_rolewriter<host default>cluster_interfaceeth0pid_path/var/run/mysql-mmm/mmm_agentd.pidbin_path/usr/libexec/mysql-mmm/replication_userreplicantreplication_password mysqlagent_usermmm_agentagent_passwordmysql</host><host db1>ip192.168.56.171mode masterpeer db2</host><host db2>ip192.168.56.172mode masterpeer db1</host>#<host db3># ip192.168.100.51# mode slave#</host><role writer>hosts db1, db2ips192.168.56.173mode exclusive</role><role reader>hosts db1, db2ips192.168.56.174, 192.168.56.175mode balanced</role>在每个节点都需要配置以上内容修改agent节点:[root@zbdba2 mysql-mmm]# cat mmm_agent.confinclude mmm_common.conf# The 'this' variable refers to this[root@zbdba3 mysql-mmm]# cat mmm_agent.confinclude mmm_common.conf# The 'this' variable refers to this server. Proper operation requires# that 'this' server (db1 by default), as well as all other servers, have the# proper IP addresses set in mmm_common.conf.this db27、启动MMM

启动agent节点:[root@zbdba2 default]# /etc/init.d/mysql-mmm-agent start[root@zbdba3 default]# /etc/init.d/mysql-mmm-agent start启动监控节点:[root@zbdba1 default]#/etc/init.d/mysql-mmm-monitor start查看状态:

[root@zbdba1 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)[root@zbdba2 default]# ip a1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWNlink/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host loinet6 ::1/128 scope hostvalid_lft forever preferred_lft forever2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000link/ether 08:00:27:70:d2:ad brd ff:ff:ff:ff:ff:ffinet 192.168.56.171/24 brd 192.168.56.255 scope global eth0inet 192.168.56.175/32 scope global eth0inet 192.168.56.173/32 scope global eth0inet6 fe80::a00:27ff:fe70:d2ad/64 scope linkvalid_lft forever preferred_lft forever3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000link/ether 08:00:27:57:10:81 brd ff:ff:ff:ff:ff:ffinet 192.168.253.111/24 brd 192.168.253.255 scope global eth1inet6 fe80::a00:27ff:fe57:1081/64 scope linkvalid_lft forever preferred_lft forever[root@zbdba3 mysql-mmm]# ip a1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWNlink/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host loinet6 ::1/128 scope hostvalid_lft forever preferred_lft forever2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000link/ether 08:00:27:39:b0:e7 brd ff:ff:ff:ff:ff:ffinet 192.168.56.172/24 brd 192.168.56.255 scope global eth0inet 192.168.56.174/32 scope global eth0inet6 fe80::a00:27ff:fe39:b0e7/64 scope linkvalid_lft forever preferred_lft forever3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000link/ether 08:00:27:08:3b:71 brd ff:ff:ff:ff:ff:ffinet 192.168.253.112/24 brd 192.168.253.255 scope global eth1inet6 fe80::a00:27ff:fe08:3b71/64 scope linkvalid_lft forever preferred_lft forever发现zbdba2成为读节点,zbdba3为写节点8、测试关闭zbdba2 的mysql[root@zbdba2 default]# service mysql stopShutting down MySQL… SUCCESS!再次查看monitor状态:

如果你希望成功,以恒心为良友,以经验为参谋,以小心为兄弟,以希望为哨兵。

Install Mysql MMM On Redhat6.3

相关文章:

你感兴趣的文章:

标签云: