mysql MHA脚本masterha_master_switch手动操作常见错误

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010719917/article/details/80419067
Mon May 21 16:56:06 2018 - [error][/usr/local/share/perl5/MHA/MasterFailover.pm, ln1261] Failed to activate master IP address for centos129 with return code 10:0
解决办法:

[warning] Got timeout on MySQL Ping child process and killed it! at /usr/local/share/perl5/MHA/HealthCheck.pm line 385
解决办法:

Can't exec "mysqlbinlog": 没有那个文件或目录 at /usr/local/share/perl5/MHA/BinlogManager.pm line 99.
解决办法:
在node节点上执行 which mysqlbinlog,比如我的结果就是
   [localhost~]$ which mysqlbinlog
   /usr/local/mysql/bin/mysqlbinlog
   需要做一个软连接
   ln -s /data/mysql/bin/mysqlbinlog   /usr/bin/mysqlbinlog
(shiyan:ln -s /data/mysql/bin/mysqlbinlog /usr/bin/mysqlbinlog)

Tue May 22 13:45:25 2018 - [error][/usr/local/share/perl5/MHA/MasterRotate.pm, ln142] Getting advisory lock failed on the current master. MHA Monitor runs on the current master. Stop MHA Manager/Monitor and try again.
Tue May 22 13:45:25 2018 - [error][/usr/local/share/perl5/MHA/ManagerUtil.pm, ln178] Got ERROR: at /usr/local/bin/masterha_master_switch line 53.
解决办法:
masterha_stop --conf=/etc/masterha/app1.cnf


Wed May 23 10:42:48 2018 - [error][/usr/local/share/perl5/MHA/MasterRotate.pm, ln161] We should not start online master switch when one of connections are running long updates on the current master(centos128(192.168.44.128:3306)). Currently 1 update thread(s) are running.
Details:
{'Time' => '4304','db' => undef,'Id' => '1','User' => 'event_scheduler','State' => 'Waiting on empty queue','Command' => 'Daemon','Info' => undef,'Host' => 'localhost'}
Wed May 23 10:42:48 2018 - [error][/usr/local/share/perl5/MHA/ManagerUtil.pm, ln178] Got ERROR: at /usr/local/bin/masterha_master_switch line 53.
解决方法:
关掉event_schedule即可:
(product)[email protected] [(none)]> SET GLOBAL event_scheduler =off;
Query OK, 0 rows affected (0.00 sec)
(product)[email protected] [(none)]> Select @@event_scheduler;


Wed May 23 10:53:48 2018 - [error][/usr/local/share/perl5/MHA/ServerManager.pm, ln1145] 192.168.44.129 is not alive!
Wed May 23 10:53:48 2018 - [error][/usr/local/share/perl5/MHA/MasterRotate.pm, ln232] Failed to get new master!
Wed May 23 10:53:48 2018 - [error][/usr/local/share/perl5/MHA/ManagerUtil.pm, ln178] Got ERROR: at /usr/local/bin/masterha_master_switch line 53.
解决办法:
解决方法1:
因为10.16.24.109的/etc/masterha/app1.cnf 中的no_master=1限制了它成为新master的可能,标识掉no_master=1后,重新在线切换成功。
解决方案2:
      直接将IP地址替换为主机名后问题解决,不再演示。
       按官方文档描述,参数--dead_master_host=(hostname),而不是可以用IP地址。
       If these parameters are not set, --dead_master_ip will be the result of gethostbyname(dead_master_host), and --dead_master_port will be 3306.
       补充: 如果配置文件里hostname=IP地址,则在切换的时候使用IP地址也是可行的



再次报错“Got Error: Undefined subroutine &main::FIXME_xxx_drop_app_user called at /usr/local/bin/master_ip_online_change line 152”
解决办法:
这是由于无法找到对FIXME_xxx_drop_app_user定义,由于perl不熟,我暂时注释掉相关drop user的行或FIXME_xxx等,不会影响其他过程。
其中需要注释掉的语句为:
FIXME_xxx_drop_app_user($orig_master_handler);
FIXME_xxx_create_app_user($new_master_handler);
再次执行:


Wed May 23 11:05:54 2018 577112 Set read_only on the new master.. ok.
Wed May 23 11:05:54 2018 578994 Drpping app user on the orig master..
Got Error: Undefined subroutine &main::FIXME_xxx_drop_app_user called at /usr/local/bin/master_ip_online_change line 148.
Wed May 23 11:05:54 2018 - [error][/usr/local/share/perl5/MHA/ManagerUtil.pm, ln178] Got ERROR: at /usr/local/bin/masterha_master_switch line 53.
解决办法:
在master_ip_online_change 中其中需要注释掉的语句为:
FIXME_xxx_drop_app_user($orig_master_handler);
FIXME_xxx_create_app_user($new_master_handler);

Wed May 23 13:57:55 2018 - [error][/usr/local/share/perl5/MHA/MasterRotate.pm, ln142] Getting advisory lock failed on the current master. MHA Monitor runs on the current master. Stop MHA Manager/Monitor and try again.
Wed May 23 13:57:55 2018 - [error][/usr/local/share/perl5/MHA/ManagerUtil.pm, ln178] Got ERROR: at /usr/local/bin/masterha_master_switch line 53.
解决办法:
将MHA停掉再进行测试
masterha_stop --conf=/etc/masterha/app1.cnf





猜你喜欢

转载自blog.csdn.net/u010719917/article/details/80419067