搭建MMM:
1,安装
agent 节点执行
yum install -y mysql-mmm-agent
2, monitor 节点执行
yum install -y mysql-mmm-monitor
配置文件

1, /etc/init.d/mysql-mmm-agent start
perl: warning: Setting locale failed."的解决
vi /root/.bashrc
再最底部加上
export LC_ALL=C
或者直接运行
echo "export LC_ALL=C" >> /root/.bashrc
然后执行一下:
source /root/.bashrc

2,<host db1>
ip 192.168.60.166
mode master
peer centos_TP166
</host>
启动报错,Starting MMM Monitor Daemon: Config entry 'host->db2->peer'
修改错误 这个<host db1>的db1 改成centos_TP166
3,exec of /usr/libexec/mysql-mmm/monitor/checker reaped child 17439 with exit 65280
需要修改mmm_mon.conf的bin_path
4,配置/usr/sbin/mmm_control show 老是提示
ERROR: Can't connect to monitor daemon!
取消配置文件的 # 中文注释
5,配置好主主复制,和主从复制
6,/etc/init.d/mysql-mmm-monitor restart报错
Starting MMM Monitor Daemon: Can't run second copy of mmm_mond
原来是/etc/rc.d/init.d/mysql-mmm-monitor 的 MMMD_MON_PIDFILE="/var/run/mysql-mmm/mmm_mond_test_mmm.pid"
配置错误
7,MMM 一台mysqldown掉, 会将虚IP漂移到其他的机器,当重启mmm的monitor的监控时,会给其分配虚IP
INFO Moving role 'reader(192.168.60.60)' from host 'centos_TP168'to host 'centos_TP167'
8,mmm_control show 出现:
Warning: agent on host centos_TP167 is not reachable
在167机器上ps -ef|grep mm 出现多个 mmm_agentd, kill掉这些,在启动mmm_agentd就解决
9,执行命令后 mmm_control set_offline centos_TP166 166机器下线
但执行mmm_control show 就ERROR: Can't connect to monitor daemon!
执行mmm_control checks all也出现centos_TP166 rep_threads [last change: 2019/05/15 15:06:48] ERROR: Replication is broken
只有重新执行mmm_control set_online centos_TP166 再 checks才正常

2019年5月9日13:45:59
生产库上一般不建议设置过滤规则, 如果非要设置, 强烈建议从库使用通配符方式过滤某个库

2019年5月14日14:22:10
查mysql未提交事务
查询 正在执行的事务:
SELECT * FROM information_schema.INNODB_TRX

查看正在锁的事务
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;

查看等待锁的事务

SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;

原文:https://blog.csdn.net/emoers/article/details/77971468

2019年5月16日15:12:23
手工 kill -9 mmm进程,查看/etc/init.d/mysql-mmm-monitor status
mmm_mond 已死,但 pid 文件仍存
如果
重启restart,提示 DEBUG Sending command 'GET_AGENT_STATUS()' to 167 (192.168.60.167)
一直不动,
查看167服务器的mysql-mmm-agent,手工kill -9 掉 mmm的进程,重启agent

关闭mysql-mmm-monitor ,要先关闭mysql-mmm-agent,再启动mysql-mmm-monitor


在CentOS 6.3 x86_64下安装php-mcrypt的时候出现了问题:Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again,需要安装epel源。

解决方法: 一句话:把/etc/yum.repos.d/epel.repo,文件第3行注释去掉,把第四行注释掉。具体如下:

打开/etc/yum.repos.d/epel.repo,将

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch

修改为

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch

再清理源,重新安装

yum clean all
yum install -y 需要的包

 

如果还是不行,修改DNS,到/etc/resolv.conf下添加一下:

nameserver 8.8.8.8
search localdomain

然后重启network服务:service network restart

配置文件:

 Monitor机器:   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        sa
    replication_password    cc.123
    agent_user              sa
    agent_password          cc.123
    mysql_port              18602
</host>

<host centos_TP166>
    ip      192.168.60.166
    mode    master
    peer    centos_TP166
</host>

<host centos_TP167>
    ip      192.168.60.167
    mode    master
    peer    centos_TP167 
</host>

<host centos_TP168>
    ip      192.168.60.168
    mode    slave
</host>

<role writer>
    hosts   centos_TP167,centos_TP166 
    ips     192.168.60.40
    mode    exclusive
</role>

<role reader>
    hosts   centos_TP167,centos_TP168
    ips     192.168.60.60, 192.168.60.61
    mode    balanced
</role>

debug 0
View Code

 Monitor机器:   mmm_mon.conf

include mmm_common.conf

<monitor>
    ip               127.0.0.1
    port             9992
    pid_path         /var/run/mysql-mmm/mmm_mond_mmm.pid
    bin_path         /usr/libexec/mysql-mmm
    status_path      /var/lib/mysql-mmm/mmm_mond_test_mmm.status
    ping_ips         192.168.60.166, 192.168.60.167, 192.168.60.168
    auto_set_online  30                                           
</monitor>

<host default>
    monitor_user      sa       
    monitor_password  cc.123  
</host>

<check mysql>
    check_period      2       
    trap_period       4       
    max_backlog       900      
</check>
View Code

相关文章: