从零开始搭建MySQL MMM架构

2019-01-05 09:55:46王旭

<role reader>
    hosts   db2, db3, db4
    ips     192.168.85.201, 192.168.85.202, 192.168.85.203
    mode    balanced
</role>

可以在db1上编辑该文件后,通过scp命令分别复制到monitor、db2、db3和db4上。

2. 编辑mmm_agent.conf。在数据库服务器上,还有一个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

最后一行的db1,在不同的数据库服务器上要分别改为db2、db3和db4,否则代理就会无法启动。

3. 编辑mmm_mon.confg。在管理服务器上,修改mmm_mon.conf文件,修改后内容为:


include mmm_common.conf

<monitor>
    ip                  192.168.84.174
    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            192.168.85.167, 192.168.85.169, 192.168.85.171, 192.168.85.168
    auto_set_online     60

    # 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    monitor
</host>

debug 0

六、启动MMM

1. 在数据库服务器上启动代理程序


# cd /etc/init.d/
# chkconfig mysql-mmm-agent on
# service mysql-mmm-agent start

2. 在管理服务器上启动监控程序


# cd /etc/init.d/
# chkconfig mysql-mmm-monitor on
# service mysql-mmm-monitor start