您的位置:首页 > 运维架构

MHA监控进程异常退出

2015-07-30 12:16 501 查看
这两天遇到一个非常诡异的问题,打算和大家分享一下。只所以诡异估计是自己知识面不够吧。线上的MHA一直没有开启自动切换,都是手动切换的,最近开启了自动切换以后,退出securecrt窗口以后发现监控进程异常自己退出了。报错日志如下:

MHA版本:0.56

Checking the Status of the script.. OK
Thu Jul 30 11:59:08 2015 - [info]  OK.
Thu Jul 30 11:59:08 2015 - [warning] shutdown_script is not defined.
Thu Jul 30 11:59:08 2015 - [info] Set master ping interval 5 seconds.
Thu Jul 30 11:59:08 2015 - [warning] secondary_check_script is not defined. It is highly recommended setting it to check master reachability from two or more routes.
Thu Jul 30 11:59:08 2015 - [info] Starting ping health check on 10.69.237.181(10.69.237.181:3306)..
Thu Jul 30 11:59:08 2015 - [info] Ping(SELECT) succeeded, waiting until MySQL doesn't respond..
Thu Jul 30 11:59:12 2015 - [info] Got terminate signal. Exit.


可以看见日志里面有Got terminate signal. Exit.提示。启动方法和官方的没有区别,官方的启动监控进程如下:



通过nohup挂到后台执行发现退出securecrt后监控进程就异常退出。有朋友说是securecrt的bug,这个还有待测试。最后采用把命令写到脚本里面,再执行就没有异常了。

很简单,脚本start_monitor.sh如下:

#!/bin/bash

/usr/bin/nohup /usr/local/bin/masterha_manager --conf=/data/mha/3306/mha.cnf --ignore_last_failover > /data/mha/3306/log/manager.log 2>&1 &


启动监控:

/bin/bash start_monitor.sh


当然官方还提到另一种方法;使用daemon的方式运行,这个是为了避免MHA切换以后进程退出的方法。



参考资料:

https://code.google.com/p/mysql-master-ha/wiki/Runnning_Background
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: