MySQL MHA 报错处理
安装环境: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要最顶行
推荐阅读
-
Python中MySQLdb和torndb模块对MySQL的断连问题处理
-
一、mysql数据库,忘记密码怎么处理及处理过程中遇见的问题
-
MySQL保存中文字段时报错的解决办法
-
使用cmd运行mysql数据库的时候,报错:"不是内部命令也不是可有运行的程序"问题的解决办法
-
PHP处理SQL脚本文件导入到MySQL的代码实例
-
mysql执行sql文件报错Error: Unknown storage engine‘InnoDB’的解决方法
-
MySQL源码探索01连接处理和登录验证以及协议类型
-
使用koa-mysql-session时报错
-
mysql的sql语句特殊处理语句总结(必看)
-
mysql从执行.sql文件时处理\n换行的问题