MYSQL MMM部署實錄

來源:互聯網
上載者:User

標籤:init   microsoft   reader   sage   pdf   monitor   help   db2   switch   

king01與king02互為主從關係,king03作為king01的slave


king01,king02,king03安裝mmm_agent


[[email protected] ~]# cd /usr/local/src

[[email protected] src]# rpm -ivh epel-release-6-8.noarch.rpm

[[email protected] ~]# yum -y install mysql-mmm-agent

[[email protected] ~]# rpm -qa | grep mysql-mmm-agent

mysql-mmm-agent-2.2.1-2.el6.noarch


[[email protected] ~]# cd /usr/local/src

[[email protected] src]# rpm -ivh epel-release-6-8.noarch.rpm

[[email protected] ~]# yum -y install mysql-mmm-agent

[[email protected] ~]# rpm -qa | grep mysql-mmm-agent

mysql-mmm-agent-2.2.1-2.el6.noarch


[[email protected] ~]# cd /usr/local/src

[[email protected] src]# rpm -ivh epel-release-6-8.noarch.rpm

[[email protected] ~]# yum -y install mysql-mmm-agent

[[email protected] ~]# rpm -qa | grep mysql-mmm-agent

mysql-mmm-agent-2.2.1-2.el6.noarch


[[email protected] ~]# mysql -uroot -pabcd.1234

mysql> grant replication client on *.* to 'mmm_monitor'@'%' identified by 'mmm_monitor';

mysql> grant super,replication client,process on *.* to 'mmm_agent'@'%' identified by 'mmm_agent';


[[email protected] ~]# cd /etc/mysql-mmm/

[[email protected] 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          mmm_agent

</host>


<host db1>

    ip      192.168.1.201

    mode    master

    peer    db2

</host>


<host db2>

    ip      192.168.1.202

    mode    master

    peer    db1

</host>


<host db3>

    ip      192.168.1.203

    mode    slave

</host>


<role writer>

    hosts   db1, db2

    ips     192.168.1.200

    mode    exclusive

</role>


<role reader>

    hosts   db1, db2, db3

    ips     192.168.1.201,192.168.1.202,192.168.1.203

    mode    balanced

</role>


[[email protected] mysql-mmm]# scp mmm_common.conf [email protected]:/etc/mysql-mmm/

[[email protected] mysql-mmm]# scp mmm_common.conf [email protected]:/etc/mysql-mmm/


[[email protected] mysql-mmm]# vi 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


[[email protected] ~]# cd /etc/default/

[[email protected] default]# vi mysql-mmm-agent

# mysql-mmm-agent defaults

ENABLED=1


[[email protected] ~]# cd /etc/init.d

[[email protected] init.d]# ./mysql-mmm-agent start

[[email protected] init.d]# ./mysql-mmm-agent status

mmm_agentd (pid  2915) is running...


[[email protected] ~]# cd /etc/mysql-mmm/

[[email protected] mysql-mmm]# vi 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


[[email protected] ~]# cd /etc/default/

[[email protected] default]# vi mysql-mmm-agent

# mysql-mmm-agent defaults

ENABLED=1


[[email protected] ~]# cd /etc/init.d

[[email protected] init.d]# ./mysql-mmm-agent start

[[email protected] init.d]# ./mysql-mmm-agent status

mmm_agentd (pid  3907) is running...


[[email protected] ~]# cd /etc/mysql-mmm/

[[email protected] mysql-mmm]# vi 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


[[email protected] ~]# cd /etc/default/

[[email protected] default]# vi mysql-mmm-agent

# mysql-mmm-agent defaults

ENABLED=1


[[email protected] ~]# cd /etc/init.d

[[email protected] init.d]# ./mysql-mmm-agent start

[[email protected] init.d]# ./mysql-mmm-agent status

mmm_agentd (pid  2176) is running...


king04安裝mmm_monitor


[[email protected] ~]# cd /usr/local/src

[[email protected] src]# rpm -ivh epel-release-6-8.noarch.rpm

[[email protected] src]# yum -y install mysql-mmm*

[[email protected] src]# rpm -qa | grep mysql-mmm

mysql-mmm-tools-2.2.1-2.el6.noarch

mysql-mmm-agent-2.2.1-2.el6.noarch

mysql-mmm-monitor-2.2.1-2.el6.noarch

mysql-mmm-2.2.1-2.el6.noarch


[[email protected] ~]# cd /etc/mysql-mmm/

[[email protected] mysql-mmm]# scp mmm_common.conf [email protected]:/etc/mysql-mmm/


[[email protected] mysql-mmm]# vi 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            192.168.1.1,192.168.1201,192.168.1.202,192.168.1.203

    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    mmm_monitor

</host>


debug 0


[[email protected] ~]# cd /etc/init.d/

[[email protected] init.d]# ./mysql-mmm-monitor start

[[email protected] init.d]# ./mysql-mmm-monitor status

mmm_mond (pid  1175) is running...


[[email protected] ~]# mmm_control help

Valid commands are:

    help                              - show this message

    ping                              - ping monitor

    show                              - show status

    checks [<host>|all [<check>|all]] - show checks status

    set_online <host>                 - set host <host> online

    set_offline <host>                - set host <host> offline

    mode                              - print current mode.

    set_active                        - switch into active mode.

    set_manual                        - switch into manual mode.

    set_passive                       - switch into passive mode.

    move_role [--force] <role> <host> - move exclusive role <role> to host <host>

                                        (Only use --force if you know what you are doing!)

    set_ip <ip> <host>                - set role with ip <ip> to host <host>


[[email protected] ~]# mmm_control mode

ACTIVE


[[email protected] ~]# mmm_control show

  db1(192.168.1.201) master/ONLINE. Roles: reader(192.168.1.201), writer(192.168.1.200)

  db2(192.168.1.202) master/ONLINE. Roles: reader(192.168.1.202)

  db3(192.168.1.203) slave/ONLINE. Roles: reader(192.168.1.203)


[[email protected] ~]# mmm_control checks all

db2  ping         [last change: 2018/02/11 06:10:13]  OK

db2  mysql        [last change: 2018/02/11 06:10:13]  OK

db2  rep_threads  [last change: 2018/02/11 06:10:13]  OK

db2  rep_backlog  [last change: 2018/02/11 06:10:13]  OK: Backlog is null

db3  ping         [last change: 2018/02/11 06:10:13]  OK

db3  mysql        [last change: 2018/02/11 06:10:13]  OK

db3  rep_threads  [last change: 2018/02/11 06:10:13]  OK

db3  rep_backlog  [last change: 2018/02/11 06:10:13]  OK: Backlog is null

db1  ping         [last change: 2018/02/11 06:10:13]  OK

db1  mysql        [last change: 2018/02/11 06:10:13]  OK

db1  rep_threads  [last change: 2018/02/11 06:15:39]  OK

db1  rep_backlog  [last change: 2018/02/11 06:15:27]  OK: Backlog is null







  




MYSQL MMM部署實錄

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.