mysql MMM高可用方案
来源:互联网 发布:mac c66是什么色 编辑:程序博客网 时间:2024/05/16 09:17
环境配置
MMM_monitor:172.19.0.122
MySQL_master1:172.19.0.121 (db1)
MySQL_master2:172.19.0.122(db2)
MySQL_slave1:172.19.123(db3)
VIP_Write:172.19.0.126
vip_Read1:172.19.0.127, 172.19.0.128
三台服务安装好mysql,把db1与db2做成主主同步,db3为从,是同步db1的。后面搭建好mmm后,当DB1的脱机后,db3会自动change同步db2。
1.设置hosts解析
三台服务的配置如下
[root@db1 ~]# cat /etc/hosts
172.19.0.121 db1
172.19.0.122 db2
172.19.0.123 db3
创建三个账号。
(复制账号)
GRANT REPLICATION slave,REPLICATION CLIENT ON *.* TO 'repl'@'%' IDENTIFIED BY 'repl';
(代理账号)
GRANT PROCESS,SUPER,REPLICATION CLIENT ON *.* TO 'mmm_agent'@'%' IDENTIFIED BY '123456';
(监听账号)
GRANT REPLICATION CLIENT ON *.* TO 'mmm_monitor'@'%' IDENTIFIED BY '123456';
3.安装mysql-mmm
在三台服务上分别进行安装,安装命令如下:
#wget http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
#rpm -ivh epel-release-5-4.noarch.rpm
#yum -y install mysql-mmm*
4.配置MMM监控、代理服务
在三台服务器修改mmm_common.conf配置文件
[root@db1 ~]# cd /etc/mysql-mmm/
[root@db1 mysql-mmm]# vi 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 repl
replication_password repl
agent_user mmm_agent
agent_password 123456
</host>
<host db1>
ip 172.19.0.121
mode master
peer db2
</host>
<host db2>
ip 172.19.0.122
mode master
peer db1
</host>
<host db3>
ip 172.19.0.123
mode slave
</host>
<role writer>
hosts db1, db2
ips 172.19.0.126
mode exclusive
</role>
<role reader>
hosts db1, db2, db3
ips 172.19.0.127,172.19.0.128
mode balanced
</role>
其次,修改三台服务器mmm_agent.conf配置文件
[root@db1 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 db1
[root@db2 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
[root@db3 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 db3
最后修改172.19.0.122(db2) mysql-mon服务配置mmm_mon.conf配置文件,把这台做为MMM_monitor
[root@db2 mysql-mmm]# cat mmm_mon.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 db1
[root@db1 mysql-mmm]# cat mmm_mon.conf
include mmm_common.conf
<monitor>
ip 127.0.0.1
pid_path /var/run/mysql-mmm/mmm_mond.pid
bin_path /usr/libexec/mysql-mmm
status_path /var/lib/mysql-mmm/mmm_mond.status
ping_ips 172.19.0.121,172.19.0.122,172.19.0.123
auto_set_online 10
# The kill_host_bin does not exist by default, though the monitor will
# throw a warning about it missing. See the section 5.10 "Kill Host
# Functionality" in the PDF documentation.
#
# kill_host_bin /usr/libexec/mysql-mmm/monitor/kill_host
#
</monitor>
<host default>
monitor_user mmm_monitor
monitor_password 123456
</host>
debug 0
这样,配置MMM监控,代理服务的工作就完成了
5.启动相关服务
在三台服务器启动以下服务
/etc/init.d/mysql-mmm-agent start
在db2中启动mysql-mon监控服务
/etc/init.d/mysql-mmm-monitor start
查看MMM状态信息
[root@db2 mysql-mmm]# mmm_control show
db1(172.19.0.121) master/ONLINE. Roles: writer(172.19.0.126)
db2(172.19.0.122) master/ONLINE. Roles: reader(172.19.0.127)
db3(172.19.0.123) slave/ONLINE. Roles: reader(172.19.0.128)
[root@db2 mysql-mmm]# mmm_control checks all
db2 ping [last change: 2014/08/22 16:57:07] OK
db2 mysql [last change: 2014/08/22 16:57:07] OK
db2 rep_threads [last change: 2014/08/22 16:57:07] OK
db2 rep_backlog [last change: 2014/08/22 16:57:07] OK: Backlog is null
db3 ping [last change: 2014/08/22 16:57:07] OK
db3 mysql [last change: 2014/08/22 17:11:48] OK
db3 rep_threads [last change: 2014/08/22 16:57:07] OK
db3 rep_backlog [last change: 2014/08/22 16:57:07] OK: Backlog is null
db1 ping [last change: 2014/08/22 16:57:07] OK
db1 mysql [last change: 2014/08/22 16:57:07] OK
db1 rep_threads [last change: 2014/08/22 16:57:07] OK
db1 rep_backlog [last change: 2014/08/22 16:57:07] OK: Backlog is null
以上说明成功,为了数据一致性,我们采用半同步方案
- mysql MMM高可用方案
- MySQL MMM高可用方案
- mysql高可用探究(六)MMM高可用mysql方案
- mysql高可用探究(六)MMM高可用mysql方案
- MySQL 高可用MMM
- mysql MMM 高可用解决方案
- mysql-mmm实现mysql高可用
- mysql-mmm实现mysql高可用
- MySQL高可用之MySQL-MMM
- MySQL-MMM实现MySQL高可用
- MySQL-MMM实现MySQL高可用
- MySQL高可用集群之MySQL-MMM
- MySQL高可用之:MySQL-MMM
- MySQL高可用集群之MySQL-MMM
- mysql 高可用之MySQL-MMM
- amoeza+keepalived+mmm+mysql 高可用部署
- CentOS 搭建 Mysql MMM 高可用架构
- MySQL 高可用架构之MMM
- android usb 通信
- IP地址的规划和设计方法(一)
- C#、Java、C、C++初始化数组过程和比较
- 馀事勿取
- AndroidManifest.xml文件详解(uses-configuration)
- mysql MMM高可用方案
- findbugs
- 组合类中成员类(类指针)的构造,拷贝构造,运算符重载及析构函数的调用问题
- Java基础--集合
- eclipse配置jdk源码
- 业务系统到底需要什么样的ID生成器
- 怎样使皮肤变白
- java批量修改文件名--
- 【暑期基础】E HDU 2004 成绩转换