1,线上在用的my.cnf配置文件的[client]段有配置default-character-set=utf8。在用masterha_check_repl --conf=/etc/masterha_default.cnf检测 复制状态的时候会报错:

Wed Jan 20 03:03:43 2016 - [info]   Connecting to emma@192.168.6.85(192.168.6.85:22).. 

mysqlbinlog: unknown variable 'default-character-set=utf8'

mysqlbinlog version command failed with rc 7:0, please verify PATH, LD_LIBRARY_PATH, and client options

 at /usr/bin/apply_diff_relay_logs line 493

解决方法:

    因为mysqlbinlog工具查看二进制日志时会重新读取的mysql的配置文件my.cnf,而不是服务器已经加载进内存的配置文件,所以可以把my.cnf的default-character-set=utf8这个参数注释掉,但是可以不重启,这样既不会对线上业务有影响,也可以避免复制状态检测报错。


2,如果root用户不允许做ssh免密码登陆,用非root用户部署mha的时候要把这个用户加入到mysql组,让其有操作binlog和relaylog的权限。


3,MHA在执行master_check_repl会调用/usr/bin/mysqlbinlog,对于源码安装在不同的路径的mysql高版本则收到如下错误提示:

 mysqlbinlog version is 3.2 (included in MySQL Client 5.0 or lower). This is not recommended. Consider upgrading MySQL Client to 5.1 or higher.

mysqlbinlog is 3.2 (included in MySQL Client 5.0 or lower), but MySQL server version is 5.5.33-log. mysqlbinlog can not parse row based events. Terminating script for safety reasons.

解决方法:

重新创建软链接:

mv /usr/bin/mysqlbinlog /usr/bin/mysqlbinlog.bak

ln -sv /usr/local/ver01/percona/bin/mysqlbinlog /usr/bin/mysqlbinlog

也可以卸载系统当前的mysql rpm包


4,MHA在完成一次故障切换后会退出,需要手动再次开启。


5,在线切换时的报错:

Thu Jan 21 17:50:28 2016 - [error][/usr/lib/perl5/site_perl/5.8.8/MHA/MasterRotate.pm, ln612] We should not start online master switch when one of connections are running long updates on the current master(192.168.6.85(192.168.6.85:3306)). Currently 1 update thread(s) are running.

Details:

{'Time' => '11277','db' => undef,'Id' => '1','User' => 'event_scheduler','State' => 'Waiting on empty queue','Rows_read' => '0','Command' => 'Daemon','Rows_examined' => '0','Info' => undef,'Host' => 'localhost','Rows_sent' => '0'}

Thu Jan 21 17:50:28 2016 - [error][/usr/lib/perl5/site_perl/5.8.8/MHA/MasterRotate.pm, ln652] Got ERROR:  at /usr/bin/masterha_master_switch line 53

这是由于当前主库上开启了event_scheduler导致,我们可以临时关闭下event_scheduler通过set global event_scheduler=0;待迁移完成后再开启。