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

4、不能切换,出现 No route to host

[root@server3 ~]# masterha_manager --conf=/etc/masterha/app1.cnf
Sun Mar 24 01:49:48 2019 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Sun Mar 24 01:49:48 2019 - [info] Reading application default configuration from /etc/masterha/app1.cnf..
Sun Mar 24 01:49:48 2019 - [info] Reading server configuration from /etc/masterha/app1.cnf..
ssh: connect to host 192.168.32.180 port 22: No route to host
ssh: connect to host 192.168.32.180 port 22: No route to host
ssh: connect to host 192.168.32.180 port 22: No route to host
ssh: connect to host 192.168.32.180 port 22: No route to host
ssh: connect to host 192.168.32.180 port 22: No route to host
ssh: connect to host 192.168.32.180 port 22: No route to host

解决办法:

找到MHA的log文件,查看原因:

Sun Mar 24 01:51:43 2019 - [info] Executing secondary network check script: /usr/local/bin/masterha_secondary_check -s 192.168.32.181 -s 192.168.32.182 --user=root --master_host=server1 --master_ip=192.168.32.180 --master_port=3306 --user=root --master_host=server1 --master_ip=192.168.32.180 --master_port=3306 --master_user=monitor --master_password=mysql --ping_type=SELECT
sh: /usr/local/bin/masterha_secondary_check: No such file or directory
Sun Mar 24 01:51:43 2019 - [error][/usr/share/perl5/vendor_perl/MHA/HealthCheck.pm, ln412] Got unknown error from /usr/local/bin/masterha_secondary_check -s 192.168.32.181 -s 192.168.32.182 --user=root --master_host=server1 --master_ip=192.168.32.180 --master_port=3306 --user=root --master_host=server1 --master_ip=192.168.32.180 --master_port=3306 --master_user=monitor --master_password=mysql --ping_type=SELECT. exit.

发现是找不到文件路径,经查文件在

/usr/bin/masterha_secondary_check

修改参数文件/etc/mastermha/app.cof 的配置项secondary_check_script= /usr/bin/masterha_secondary_check -s 192.168.32.181 -s 192.168.32.182 --user=root --master_host=server1 --master_ip=192.168.32.180 --master_port=3306

5、Failed to deactivate master IP with return code 1:0

Sun Mar 24 03:55:29 2019 - [info] ** Phase 1: Configuration Check Phase completed.
Sun Mar 24 03:55:29 2019 - [info]
Sun Mar 24 03:55:29 2019 - [info] * Phase 2: Dead Master Shutdown Phase..
Sun Mar 24 03:55:29 2019 - [info]
Sun Mar 24 03:55:29 2019 - [info] Forcing shutdown so that applications never connect to the current master..
Sun Mar 24 03:55:29 2019 - [info] Executing master IP deactivation script:
Sun Mar 24 03:55:29 2019 - [info] /etc/masterha/master_ip_failover --orig_master_host=server1 --orig_master_ip=192.168.32.180 --orig_master_port=3306 --command=stop
Got Error: Use of uninitialized value $ssh_user in concatenation (.) or string at /etc/masterha/master_ip_failover line 79.

IN SCRIPT TEST====/sbin/ifconfig eth0:1 down==/sbin/ifconfig eth0:1 192.168.32.183===

Disabling the VIP on old master: server1
Sun Mar 24 03:55:29 2019 - [error][/usr/share/perl5/vendor_perl/MHA/MasterFailover.pm, ln352] Failed to deactivate master IP with return code 1:0
Sun Mar 24 03:55:29 2019 - [error][/usr/share/perl5/vendor_perl/MHA/ManagerUtil.pm, ln177] Got ERROR: at /usr/bin/masterha_manager line 65
Sun Mar 24 03:55:29 2019 - [info]

----- Failover Report -----

app1: MySQL Master failover server1(192.168.32.180:3306)

Master server1(192.168.32.180:3306) is down!

Check MHA Manager logs at server3:/var/log/masterha/app1-manager.log for details.

Started automated(non-interactive) failover.
Failed to deactivate master IP with return code 1:0
Got Error so couldn't continue failover from here.
Sun Mar 24 03:55:29 2019 - [info] Sending mail..
Unknown option: conf

解决办法:

这个一直说/etc/masterha/master_ip_failover line 79行错误

ssh_user没有初始化

