------------------------[4] mmm_agent.conf ——————– include mmm_common.conf this db1 #在DB1上就写成这样,DB2上就写成this db2,写错了,将有一台DB的mysql-mmm-agent开不起来!切记!
查看状态: [root@Proxy ~]# mmm_control show db1(192.168.9.157) master/ONLINE. Roles: reader(192.168.9.156), writer(192.168.9.154) db2(192.168.9.158) master/ONLINE. Roles: reader(192.168.9.155) [root@Proxy ~]# mmm_control checks db2 ping [last change: 2012/02/03 14:04:41] OK db2 mysql [last change: 2012/02/03 14:04:41] OK db2 rep_threads [last change: 2012/02/03 14:04:41] OK db2 rep_backlog [last change: 2012/02/03 14:04:41] OK: Backlog is null db1 ping [last change: 2012/02/03 14:04:41] OK db1 mysql [last change: 2012/02/03 14:04:41] OK db1 rep_threads [last change: 2012/02/03 14:04:41] OK db1 rep_backlog [last change: 2012/02/03 14:04:41] OK: Backlog is null [root@Proxy ~]# mmm_control mode ACTIVE
模拟宕机切换: 随便找一个客户端,执行写操作: @client[root@mysql-1 ~]# vi /usr/local/mysql/binlog/inserting-into-db.sh #!/bin/bash while true; do mysql -ufbdb_user -pJc7ech-fB-me -h192.168.9.154 --database= fbdb -e "insert into test values(null);" sleep 1 ; done; [root@mysql-1 ~]# ./inserting-into-db.sh &
检查mmmDB1的日志: [root@fbfldb01 binlog]# tail -f /var/log/mysql-mmm/mmm_agentd.log 2012/02/03 17:46:10 FATAL Couldn't allow writes: ERROR: Can't connect to MySQL (host = 192.168.9.157:3306, user = mmm_agent)! Lost connection to MySQL server at 'reading initial communication packet', system error: 111 2012/02/03 17:46:13 INFO We have some new roles added or old rules deleted! 2012/02/03 17:46:13 INFO Deleted: reader(192.168.9.156), writer(192.168.9.154) 2012/02/03 17:46:13 FATAL Couldn't deny writes: ERROR: Can't connect to MySQL (host = 192.168.9.157:3306, user = mmm_agent)! Lost connection to MySQL server at 'reading initial communication packet', system error: 111 2012/02/03 17:59:48 INFO We have some new roles added or old rules deleted! 2012/02/03 17:59:48 INFO Added: reader(192.168.9.155) 2012/02/03 18:01:12 INFO We have some new roles added or old rules deleted!