关注于系统高可用、网站架构
分类: 架构设计与优化
2014-08-13 11:33:07
首先安装好MYSQL,并且搭建好 主主从复制 (关于复制的搭建这边就不做详细的说明)
DBS |
物理IP |
主机 |
虚拟IP |
角色 |
tts |
199.155.122.91 |
tts91 |
199.155.122.251 |
reader |
199.155.122.176 |
writer |
|||
199.155.122.194 |
tts194 |
199.155.122.252 |
reader |
|
199.155.122.208 |
tts208 |
|
monitor |
配置选项:
vi /etc/hosts
199.155.122.91 tts91
199.155.122.194 tts194
安装(配置好epel源)
Agent
yum install –y mysql-mmm mysql-mmm-agent
monitor
yum install –y mysql-mmm-monitor
配置文件修改
Agent
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 RepAgent
ip 199.155.122.91
mode master
peer tts194
ip 199.155.122.194
mode master
peer tts91
hosts tts91, tts194
ips 199.155.122.176
mode exclusive
prefer tts91
hosts tts91, tts194
ips 199.155.122.251, 199.155.122.252
mode balanced
mmm_agent.conf
include mmm_common.conf
this tts91
mmm_mon.conf
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 199.155.122.91,199.155.122.194
auto_set_online 30
monitor_user mmm_monitor
monitor_password RepMonitor
创建监控用户 (主库):
grant REPLICATION CLIENT on *.* TO 'mmm_monitor'@'%' identified by ' RepMonitor';
grant SUPER,REPLICATION CLIENT,PROCESS on *.* TO 'mmm_agent'@'%' identified by 'RepMonitor';
grant REPLICATION SLAVE on *.* TO 'repl'@'%' identified by 'repl';
启动 agent 服务 :
service mysql-mmm-agent start
启动 monitor 服务 :
service mysql-mmm-monitor start
检查主机状态:
/usr/sbin/mmm_control checks all
检查集群环境在线状况:
/usr/sbin/mmm_control show
查看监控日志:
cat /var/log/mysql-mmm/mmm_mond.log