mysql配置mha高可用防火墙未关闭报错

Posted 王晓冬

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql配置mha高可用防火墙未关闭报错相关的知识,希望对你有一定的参考价值。

##########################################################################

l  问题背景:检查主从复制之后做高可用报错

[[email protected] oldboy]# masterha_check_repl --conf=/etc/mha/app1.cnf

Thu May  4 21:52:24 2017 - [info] GTID (with auto-pos) is supported. Skipping all SSH and Node package checking.

Thu May  4 21:52:24 2017 - [error][/usr/share/perl5/vendor_perl/MHA/ServerManager.pm, ln492]  Server 10.0.0.52(10.0.0.3306) is dead, but must be alive! Check server settings.

Thu May  4 21:52:24 2017 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln424] Error happened on checkinonfigurations.  at /usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm line 399

Thu May  4 21:52:24 2017 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln523] Error happened on monitor servers.

Thu May  4 21:52:24 2017 - [info] Got exit code 1 (Not master dead).

 

mysql Replication Health is NOT OK!

########################################################################### 

l  解决思路:

查看部署过程有没有操作失误

根据提示Server 10.0.0.52(10.0.0.3306) is dead, but must be alive! Check server settings.判断10.0.0.52服务器连接问题

l  查看日志:

[[email protected] mha]# tail -f /var/log/mha/app1/manager

Thu May  4 17:46:00 2017 - [info] Current Alive Master: 10.0.0.51(10.0.0.51:3306)

Thu May  4 17:46:00 2017 - [info] Checking slave configurations..

Thu May  4 17:46:00 2017 - [info] Checking replication filtering settings..

Thu May  4 17:46:00 2017 - [info]  binlog_do_db= , binlog_ignore_db=

Thu May  4 17:46:00 2017 - [info]  Replication filtering check ok.

Thu May  4 17:46:00 2017 - [info] GTID (with auto-pos) is supported. Skipping all SSH and Node package checking.

Thu May  4 17:46:00 2017 - [error][/usr/share/perl5/vendor_perl/MHA/ServerManager.pm, ln492]  Server 10.0.0.52(10.0.0.3306) is dead, but must be alive! Check server settings.

Thu May  4 17:46:00 2017 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln424] Error happened on checkinonfigurations.  at /usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm line 399

Thu May  4 17:46:00 2017 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln523] Error happened on monitor servers.

Thu May  4 17:46:00 2017 - [info] Got exit code 1 (Not master dead).

############################################################################l 

 

 ############################################################################

l  解决方法:

关闭10.0.0.52防火墙

[[email protected] MHA]# /etc/init.d/iptables stop

iptables: Setting chains to policy ACCEPT: filter          [  OK  ]

iptables: Flushing firewall rules:                         [  OK  ]

iptables: Unloading modules:                               [  OK  ]

测试结果:

Thu May  4 21:52:55 2017 - [info] Checking replication health on 10.0.0.52..

Thu May  4 21:52:55 2017 - [info]  ok.

Thu May  4 21:52:55 2017 - [info] Checking replication health on 10.0.0.53..

Thu May  4 21:52:55 2017 - [info]  ok.

Thu May  4 21:52:55 2017 - [warning] master_ip_failover_script is not defined.

Thu May  4 21:52:55 2017 - [warning] shutdown_script is not defined.

Thu May  4 21:52:55 2017 - [info] Got exit code 0 (Not master dead).

 [[email protected] oldboy]# masterha_check_repl --conf=/etc/mha/app1.cnf

MySQL Replication Health is OK.

[[email protected] oldboy]#

########################经验小结###############################

排除故障:

  原因一:防火墙iptables

  原因二:selinux Disabled

  原因三:软连接

          ln -s /application/mysql/bin/mysqlbinlog /usr/bin/mysqlbinlog

          ln -s /application/mysql/bin/mysql /usr/bin/mysql

######################################################################

以上是关于mysql配置mha高可用防火墙未关闭报错的主要内容,如果未能解决你的问题,请参考以下文章

Linux12 -MYSQL数据库 -->14MHA高可用

keepalived+MHA实现mysql主从高可用集群

MySQL 高可用之MHA

(项目六)Mha-Atlas-MySQL高可用方案实践

使用MHA对mysql主从架构中的主节点做高可用

MHA MySQL 高可用集群搭建