Install Mysql MMM On Redhat 6.3(一)

2015-02-25 21:42:22 · 作者: · 浏览: 77

?

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.3
Name:zbdba1
IP:192.168.56.170

Mysql Server1:
OS:redhat6.3
Name:zbdba2
IP:192.168.56.171

Mysql Server2:
OS:redhat6.3
Name:zbdba3
IP:192.168.56.172
1、安装MMM监控
2、安装MMM agent
3、安装mysql
4、配置互为主从
5、创建用户
6、配置
7、启动MMM
8、测试

?

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.rpm
rpm -ivh http://pkgs.repoforge.org/perl-Email-Date-Format/perl-Email-Date-Format-1.002-1.el6.rfx.noarch.rpm


本地源: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-agent




3、安装mysql
4、配置互为主从
这两步就不详细说明了。

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.conf
active_master_role      writer


    cluster_interface       eth0
    pid_path                /var/run/mysql-mmm/mmm_agentd.pid
    bin_path                /usr/libexec/mysql-mmm/
    replication_user        replicant
    replication_password    mysql
    agent_user              mmm_agent
    agent_password          mysql



    ip      192.168.56.171
    mode    master
    peer    db2



    ip      192.168.56.172
    mode    master
    peer    db1


#
#    ip      192.168.100.51
#    mode    slave
#


    hosts   db1, db2
    ips     192.168.56.173
    mode    exclusive



    hosts   db1, db2
    ips     192.168.56.174, 192.168.56.175
    mode    balanced


在每个节点都需要配置以上内容

修改agent节点:
[root@zbdba2 mysql-mmm]# cat mmm_agent.conf
include mmm_common.conf

# The 'this' variable refers to this

[root@zbdba3 mysql-mmm]# cat mmm_agent.conf
include 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 db2

7、启动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 a
1: lo:  mtu 16436 qdisc noqueue state UNKNOWN
    link/loop