安装环境:centos 6.5 mysql 5.7.22 mha 0.56
1、找不到mysql 命令
sat mar 23 07:17:50 2019 - [info] connecting to root@192.168.32.181(server2:22)..
checking slave recovery environment settings..
opening /data/mysql/relay-log.info ... ok.
relay log found at /data/mysql, up to server2-relay-bin.000005
temporary relay log file is /data/mysql/server2-relay-bin.000005
testing mysql connection and privileges..sh: mysql: command not found
mysql command failed with rc 127:0!
解决办法:找到mysql 的安装目录,创建适当的软链接
ln -s /usr/local/mysql/bin/mysqlbinlog /usr/local/bin/mysqlbinlog
ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
2、脚本文件没有执行权限
sat mar 23 07:25:46 2019 - [error][/usr/share/perl5/vendor_perl/mha/mastermonitor.pm, ln424] error happened on checking configurations. can't exec "/usr/local/bin/master_ip_failover": permission denied at /usr/share/perl5/vendor_perl/mha/managerutil.pm line 68.
sat mar 23 07:25:46 2019 - [error][/usr/share/perl5/vendor_perl/mha/mastermonitor.pm, ln523] error happened on monitoring servers.
sat mar 23 07:25:46 2019 - [info] got exit code 1 (not master dead).
mysql replication health is not ok!
解决办法:赋权
chmod +x /usr/local/bin/master_ip_failover
3、master_ip_failover脚本错误
sat mar 23 07:27:44 2019 - [info] checking master_ip_failover_script status:
sat mar 23 07:27:44 2019 - [info] /usr/local/bin/master_ip_failover --command=status --ssh_user=root --orig_master_host=server1 --orig_master_ip=192.168.32.180 --orig_master_port=3306
/usr/local/bin/master_ip_failover: line 4: use: command not found
/usr/local/bin/master_ip_failover: line 6: use: command not found
/usr/local/bin/master_ip_failover: line 10: use: command not found
/usr/local/bin/master_ip_failover: line 14: syntax error near unexpected token `newline'
/usr/local/bin/master_ip_failover: line 14: `my ( '
sat mar 23 07:27:44 2019 - [error][/usr/share/perl5/vendor_perl/mha/mastermonitor.pm, ln226] failed to get master_ip_failover_script status with return code 2:0.
sat mar 23 07:27:44 2019 - [error][/usr/share/perl5/vendor_perl/mha/mastermonitor.pm, ln424] error happened on checking configurations. at /usr/bin/masterha_check_repl line 48
sat mar 23 07:27:44 2019 - [error][/usr/share/perl5/vendor_perl/mha/mastermonitor.pm, ln523] error happened on monitoring servers.
sat mar 23 07:27:44 2019 - [info] got exit code 1 (not master dead).
解决办法:#!/usr/bin/env perl要最顶行
如对本文有疑问, 点击进行留言回复!!
服务器Centos部署MySql并连接Navicat过程详解
网友评论