MySQL MHA 报错处理的更多相关文章

  1. mysql MHA报错 Can't exec "mysqlbinlog": No such file or directory at /usr/local/share/perl5/MHA/BinlogManager.pm line 99.

    如果发现如下错误: Can't exec "mysqlbinlog": No such file or directory at /usr/local/share/perl5/MH ...

  2. python 3.5.2安装mysql驱动报错

    python 3.5.2安装mysql驱动报错 python 3.5.2安装mysql驱动时出现如下异常: [root@localhost www]# pip install mysql-connec ...

  3. Loadrunner参数化连接oracle、mysql数据源报错及解决办法

    Loadrunner参数化连接oracle.mysql数据源报错及解决办法 (本人系统是Win7 64,  两位小伙伴因为是默认安装lr,安装在 最终参数化的时候,出现连接字符串无法自动加载出来: 最 ...

  4. 连接mysql数据库报错java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecognized...解决方法

    今天连接mysql数据库报错如下: java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecognized or r ...

  5. MYSQL—— 启动MYSQL 57 报错“The service MYSQL57 failed the most recent........等”的问题解决方式!

    每天开机之后,启动MYSQL Notifier就报错,第一次出现重启电脑后解决,后面的几天老是出现,重启电脑好几次都没有解决,感觉很烦人,一定要搞定这个问题找到原因,于是有了下文....... 启动M ...

  6. mysql 备份报错mysqldump: [Warning] Using a password on the command line interface can be insecure.

    -------------------------------------------------------------------------------- mysql 备份报错mysqldump ...

  7. PHP+mysql系统报错:PHP message: PHP Warning: Unknown: Failed to write session data (files)

    PHP+mysql系统报错:PHP message: PHP Warning:  Unknown: Failed to write session data (files) 故障现象,后台页面点击没有 ...

  8. mysql启动报错 The server quit without updating PID file

    [root@uz6542 data]# /etc/init.d/mysqld startStarting MySQL... ERROR! The server quit without updatin ...

  9. 解决mysql安装报错:无法启动此程序,因为计算机丢失MSVCP120.dll

    问题一: 因为装的是新系统,所以遇到mysql启动报错:无法启动此程序,因为计算机丢失MSVCP120.dll 后来参考这篇文章https://blog.csdn.net/huacode/articl ...

随机推荐

  1. SQL in、not in、exists和not exists的区别:

    来自:http://blog.sina.com.cn/s/blog_8a0c4f130100zaw2.html 先谈谈in和exists的区别: exists:存在,后面一般都是子查询,当子查询返回行 ...

  2. python调用shell脚本时需要切换目录

    最近遇到了一个问题,就是python代码调用shell脚本时,发现输入输出的文件,总是和自己预想的有偏差,但是单独在linux下执行命令的时候,却没有错误.后来发现是相对路径的问题,因为执行pytho ...

  3. ZooKeeper注册中心安装详细步骤(单节点)

    安装 Dubbo 注册中心 Dubbo 建议使用 Zookeeper 作为服务的注册中心. 注册中心服务器(192.168.3.71)配置,安装 Zookeeper: 1. 修改操作系统的/etc/h ...

  4. 15.vue动画& vuex

    Vue.config.productionTip = false; ==是否显示提示信息== ==import/export== export xxx 必须跟跟对象或者和定义一起 对象: export ...

  5. select 和epoll模型区别

    1.select 和epoll模型区别 1.1.网络IO模型概述 通常来说,网络IO可以抽象成用户态和内核态之间的数据交换.一次网络数据读取操作(read),可以拆分成两个步骤:1)网卡驱动等待数据准 ...

  6. html 中a标签的问题(无反应,跳转,调用方法)

    让超链接点击后不跳转,可以用href = "#",但是这个#就会锚点到页面最上边     点击链接后不跳转可以设置成     1.<a href="javascri ...

  7. javascript的数组之find()

    find()方法返回数组中第一个满足回调函数测试的第一个元素的值.否则返回undefined const arr1 = [1, 2, 3, 4, 6, 9]; let found = arr1.fin ...

  8. 初始easyUI

    1 easyUI布局 <%@ page language="java" contentType="text/html; charset=UTF-8" pa ...

  9. 逆向工程之修改关键CALL返回值_破解视频转换专家

    1)注册软件随便输入注册名注册码 2)进入软件根目录,发送到PEID查壳 3)发现无壳 4)发送到OD 4.1)右键菜单选择智能搜索 4.2)找到关键信息点注册 4.3)找到关键信息点双击进入汇编,向 ...

  10. linux ---部署django项目篇

    uWSGI + nginx+ django + virtualenv + supervisor发布web服务器 项目部署步骤 1.项目准备阶段 1.准备项目代码,从本地拷贝 2.将项目上传到linux ...