您的位置:首页 > 博客中心 > 数据库 >

mysql-mmm 搭建过程

时间:2022-03-13 23:44

将自己日常学习工作过程中的问题及心得记录下来

active_master_role writer 

<host default> 
cluster_interface eth1 
pid_path /var/run/mysql-mmm/mmm_agentd.pid 
bin_path /usr/libexec/mysql-mmm/ 
mysql_port 3351 
replication_user replicant 
replication_password slave 
agent_user mmm_agent 
agent_password agent_password 
</host> 

<host db1> 
ip 111.10.10.10 
mode master 
peer db2 
</host> 

<host db2> 
ip 111.10.10.40 
mode master 
peer db1 
</host> 


<role writer> 
hosts db1, db2 
ips 111.10.10.13 
mode exclusive 
</role> 

<role reader> 
hosts db1, db2 
ips 111.10.10.11,111.10.10.12 
mode balanced 
</role>

数据库服务器server1,server2 修改

/etc/mysql-mmm/mmm_agent.conf

[ mysql-mmm]# cat 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     --根据实际情况指定

监控服务器server3 上 修改

[ mysql-mmm]# cat 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 111.10.10.10,111.10.10.40 
auto_set_online 60 

# 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 monitor_password 
</host> 

debug 0

Starting MMM Agent Daemon: [ OK ]

server3 启动 

/etc/init.d/mysql-mmm-monitor start

db2 ping [last change: 2014/09/12 04:35:58] OK 
db2 mysql [last change: 2014/09/12 04:35:58] ERROR: Connect error (host = 111.10.10.40:3306, user = mmm_monitor)! Lost connection to MySQL server at ‘reading initial communication packet‘, system error: 111 
db2 rep_threads [last change: 2014/09/12 04:35:58] UNKNOWN: Connect error (host = 111.10.10.40:3306, user = mmm_monitor)! Lost connection to MySQL server at ‘reading initial communication packet‘, system error: 111 
db2 rep_backlog [last change: 2014/09/12 04:35:58] UNKNOWN: Connect error (host = 111.10.10.40:3306, user = mmm_monitor)! Lost connection to MySQL server at ‘reading initial communication packet‘, system error: 111 
db1 ping [last change: 2014/09/12 04:35:58] OK 
db1 mysql [last change: 2014/09/12 04:35:58] ERROR: Connect error (host = 111.10.10.10:3306, user = mmm_monitor)! Lost connection to MySQL server at ‘reading initial communication packet‘, system error: 111 
db1 rep_threads [last change: 2014/09/12 04:35:58] UNKNOWN: Connect error (host = 111.10.10.10:3306, user = mmm_monitor)! Lost connection to MySQL server at ‘reading initial communication packet‘, system error: 111 
db1 rep_backlog [last change: 2014/09/12 04:35:58] UNKNOWN: Connect error (host = 111.10.10.10:3306, user = mmm_monitor)! Lost connection to MySQL server at ‘reading initial communication packet‘, system error: 111 

原因分析:   端口配置错误。

解决办法:  修改 /etc/mysql-mmm  下 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/ 
mysql_port 3351      --指定正确端口号
replication_user replication 
replication_password slave 
agent_user mmm_agent 
agent_password agent_password 
</host>

错误2

[ mysql-mmm]# mmm_control checks 
db2 ping [last change: 2014/09/12 07:37:36] OK 
db2 mysql [last change: 2014/09/12 07:37:36] ERROR: Connect error (host = 111.10.10.40:3351, user = mmm_monitor)! Access denied for user ‘mmm_monitor‘@‘111.10.10.20‘ (using password: YES) 
db2 rep_threads [last change: 2014/09/12 07:37:36] UNKNOWN: Connect error (host = 111.10.10.40:3351, user = mmm_monitor)! Access denied for user ‘mmm_monitor‘@‘111.10.10.20‘ (using password: YES) 
db2 rep_backlog [last change: 2014/09/12 07:37:36] UNKNOWN: Connect error (host = 111.10.10.40:3351, user = mmm_monitor)! Access denied for user ‘mmm_monitor‘@‘111.10.10.20‘ (using password: YES) 
db1 ping [last change: 2014/09/12 07:37:36] OK 
db1 mysql [last change: 2014/09/12 07:37:36] ERROR: Connect error (host = 111.10.10.10:3351, user = mmm_monitor)! Access denied for user ‘mmm_monitor‘@‘111.10.10.20‘ (using password: YES) 
db1 rep_threads [last change: 2014/09/12 07:37:36] UNKNOWN: Connect error (host = 111.10.10.10:3351, user = mmm_monitor)! Access denied for user ‘mmm_monitor‘@‘111.10.10.20‘ (using password: YES) 
db1 rep_backlog [last change: 2014/09/12 07:37:36] UNKNOWN: Connect error (host = 111.10.10.10:3351, user = mmm_monitor)! Access denied for user ‘mmm_monitor‘@‘111.10.10.20‘ (using password: YES)

问题原因:  密码错误,经验证 数据库密码无问题

解决办法:  

 mysql-mmm]# pwd 
/etc/mysql-mmm 
[ mysql-mmm]# cat 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 111.10.10.10,111.10.10.40 
auto_set_online 60 

# 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 monitor_password     --修改密码后问题解决
</host> 

debug 0

*******************************************************************************************

Tieger    2014/9/12




本文出自 “” 博客,请务必保留此出处

热门排行

今日推荐

热门手游