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.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
[[email protected] mysql-mmm]# cat /etc/mysql-mmm/mmm_common.conf
active_master_role      writer

<host default>
    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
</host>

<host db1>
    ip      192.168.56.171
    mode    master
    peer    db2
</host>

<host db2>
    ip      192.168.56.172
    mode    master
    peer    db1
</host>

#<host db3>
#    ip      192.168.100.51
#    mode    slave
#</host>

<role writer>
    hosts   db1, db2
    ips     192.168.56.173
    mode    exclusive
</role>

<role reader>
    hosts   db1, db2
    ips     192.168.56.174, 192.168.56.175
    mode    balanced
</role>

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

修改agent节点:
[[email protected] mysql-mmm]# cat mmm_agent.conf
include mmm_common.conf

# The 'this' variable refers to this

[[email protected] 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节点:

[[email protected] default]# /etc/init.d/mysql-mmm-agent start

[[email protected] default]# /etc/init.d/mysql-mmm-agent start

启动监控节点:

[[email protected] default]#/etc/init.d/mysql-mmm-monitor start

查看状态:

[[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 a
1: 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 forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:70:d2:ad brd ff:ff:ff:ff:ff:ff
    inet 192.168.56.171/24 brd 192.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 forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    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 a
1: 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 forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    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::a00:27ff:fe39:b0e7/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    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.255 scope global eth1
    inet6 fe80::a00:27ff:fe08:3b71/64 scope link
       valid_lft forever preferred_lft forever

发现zbdba2成为读节点,zbdba3为写节点

8、测试

关闭zbdba2 的mysql

[[email protected] default]# service mysql stop

Shutting down MySQL... SUCCESS!

再次查看monitor状态:

[[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 a
1: 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 forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    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
    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 forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    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.255 scope global eth1
    inet6 fe80::a00:27ff:fe08:3b71/64 scope link
       valid_lft forever preferred_lft forever

发现所有VIP都漂移到zbdba3上了。

时间: 2024-09-30 06:03:56

Install Mysql MMM On Redhat6.3的相关文章

Install Mysql MHA On Redhat6.3

官方介绍: MHA performs automating master failover and slave promotion with minimal downtime, usually within 10-30 seconds. MHA prevents replication consistency problems and saves on expenses of having to acquire additional servers. All this with zero per

MySQL mmm 高可用配置

10.10.10.20:监控端 10.10.10.21:主 10.10.10.22:主 10.10.10.23:从 10.10.10.24:从 yum -y install mysql mysql-server service mysqld start yum -y install mysql-mmm* useradd --comment "MMM Script owner" --shell /sbin/nologin mmmd yum -y install perl-Time-HiR

Mysql MMM 高可用

一.Mysql MMM 高可用概况: mmm_mond  负责所有的监控工作的监控守护进程,决定节点的移除等: mmm_agentd  运行在mysql服务器上的代理守护进程,通过简单远程服务集提供给监控节点: mmm_control  命令行管理mmm_mond进程: Monitor:192.168.209.18 DB1:192.168.209.19 DB2:192.168.209.20 DB3:192.168.209.21   virtual write ip:192.168.209.4 v

MySQL——mmm高可用(实践!)

MySQL-MMM优缺点: 优点:高可用性,扩展性好,出现故障自动切换,对于主主同步,在同一时间只提供一台数据库写操作,保证的数据的一致性. 缺点:Monitor节点是单点,可以结合Keepalived实现高可用. MySQL-MMM工作原理:  MMM(Master-Master replication managerfor Mysql,Mysql主主复制管理器)是一套灵活的脚本程序,基于perl实现,用来对mysql replication进行监控和故障迁移,并能管理mysql Master

MySQL—MMM高可用群集的搭建(全过程,纯干货~~)

本篇文章主要介绍搭建MMM方案以及MMM架构的原理.MMM方案不适用对数据一致性要求很高的业务.下面一起来学习学习. 先来看看具体的架构拓扑,如下: 其中, 角色 Hosts IP地址 应用属性 VIP master1 master 192.168.142.135 write 192.168.142.188 master2 backup 192.168.142.132 write|read 192.168.142.188 slave1 slave 192.168.142.136 read 192

MySQL——MMM高可用

MySQL-MMM优缺点: 优点:高可用性,扩展性好,出现故障自动切换,对于主主同步,在同一时间只提供一台数据库写操作,保证的数据的一致性. 缺点:Monitor节点是单点,可以结合Keepalived实现高可用. 实验环境: master1服务器 192.168.13.167 master2服务器 192.168.13.151 slave1服务器 192.168.13.168 slave2服务器 192.168.13.145 monitor服务器 192.168.13.164 1.在maste

How to Install MySQL on CentOS 7

How to Install MySQL on CentOS 7 Updated Thursday, August 27th, 2015 by Linode Use promo code DOCS10 for $10 credit on a new account. Try this Guide Contribute on GitHub View Project | View File | Edit File MySQL is a popular database management syst

Install MySQL 5.7 on Fedora 25/24, CentOS/RHEL 7.3/6.8/5.11

1. Change root user Bash su - ## OR ## sudo -i 2. Install MySQL YUM repository Fedora Bash ## Fedora 25 ## dnf install https://dev.mysql.com/get/mysql57-community-release-fc25-9.noarch.rpm ## Fedora 24 ## dnf install https://dev.mysql.com/get/mysql57

ubuntu install mysql server method

     recently try to install mysql in my computer so that  I can practise some sql statement on sever.But there are some problem while install mysql package in my ubuntu system.I hava tried lots of ways to move on. at last.I find there is a best way