搭建mha过程中masterha_check_repl检查报错
学习MySQL高可用架构mha,再搭建过程中,masterha_check_ssh检测正常,结果如下:
[root@localhost ~]# /usr/bin/masterha_check_ssh --conf=/etc/mha/mysql_mha.cnf
Sun May 13 20:56:55 2018 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Sun May 13 20:56:55 2018 - [info] Reading application default configuration from /etc/mha/mysql_mha.cnf..
Sun May 13 20:56:55 2018 - [info] Reading server configuration from /etc/mha/mysql_mha.cnf..
Sun May 13 20:56:55 2018 - [info] Starting SSH connection tests..
Sun May 13 20:56:56 2018 - [debug]
Sun May 13 20:56:55 2018 - [debug] Connecting via SSH from root@192.168.211.133(192.168.211.133:22) to root@192.168.211.166(192.168.211.166:22)..
Sun May 13 20:56:55 2018 - [debug] ok.
Sun May 13 20:56:55 2018 - [debug] Connecting via SSH from root@192.168.211.133(192.168.211.133:22) to root@192.168.211.199(192.168.211.199:22)..
Sun May 13 20:56:56 2018 - [debug] ok.
Sun May 13 20:56:57 2018 - [debug]
Sun May 13 20:56:56 2018 - [debug] Connecting via SSH from root@192.168.211.166(192.168.211.166:22) to root@192.168.211.133(192.168.211.133:22)..
Sun May 13 20:56:56 2018 - [debug] ok.
Sun May 13 20:56:56 2018 - [debug] Connecting via SSH from root@192.168.211.166(192.168.211.166:22) to root@192.168.211.199(192.168.211.199:22)..
Sun May 13 20:56:56 2018 - [debug] ok.
Sun May 13 20:56:58 2018 - [debug]
Sun May 13 20:56:56 2018 - [debug] Connecting via SSH from root@192.168.211.199(192.168.211.199:22) to root@192.168.211.133(192.168.211.133:22)..
Sun May 13 20:56:57 2018 - [debug] ok.
Sun May 13 20:56:57 2018 - [debug] Connecting via SSH from root@192.168.211.199(192.168.211.199:22) to root@192.168.211.166(192.168.211.166:22)..
Sun May 13 20:56:57 2018 - [debug] ok.
Sun May 13 20:56:58 2018 - [info] All SSH connection tests passed successfully.
使用masterha_check_repl检测报错:
[root@localhost ~]# /usr/bin/masterha_check_repl --conf=/etc/mha/mysql_mha.cnf
Sun May 13 20:57:43 2018 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Sun May 13 20:57:43 2018 - [info] Reading application default configuration from /etc/mha/mysql_mha.cnf..
Sun May 13 20:57:43 2018 - [info] Reading server configuration from /etc/mha/mysql_mha.cnf..
Sun May 13 20:57:43 2018 - [info] MHA::MasterMonitor version 0.57.
Sun May 13 20:57:45 2018 - [warning] SQL Thread is stopped(no error) on 192.168.211.133(192.168.211.133:3306)
Sun May 13 20:57:45 2018 - [info] GTID failover mode = 1
Sun May 13 20:57:45 2018 - [info] Dead Servers:
Sun May 13 20:57:45 2018 - [info] Alive Servers:
Sun May 13 20:57:45 2018 - [info] 192.168.211.133(192.168.211.133:3306)
Sun May 13 20:57:45 2018 - [info] 192.168.211.166(192.168.211.166:3306)
Sun May 13 20:57:45 2018 - [info] 192.168.211.199(192.168.211.199:3306)
Sun May 13 20:57:45 2018 - [info] Alive Slaves:
Sun May 13 20:57:45 2018 - [info] 192.168.211.133(192.168.211.133:3306) Version=5.7.20-log (oldest major version between slaves) log-bin:enabled
Sun May 13 20:57:45 2018 - [info] GTID ON
Sun May 13 20:57:45 2018 - [info] Replicating from 192.168.211.133(192.168.211.133:3306)
Sun May 13 20:57:45 2018 - [info] 192.168.211.166(192.168.211.166:3306) Version=5.7.20-log (oldest major version between slaves) log-bin:enabled
Sun May 13 20:57:45 2018 - [info] GTID ON
Sun May 13 20:57:45 2018 - [info] Replicating from 192.168.211.133(192.168.211.133:3306)
Sun May 13 20:57:45 2018 - [info] Primary candidate for the new Master (candidate_master is set)
Sun May 13 20:57:45 2018 - [info] 192.168.211.199(192.168.211.199:3306) Version=5.7.20-log (oldest major version between slaves) log-bin:enabled
Sun May 13 20:57:45 2018 - [info] GTID ON
Sun May 13 20:57:45 2018 - [info] Replicating from 192.168.211.133(192.168.211.133:3306)
Sun May 13 20:57:45 2018 - [info] Current Alive Master: 192.168.211.133(192.168.211.133:3306)
Sun May 13 20:57:45 2018 - [info] Checking slave configurations..
Sun May 13 20:57:45 2018 - [info] read_only=1 is not set on slave 192.168.211.133(192.168.211.133:3306).
Sun May 13 20:57:45 2018 - [info] Checking replication filtering settings..
Sun May 13 20:57:45 2018 - [info] binlog_do_db= , binlog_ignore_db=
Sun May 13 20:57:45 2018 - [info] Replication filtering check ok.
Sun May 13 20:57:45 2018 - [info] GTID (with auto-pos) is supported. Skipping all SSH and Node package checking.
Sun May 13 20:57:45 2018 - [info] Checking SSH publickey authentication settings on the current master..
Sun May 13 20:57:45 2018 - [info] HealthCheck: SSH to 192.168.211.133 is reachable.
Sun May 13 20:57:45 2018 - [info]
192.168.211.133(192.168.211.133:3306) (current master)
+--192.168.211.133(192.168.211.133:3306)
+--192.168.211.166(192.168.211.166:3306)
+--192.168.211.199(192.168.211.199:3306)
Sun May 13 20:57:45 2018 - [info] Checking replication health on 192.168.211.133..
Sun May 13 20:57:45 2018 - [error][/usr/share/perl5/vendor_perl/MHA/Server.pm, ln490] Slave IO thread is not running on 192.168.211.133(192.168.211.133:3306)
Sun May 13 20:57:45 2018 - [error][/usr/share/perl5/vendor_perl/MHA/ServerManager.pm, ln1526] failed!
Sun May 13 20:57:45 2018 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln427] Error happened on checking configurations. at /usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm line 420.
Sun May 13 20:57:45 2018 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln525] Error happened on monitoring servers.
Sun May 13 20:57:45 2018 - [info] Got exit code 1 (Not master dead).
MySQL Replication Health is NOT OK!
其中,mysql_mha.cnf 文件内容如下:
[root@localhost ~]# cat /etc/mha/mysql_mha.cnf
[server default]
user=root
password=root
manager_workdir=/mysql/mysql_mha
manager_log=/mysql/mysql_mha/manager.log
remote_workdir=/mysql/mysql_mha
ssh_user=root
repl_user=repl11
repl_password=repl11
ping_interval=1
master_binlog_dir=/mysql/log/binlog
master_ip_failover_script= /usr/local/bin/master_ip_failover
secondary_check_script=/usr/bin/masterha_secondary_check -s 192.168.211.133 -s 192.168.211.166 -s 192.168.211.199
[server1]
hostname=192.168.211.133
[server2]
hostname=192.168.211.166
candidate_master=1
[server3]
hostname=192.168.211.199
其中133是mysql主节点,166,199是MySQL从节点,100是mha的manager节点
192.168.211.100 monitor
192.168.211.133 master
192.168.211.166 slave1
192.168.211.199 slave2
根据报错信息,是由于mysql上没有Slave IO 线程,但是133是主节点,应该不需要检测Slave IO thread,请大神帮忙指点是不是mha配置文件有问题