MySQL 8.0 部署MHA报错:There is no alive server. We can't do failover

环境:基于MySQL 8.0安装部署MHA集群

  • 在检查主从时报错:
[root@mysql-105 mha]# masterha_check_repl --conf=/etc/mha/mysql-mha.conf
Tue Feb  4 22:14:13 2020 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Tue Feb  4 22:14:13 2020 - [info] Reading application default configuration from /etc/mha/mysql-mha.conf..
Tue Feb  4 22:14:13 2020 - [info] Reading server configuration from /etc/mha/mysql-mha.conf..
Tue Feb  4 22:14:13 2020 - [info] MHA::MasterMonitor version 0.57.
Tue Feb  4 22:14:14 2020 - [error][/usr/share/perl5/vendor_perl/MHA/ServerManager.pm, ln188] There is no alive server. We can't do failover
Tue Feb  4 22:14:14 2020 - [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 329.
Tue Feb  4 22:14:14 2020 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln525] Error happened on monitoring servers.
Tue Feb  4 22:14:14 2020 - [info] Got exit code 1 (Not master dead).

MySQL Replication Health is NOT OK!
  • 错误原因:MySQL数据使用的不是默认端口号。
  • 解决办法:

在 /etc/mha/mysql-mha.conf 配置文件中添加端口号:port=3308
MySQL 8.0 部署MHA报错:There is no alive server. We can't do failover_第1张图片

  • 重新验证
[root@mysql-105 mha]# masterha_check_repl --conf=/etc/mha/mysql-mha.conf
Tue Feb  4 22:42:22 2020 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Tue Feb  4 22:42:22 2020 - [info] Reading application default configuration from /etc/mha/mysql-mha.conf..
Tue Feb  4 22:42:22 2020 - [info] Reading server configuration from /etc/mha/mysql-mha.conf..
Tue Feb  4 22:42:22 2020 - [info] MHA::MasterMonitor version 0.57.
Tue Feb  4 22:42:24 2020 - [info] GTID failover mode = 1
Tue Feb  4 22:42:24 2020 - [info] Dead Servers:
Tue Feb  4 22:42:24 2020 - [info] Alive Servers:
Tue Feb  4 22:42:24 2020 - [info]   192.168.56.101(192.168.56.101:3308)
Tue Feb  4 22:42:24 2020 - [info]   192.168.56.103(192.168.56.103:3308)
Tue Feb  4 22:42:24 2020 - [info]   192.168.56.105(192.168.56.105:3308)
Tue Feb  4 22:42:24 2020 - [info] Alive Slaves:
Tue Feb  4 22:42:24 2020 - [info]   192.168.56.103(192.168.56.103:3308)  Version=8.0.11 (oldest major version between slaves) log-bin:enabled
Tue Feb  4 22:42:24 2020 - [info]     GTID ON
Tue Feb  4 22:42:24 2020 - [info]     Replicating from 192.168.56.101(192.168.56.101:3308)
Tue Feb  4 22:42:24 2020 - [info]     Primary candidate for the new Master (candidate_master is set)
Tue Feb  4 22:42:24 2020 - [info]   192.168.56.105(192.168.56.105:3308)  Version=8.0.11 (oldest major version between slaves) log-bin:enabled
Tue Feb  4 22:42:24 2020 - [info]     GTID ON
Tue Feb  4 22:42:24 2020 - [info]     Replicating from 192.168.56.101(192.168.56.101:3308)
Tue Feb  4 22:42:24 2020 - [info]     Not candidate for the new Master (no_master is set)
Tue Feb  4 22:42:24 2020 - [info] Current Alive Master: 192.168.56.101(192.168.56.101:3308)
Tue Feb  4 22:42:24 2020 - [info] Checking slave configurations..
Tue Feb  4 22:42:24 2020 - [info]  read_only=1 is not set on slave 192.168.56.103(192.168.56.103:3308).
Tue Feb  4 22:42:24 2020 - [info]  read_only=1 is not set on slave 192.168.56.105(192.168.56.105:3308).
Tue Feb  4 22:42:24 2020 - [info] Checking replication filtering settings..
Tue Feb  4 22:42:24 2020 - [info]  binlog_do_db= , binlog_ignore_db= 
Tue Feb  4 22:42:24 2020 - [info]  Replication filtering check ok.
Tue Feb  4 22:42:24 2020 - [info] GTID (with auto-pos) is supported. Skipping all SSH and Node package checking.
Tue Feb  4 22:42:24 2020 - [info] Checking SSH publickey authentication settings on the current master..
Tue Feb  4 22:42:25 2020 - [info] HealthCheck: SSH to 192.168.56.101 is reachable.
Tue Feb  4 22:42:25 2020 - [info] 
192.168.56.101(192.168.56.101:3308) (current master)
 +--192.168.56.103(192.168.56.103:3308)
 +--192.168.56.105(192.168.56.105:3308)

Tue Feb  4 22:42:25 2020 - [info] Checking replication health on 192.168.56.103..
Tue Feb  4 22:42:25 2020 - [info]  ok.
Tue Feb  4 22:42:25 2020 - [info] Checking replication health on 192.168.56.105..
Tue Feb  4 22:42:25 2020 - [info]  ok.
Tue Feb  4 22:42:25 2020 - [info] Checking master_ip_failover_script status:
Tue Feb  4 22:42:25 2020 - [info]   /usr/bin/master_ip_failover --command=status --ssh_user=root --orig_master_host=192.168.56.101 --orig_master_ip=192.168.56.101 --orig_master_port=3308 


IN SCRIPT TEST====root|/sbin/ifconfig enp0s3:1 down==root|/sbin/ifconfig enp0s3:1 192.168.56.110/24===

Checking the Status of the script.. OK 
Tue Feb  4 22:42:25 2020 - [info]  OK.
Tue Feb  4 22:42:25 2020 - [warning] shutdown_script is not defined.
Tue Feb  4 22:42:25 2020 - [info] Got exit code 0 (Not master dead).

MySQL Replication Health is OK.

你可能感兴趣的:(MySQL,MHA)