请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

ssh免登录检测和复制环境检测显示已通过,但是启动报错?

[root@bogon ~]# masterha_manager --conf=/etc/mha/mysql_mha.cnf
Sun May 17 18:15:00 2020 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Sun May 17 18:15:00 2020 - [info] Reading application default configuration from /etc/mha/mysql_mha.cnf…
Sun May 17 18:15:00 2020 - [info] Reading server configuration from /etc/mha/mysql_mha.cnf…

IN SCRIPT TESTroot|sudo /sbin/ifconfig ens33:1 downroot|sudo /sbin/ifconfig ens33:1 192.168.118.90/24=

Use of uninitialized value $command in string eq at /usr/bin/master_ip_failover line 42.

报错但是我的虚拟IP设置了啊。
ifconfig ens33:1 192.168.118.90/24
ens33:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.118.90 netmask 255.255.255.0 broadcast 192.168.118.255
ether 00:0c:29:9f:39:e7 txqueuelen 1000 (Ethernet)

这是复制环境检测的内容:

[root@bogon ~]# sudo masterha_check_repl --conf=/etc/mha/mysql_mha.cnf
Sun May 17 20:03:27 2020 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Sun May 17 20:03:27 2020 - [info] Reading application default configuration from /etc/mha/mysql_mha.cnf…
Sun May 17 20:03:27 2020 - [info] Reading server configuration from /etc/mha/mysql_mha.cnf…
Sun May 17 20:03:27 2020 - [info] MHA::MasterMonitor version 0.57.
Sun May 17 20:03:28 2020 - [info] GTID failover mode = 1
Sun May 17 20:03:28 2020 - [info] Dead Servers:
Sun May 17 20:03:28 2020 - [info] Alive Servers:
Sun May 17 20:03:28 2020 - [info] 192.168.118.139(192.168.118.139:3306)
Sun May 17 20:03:28 2020 - [info] 192.168.118.141(192.168.118.141:3306)
Sun May 17 20:03:28 2020 - [info] 192.168.118.140(192.168.118.140:3306)
Sun May 17 20:03:28 2020 - [info] Alive Slaves:
Sun May 17 20:03:28 2020 - [info] 192.168.118.141(192.168.118.141:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled
Sun May 17 20:03:28 2020 - [info] GTID ON
Sun May 17 20:03:28 2020 - [info] Replicating from 192.168.118.139(192.168.118.139:3306)
Sun May 17 20:03:28 2020 - [info] Primary candidate for the new Master (candidate_master is set)
Sun May 17 20:03:28 2020 - [info] 192.168.118.140(192.168.118.140:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled
Sun May 17 20:03:28 2020 - [info] GTID ON
Sun May 17 20:03:28 2020 - [info] Replicating from 192.168.118.139(192.168.118.139:3306)
Sun May 17 20:03:28 2020 - [info] Not candidate for the new Master (no_master is set)
Sun May 17 20:03:28 2020 - [info] Current Alive Master: 192.168.118.139(192.168.118.139:3306)
Sun May 17 20:03:28 2020 - [info] Checking slave configurations…
Sun May 17 20:03:28 2020 - [info] Checking replication filtering settings…
Sun May 17 20:03:28 2020 - [info] binlog_do_db= , binlog_ignore_db=
Sun May 17 20:03:28 2020 - [info] Replication filtering check ok.
Sun May 17 20:03:28 2020 - [info] GTID (with auto-pos) is supported. Skipping all SSH and Node package checking.
Sun May 17 20:03:28 2020 - [info] Checking SSH publickey authentication settings on the current master…
Sun May 17 20:03:33 2020 - [warning] HealthCheck: Got timeout on checking SSH connection to 192.168.118.139! at /usr/share/perl5/vendor_perl/MHA/HealthCheck.pm line 342.
Sun May 17 20:03:33 2020 - [info]
192.168.118.139(192.168.118.139:3306) (current master)
±-192.168.118.141(192.168.118.141:3306)
±-192.168.118.140(192.168.118.140:3306)

Sun May 17 20:03:33 2020 - [info] Checking replication health on 192.168.118.141…
Sun May 17 20:03:33 2020 - [info] ok.
Sun May 17 20:03:33 2020 - [info] Checking replication health on 192.168.118.140…
Sun May 17 20:03:33 2020 - [info] ok.
Sun May 17 20:03:33 2020 - [info] Checking master_ip_failover_script status:
Sun May 17 20:03:33 2020 - [info] /usr/bin/master_ip_failover #可选 --command=status --ssh_user=root --orig_master_host=192.168.118.139 --orig_master_ip=192.168.118.139 --orig_master_port=3306

IN SCRIPT TESTroot|sudo /sbin/ifconfig ens33:1 downroot|sudo /sbin/ifconfig ens33:1 192.168.118.90/24=

Checking the Status of the script… OK
Sun May 17 20:03:34 2020 - [info] OK.
Sun May 17 20:03:34 2020 - [warning] shutdown_script is not defined.
Sun May 17 20:03:34 2020 - [info] Got exit code 0 (Not master dead).

MySQL Replication Health is OK.

正在回答

2回答

master_ip_failover 这个脚本报错了,提供一下这个脚本的内容吧。

0 回复 有任何疑惑可以回复我~
  • 提问者 雪兔儿 #1
    my $vip = '192.168.118.90/24';
    my $key = '1';
    my $ssh_start_vip = "sudo /sbin/ifconfig ens33:$key $vip";
    my $ssh_stop_vip = "sudo /sbin/ifconfig ens33:$key down";
    my $ssh_Bcast_arp= "sudo /sbin/arping -I bond0 -c 3 -A #vip#";
    
    就是您的那个PERL脚本。就改了这里。
    回复 有任何疑惑可以回复我~ 2020-05-17 20:02:21
  • 提问者 雪兔儿 #2
    老师我把复制检查的内容也贴出来了。虽然通过了。但是不知道有没有问题。因为我吧这个可选脚本注释了。结果主宕机也没有故障转义。
    回复 有任何疑惑可以回复我~ 2020-05-17 20:09:27
  • sqlercn 回复 提问者 雪兔儿 #3
    这个脚本就是用来做故障转移的,你把这个脚本注释了当然就无法进行故障转移了,另外你是在什么系统用户下启动的MHA管理进程?建议使用root用户启动,不要加sudo,当然也是要在root用户下进行SSH免认证才成
    回复 有任何疑惑可以回复我~ 2020-05-18 09:57:11
提问者 雪兔儿 2020-05-18 12:36:52

master_ip_failover 这个脚本报错的原因也是因为/etc/mha/mysql_mha.cnf 里是这样写的

master_ip_failover    #可选

程序自动把#可选做为参数所以报错的,后来去掉了就没问题了。


0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信