注:一定要注意本机也要添加自己的秘钥,不然会报错。
2. 验证mysql主从复制
masterha_check_repl --conf=/etc/masterha/masterha_default.cnf 报错1:
Thu Jun 15 1:20:37 2017 - [error][/usr/local/perl5/vender_perl/MHA/ServerManger.pm, ln255] Got MySQL error when connecting 10.10.0.25(10.10.0.25:3306):1045:Access denied for user 'hk_mhaap'@'DB-01' (using password:YES),but this is not mysql crash. Check MySQL server setings.
at /usr/share/perl5/vender_perl/MHA/ServerManger.pm line 251
Thu Jun 15 1:20:37 2017 - [error][/usr/share/perl5/vender_perl/MHA/ServerManger.pm, ln263] Got fatal error, stopping operations
Thu Jun 15 1:20:37 2017 - [error][/usr/share/perl5/vender_perl/MHA/ServerManger.pm, ln386] Error happend on checking configurations.
at /usr/share/perl5/vender_perl/MHA/ServerManger.pm line 300
Thu Jun 15 1:20:37 2017 - [error][/usr/share/perl5/vender_perl/MHA/ServerManger.pm, ln482] Error happened on monitoring servers.
Thu Jun 15 1:20:37 2017 - [info] Got exit code 1 (Not master dead).
MySQL Replication health is NOT OK!
=====原因:mysql的用户表里存在user为空的权限设置(上述提到过):
mysql>delete from mysql.user where user='';
mysql>flush privileges; 报错2:
Can't exec "mysqlbinlog": No such file or directory at /usr/share/perl5/vender_perl/MHA/ServerManger.pm line 99.
mysqlbinlog version not found!
at /usr/bin/apply_diff_relay_logs line 482
Thu Jun 15 1:20:37 2017 - [error][/usr/share/perl5/vender_perl/MHA/ServerManger.pm, ln195] Slaves settings check failed!
Thu Jun 15 1:20:37 2017 - [error][/usr/share/perl5/vender_perl/MHA/ServerManger.pm, ln375] Slave configuration failed.
Thu Jun 15 1:20:37 2017 - [error][/usr/share/perl5/vender_perl/MHA/ServerManger.pm, ln386] Error happened on check configurations. at /usr/bin/masterha_check_repl line 48
Thu Jun 15 1:20:37 2017 - [error][/usr/share/perl5/vender_perl/MHA/ServerManger.pm, ln482] Error happened on monitoring servers.
Thu Jun 15 1:20:37 2017 - [info] Got exit code 1 (Not master dead).
MySQL Replication health is NOT OK!
====原因:没找到mysqlbinlog命令,这里设置环境变量并不管用,需要做软链接:
ln -s /usr/local/mysql/bin/mysqlbinlog /usr/bin/mysqlbinlog 测试成功: