9. ENABLED=1
然后启动它:
/etc/init.d/mysql-mmm-agent start
启动监控
在监控服务器上
编辑/etc/default/mysql-mmm-monitor 文件来开启监控
ENABLED=1
然后启动它:
/etc/init.d/mysql-mmm-monitor start
等待几秒钟 mmmd_mon 启动,在几秒钟后你可以用 mmm_control 来检查群集的状态
mon$ mmm_control show
db1(192.168.0.11) master/AWAITING_RECOVERY. Roles:
db2(192.168.0.12) master/AWAITING_RECOVERY. Roles:
db3(192.168.0.13) slave/AWAITING_RECOVERY. Roles:
db4(192.168.0.14) slave/AWAITING_RECOVERY. Roles:
因为这是第一次启动,所以我们的监控还不知道我们的主机,因此会设置所有主机的状态
为 AWAITING_RECOVERY 并且会记录一条警告信息!
mon$ tail /var/log/mysql-mmm/mmmd_mon.warn
…
2009/10/28 23:15:28 WARN Detected new host 'db1': Setting its initial state to
'AWAITING_RECOVERY'. Use 'mmm_control set_online db1' to switch it online.
2009/10/28 23:15:28 WARN Detected new host 'db2': Setting its initial state to
'AWAITING_RECOVERY'. Use 'mmm_control set_online db2' to switch it online.
2009/10/28 23:15:28 WARN Detected new host 'db3': Setting its initial state to
'AWAITING_RECOVERY'. Use 'mmm_control set_online db3' to switch it online.
2009/10/28 23:15:28 WARN Detected new host 'db4': Setting its initial state to
'AWAITING_RECOVERY'. Use 'mmm_control set_online db4' to switch it online.
现在我们设置我们的主机为在线状态( db1 最先,因为其他的主机是从 db1 复制更新
的!):
10. mon$ mmm_control set_online db1
OK: State of 'db1' changed to ONLINE. Now you can wait some time and check its new roles!
mon$ mmm_control set_online db2
OK: State of 'db2' changed to ONLINE. Now you can wait some time and check its new roles!
mon$ mmm_control set_online db3
OK: State of 'db3' changed to ONLINE. Now you can wait some time and check its new roles!
mon$ mmm_control set_online db4
OK: State of 'db4' changed to ONLINE. Now you can wait some time and check its new roles!
官方文档链接:http://mysql-mmm.org/mmm2:guide