阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

CentOS 6.5下MySQL MHA 报错解决方法

195次阅读
没有评论

共计 2118 个字符,预计需要花费 6 分钟才能阅读完成。

安装环境: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 要最顶行

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计2118字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中