MYSQL MMM部署实录
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MYSQL MMM部署实录相关的知识,希望对你有一定的参考价值。
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部署实录的主要内容,如果未能解决你的问题,请参考以下文章
部署集群基础环境,MySQL-MMM架构部署,MySQL-MMM架构使用
Database基础:部署集群基础环境MySQL-MMM架构部署MySQL-MMM架构使用