MySQL的MMM高可用架构测试
一、架构模式(双master零slave)
==============================================================
一、架构模式(双master零slave)
==============================================================
---------------------[1] mmm_common.conf ——————–
主机:
功能 IP 主机名
monitor 192.168.9.159 proxy
DB db1 Server-id=1 192.168.5.157 fbfldb01
db2 Server-id=2 192.168.9.158 fbfldb02
虚拟ip:
IP0 192.168.9.154 (Write)
IP1 192.168.9.155 (Read)
IP2 192.168.9.156 (Read)
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 slave
replication_password slave
agent_user mmm_agent
agent_password RepAgent
</host>
<host db1>
ip 192.168.9.157
mode master
peer db2
</host>
<host db2>
ip 192.168.9.158
mode master
peer db1
</host>
#<host db3>
# ip 192.168.100.51
# mode slave
#</host>
<role writer>
hosts db1, db2 #能够作为writer的host
ips 192.168.100.250 #writer的虚拟IP,应用的写请求直接访问这里的ip即可
mode exclusive #只有两种模式:exclusive是排他,在这种模式下任何时候只能一个host拥有该角色,balanced模式下可以多个host同时拥有此角色。一般writer是ex,reader是ba
</role>
<role reader>
hosts db1, db2 #能够作为reader的host
ips 192.168.100.251, 192.168.100.252 #reader的虚拟IP,应用的读请求直接访问这里的ip即可
mode balanced
</role>
--------------------[2] mmm_mon.conf ———————–
include mmm_common.conf
<monitor>
ip 127.0.0.1
pid_path /var/run/mmm_mond.pid
bin_path /usr/lib/mysql-mmm/
status_path /var/lib/misc/mmm_mond.status
ping_ips 192.168.9.157, 192.168.9.158,192.168.9.254
</monitor>
<host default>
monitor_user mmm_monitor
monitor_password RepMonitor
</host>
debug 0
------------------------[4] mmm_agent.conf ——————–
include mmm_common.conf
this db1 #在DB1上就写成这样,DB2上就写成this db2,写错了,将有一台DB的mysql-mmm-agent开不起来!切记!