mysql-mmm-agent配置文件
mmm_agent.conf
include mmm_common.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
# this 指定了当前主机为db1
mmm_common.conf
active_master_role writer
# One should set read-only=1 in the configuration of all MySQL servers,
# MMM will change that to read-only=0 on the host with the active_master_role.
# 设置写角色的时候,会执行set global read_only = 0;
cluster_interface eth0
# network interface on which the IPs of the roles should be configured
# 配置的网络接口,注意不能指定为子接口,例如eth0:0
agent_port 9989
# Port on which mmm_agentd listens
# mmm_agentd的监听端口,默认为9989
mysql_port 3306
# Port on which mysqld is listening
# 监听的mysql端口,默认3306
pid_path /var/run/mysql-mmm/mmm_agentd.pid
# Location of pid-file
# pid文件位置,如果配置cluster模式,需要增加cluster标识.
bin_path /usr/libexec/mysql-mmm/
# Path to directory containing MMM binaries
# mmm执行文件路径,注意:2.0版本和2.1版本的路径不一样.
replication_user replication
replication_password XXX
agent_user mmm_agent
agent_password XXX
ip 192.168.250.251
mode master
peer db2
ip 192.168.250.252
mode master
peer db1
hosts db1, db2
ips 192.168.250.111
mode exclusive
# 独有的
hosts db1, db2
ips 192.168.250.112
mode balanced
# 共享的
mysql-mmm-monitor配置文件
mmm_common.conf文件同agent
mmm_mon.conf
include mmm_common.conf
ip 127.0.0.1
# IP on which mmm_mond listens
# 为了安全性,只在本机监听
port 9988
# Port on which mmm_mond listens
# mmm_mond监听端口,默认9988
pid_path /var/run/mysql-mmm/mmm_mond.pid
# Location of pid-file
# pid文件位置,如果配置cluster模式,需要指定标识
bin_path /usr/libexec/mysql-mmm
# Path to directory containing MMM binaries
# mmm执行文件路径,注意:2.0版本和2.1版本的路径不一样.
status_path /var/lib/mysql-mmm/mmm_mond.status
# Location of of status file
# 保存了mmm的状态文件
ping_interval 1
# Break between network checks
# 检查的时间间隔,默认1秒
ping_ips 192.168.250.251, 192.168.250.252
# IPs used for network checks
# 用于测试网络可用性的IP地址,其中有一个地址能ping通,就代表网络正常.不要写入本机的ip地址
flap_duration 3600
# Duration in seconds for flap detection. See flap_count
# 抖动的时间范围,默认3600秒
flap_count 3
# Maximum number of downtimes within flap_duration seconds after which a host is considered to be flapping.
# 在抖动的时间范围内,最大的抖动次数
auto_set_online 0
# How many seconds to wait before switching node status from AWAITING_RECOVERY to ONLINE. 0 = disabled
# If auto_set_online is > 0, flapping hosts will automatically be set to ONLINE after flap_duration seconds.
# 是否设置自动上线.
# 如果该值大于0,抖动的主机在抖动的时间范围过后,则设置自动上线.
# 参考mysql-mmm的6种状态转换.
mode active
# Default mode of monitor
# 设置monitor的模式,有主动,被动,等待.
wait_for_other_master 120
# How many seconds to wait for other master to become ONLINE before switching from mode WAIT to mode ACTIVE. 0 = infinite
# 在monitor从等待模式变成主动模式后,等待120秒设置为online. 0 = 无穷
monitor_user mmm_monitor
monitor_password XXX
check_period 5
# Perform check every 5 seconds
# 每5秒执行一次检查
trap_period 10
# Check is considered as failed if it doesn't succeed for at least trap_period seconds
# 如果超过10秒还检查不成功,就被认为是失败的.通常日志就报告error错误
timeout 2
# Check times out after timeout seconds
# 2秒不返回结果,则认为是超时
restart_after 10000
# Restart checker process after restart_after checks
# 在检查1万次之后,重启检查进程
max_backlog 86400
# Maximum backlog for check rep_backlog
# 设置最大的复制延迟时间,设置为86400,目的是不让mmm因为复制延迟而更换vip.
# nagios中已有监控复制延迟的插件
debug 0
# debug模式,0为关闭,1为打开
mmm_mon_log.conf
注:MMM 2.1以上的版本,增加了日志控制文件和邮件报警
#log4perl.logger = FATAL, MMMLog, MailFatal
# MailFatal为邮件报警的模块,FATAL定义了记录日志的级别
log4perl.logger = FATAL, MMMLog
log4perl.appender.MMMLog = Log::Log4perl::Appender::File
log4perl.appender.MMMLog.Threshold = INFO
log4perl.appender.MMMLog.filename = /var/log/mysql-mmm/mmm_mond.log
log4perl.appender.MMMLog.recreate = 1
log4perl.appender.MMMLog.layout = PatternLayout
log4perl.appender.MMMLog.layout.ConversionPattern = %d %5p %m%n
#log4perl.appender.MailFatal = Log::Dispatch::Email::MailSender
#log4perl.appender.MailFatal.Threshold = FATAL
#log4perl.appender.MailFatal.from = mmm@example.com
# 指定发件人
#log4perl.appender.MailFatal.to = root,ning_lianjie@163.com
# 指定收件人
#log4perl.appender.MailFatal.buffered = 0
# 0为立即发送
#log4perl.appender.MailFatal.subject = FATAL error in mysql-mmm-monitor
# 定义邮件主题
#log4perl.appender.MailFatal.layout = PatternLayout
#log4perl.appender.MailFatal.layout.ConversionPattern = %d %m%n