mha0.56版本安装使用排错

如果对MHA还不了解,建议先看以下链接对应的博文。

http://os.51cto.com/art/201307/401702.htm        //这篇博文把搭建MHA的前期准备共组写的很清楚

http://blog.itpub.net/26230597/viewspace-1570798/    // 这篇博文上的安装过程写的比较具体,而且写了MHA除了支持自动故障切换,还可以做手动的故障切换

http://www.dataguru.cn/thread-457284-1-1.html      // 这篇博文把MHA的配置参数等信息解释的很清楚

http://467754239.blog.51cto.com/4878013/1695175     // 这个博文上把整个MHA的切换过程都描述了。博文上也描述了MAH自带虚拟IP转移的脚本,我理解应该不需要keepalive。但是如何把出问题的主在加入到MHA中作为新的从设备好像存在点问题

如果以对MHA有所了解,可以直接阅读。

环境:centos 6.5

mysql 5.7   (yum安装)

mha0.56

master: 192.168.21.10

backup:192.168.21.11

slave:192.168.21.12

yum安装mha

1 安装epel源

2 下载官网的rpm包   官方介绍:https://code.google.com/p/mysql-master-ha/

按照以下博文链接做MHA的实验

http://blog.csdn.net/lichangzai/article/details/50470771     博文链接

以下是我在实验过程中遇到的问题,这些问题都是在执行

masterha_check_repl --conf=/etc/masterha/app1/app1.cnf 发生

有些问题网上很难找到解决办法。现在分享给大家。

问题1

[[email protected] ~]# masterha_check_repl --conf=/etc/mha/app1.conf

Fri Jul 22 09:08:54 2016 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.

Fri Jul 22 09:08:54 2016 - [info] Reading application default configuration from /etc/mha/app1.conf..

Fri Jul 22 09:08:54 2016 - [info] Reading server configuration from /etc/mha/app1.conf..

Fri Jul 22 09:08:54 2016 - [info] MHA::MasterMonitor version 0.56.

Fri Jul 22 09:08:54 2016 - [info] GTID failover mode = 0

Fri Jul 22 09:08:54 2016 - [info] Dead Servers:

Fri Jul 22 09:08:54 2016 - [info] Alive Servers:

Fri Jul 22 09:08:54 2016 - [info]   192.168.21.10(192.168.21.10:3306)

Fri Jul 22 09:08:54 2016 - [info]   192.168.21.11(192.168.21.11:3306)

Fri Jul 22 09:08:54 2016 - [info]   192.168.21.12(192.168.21.12:3306)

Fri Jul 22 09:08:54 2016 - [info] Alive Slaves:

Fri Jul 22 09:08:54 2016 - [info]   192.168.21.11(192.168.21.11:3306)  Version=5.7.16 (oldest major version between slaves) log-bin:disabled

Fri Jul 22 09:08:54 2016 - [info]     Replicating from 192.168.21.10(192.168.21.10:3306)

Fri Jul 22 09:08:54 2016 - [info]     Primary candidate for the new Master (candidate_master is set)

Fri Jul 22 09:08:54 2016 - [info]   192.168.21.12(192.168.21.12:3306)  Version=5.7.16 (oldest major version between slaves) log-bin:disabled

Fri Jul 22 09:08:54 2016 - [info]     Replicating from 192.168.21.10(192.168.21.10:3306)

Fri Jul 22 09:08:54 2016 - [info] Current Alive Master: 192.168.21.10(192.168.21.10:3306)

Fri Jul 22 09:08:54 2016 - [info] Checking slave configurations..

Fri Jul 22 09:08:54 2016 - [info]  read_only=1 is not set on slave 192.168.21.11(192.168.21.11:3306).

Fri Jul 22 09:08:54 2016 - [warning]  relay_log_purge=0 is not set on slave 192.168.21.11(192.168.21.11:3306).

Fri Jul 22 09:08:54 2016 - [warning]  log-bin is not set on slave 192.168.21.11(192.168.21.11:3306). This host cannot be a master.

Fri Jul 22 09:08:54 2016 - [info]  read_only=1 is not set on slave 192.168.21.12(192.168.21.12:3306).

Fri Jul 22 09:08:54 2016 - [warning]  relay_log_purge=0 is not set on slave 192.168.21.12(192.168.21.12:3306).

Fri Jul 22 09:08:54 2016 - [warning]  log-bin is not set on slave 192.168.21.12(192.168.21.12:3306). This host cannot be a master.

Fri Jul 22 09:08:54 2016 - [info] Checking replication filtering settings..

Fri Jul 22 09:08:54 2016 - [info]  binlog_do_db= , binlog_ignore_db= mysql

Fri Jul 22 09:08:54 2016 - [info]  Replication filtering check ok.

Fri Jul 22 09:08:54 2016 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln361] None of slaves can be master. Check failover configuration file or log-bin settings in my.cnf

Fri Jul 22 09:08:54 2016 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln424] Error happened on checking configurations.  at /usr/bin/masterha_check_repl line 48

Fri Jul 22 09:08:54 2016 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln523] Error happened on monitoring servers.

Fri Jul 22 09:08:54 2016 - [info] Got exit code 1 (Not master dead).

解决方法:

在两个从库上开启二进制日志即可(花了 一天时间,找不到解决方法,最后还是靠自己的理解及测试解决的,骄傲!!)具体配置不在贴上来了。

问题2

[[email protected] ~]# masterha_check_repl --conf=/etc/mha/app1.conf

Fri Jul 22 09:26:48 2016 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.

Fri Jul 22 09:26:48 2016 - [info] Reading application default configuration from /etc/mha/app1.conf..

Fri Jul 22 09:26:48 2016 - [info] Reading server configuration from /etc/mha/app1.conf..

Fri Jul 22 09:26:48 2016 - [info] MHA::MasterMonitor version 0.56.

Fri Jul 22 09:26:48 2016 - [info] GTID failover mode = 0

Fri Jul 22 09:26:48 2016 - [info] Dead Servers:

Fri Jul 22 09:26:48 2016 - [info] Alive Servers:

Fri Jul 22 09:26:48 2016 - [info]   192.168.21.10(192.168.21.10:3306)

Fri Jul 22 09:26:48 2016 - [info]   192.168.21.11(192.168.21.11:3306)

Fri Jul 22 09:26:48 2016 - [info]   192.168.21.12(192.168.21.12:3306)

Fri Jul 22 09:26:48 2016 - [info] Alive Slaves:

Fri Jul 22 09:26:48 2016 - [info]   192.168.21.11(192.168.21.11:3306)  Version=5.7.16-log (oldest major version between slaves) log-bin:enabled

Fri Jul 22 09:26:48 2016 - [info]     Replicating from 192.168.21.10(192.168.21.10:3306)

Fri Jul 22 09:26:48 2016 - [info]     Primary candidate for the new Master (candidate_master is set)

Fri Jul 22 09:26:48 2016 - [info]   192.168.21.12(192.168.21.12:3306)  Version=5.7.16-log (oldest major version between slaves) log-bin:enabled

Fri Jul 22 09:26:48 2016 - [info]     Replicating from 192.168.21.10(192.168.21.10:3306)

Fri Jul 22 09:26:48 2016 - [info] Current Alive Master: 192.168.21.10(192.168.21.10:3306)

Fri Jul 22 09:26:48 2016 - [info] Checking slave configurations..

Fri Jul 22 09:26:48 2016 - [info]  read_only=1 is not set on slave 192.168.21.11(192.168.21.11:3306).

Fri Jul 22 09:26:48 2016 - [warning]  relay_log_purge=0 is not set on slave 192.168.21.11(192.168.21.11:3306).

Fri Jul 22 09:26:48 2016 - [info]  read_only=1 is not set on slave 192.168.21.12(192.168.21.12:3306).

Fri Jul 22 09:26:48 2016 - [warning]  relay_log_purge=0 is not set on slave 192.168.21.12(192.168.21.12:3306).

Fri Jul 22 09:26:48 2016 - [info] Checking replication filtering settings..

Fri Jul 22 09:26:48 2016 - [info]  binlog_do_db= , binlog_ignore_db= mysql

Fri Jul 22 09:26:48 2016 - [error][/usr/share/perl5/vendor_perl/MHA/ServerManager.pm, ln443] Binlog filtering check failed on 192.168.21.11(192.168.21.11:3306)! All log-bin enabled servers must have same binlog filtering rules (same binlog-do-db and binlog-ignore-db). Check SHOW MASTER STATUS output and set my.cnf correctly.

解决方法:

我在主上开了复制过滤,在从上也必须开启,修改配置文件后还不能reload,需要restart。

问题3

[[email protected] ~]# masterha_check_repl --conf=/etc/mha/app1.conf

Fri Jul 22 09:30:04 2016 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.

Fri Jul 22 09:30:04 2016 - [info] Reading application default configuration from /etc/mha/app1.conf..

Fri Jul 22 09:30:04 2016 - [info] Reading server configuration from /etc/mha/app1.conf..

Fri Jul 22 09:30:04 2016 - [info] MHA::MasterMonitor version 0.56.

Fri Jul 22 09:30:04 2016 - [info] GTID failover mode = 0

Fri Jul 22 09:30:04 2016 - [info] Dead Servers:

Fri Jul 22 09:30:04 2016 - [info] Alive Servers:

Fri Jul 22 09:30:04 2016 - [info]   192.168.21.10(192.168.21.10:3306)

Fri Jul 22 09:30:04 2016 - [info]   192.168.21.11(192.168.21.11:3306)

Fri Jul 22 09:30:04 2016 - [info]   192.168.21.12(192.168.21.12:3306)

Fri Jul 22 09:30:04 2016 - [info] Alive Slaves:

Fri Jul 22 09:30:04 2016 - [info]   192.168.21.11(192.168.21.11:3306)  Version=5.7.16-log (oldest major version between slaves) log-bin:enabled

Fri Jul 22 09:30:04 2016 - [info]     Replicating from 192.168.21.10(192.168.21.10:3306)

Fri Jul 22 09:30:04 2016 - [info]     Primary candidate for the new Master (candidate_master is set)

Fri Jul 22 09:30:04 2016 - [info]   192.168.21.12(192.168.21.12:3306)  Version=5.7.16-log (oldest major version between slaves) log-bin:enabled

Fri Jul 22 09:30:04 2016 - [info]     Replicating from 192.168.21.10(192.168.21.10:3306)

Fri Jul 22 09:30:04 2016 - [info] Current Alive Master: 192.168.21.10(192.168.21.10:3306)

Fri Jul 22 09:30:04 2016 - [info] Checking slave configurations..

Fri Jul 22 09:30:04 2016 - [info]  read_only=1 is not set on slave 192.168.21.11(192.168.21.11:3306).

Fri Jul 22 09:30:04 2016 - [warning]  relay_log_purge=0 is not set on slave 192.168.21.11(192.168.21.11:3306).

Fri Jul 22 09:30:04 2016 - [info]  read_only=1 is not set on slave 192.168.21.12(192.168.21.12:3306).

Fri Jul 22 09:30:04 2016 - [warning]  relay_log_purge=0 is not set on slave 192.168.21.12(192.168.21.12:3306).

Fri Jul 22 09:30:04 2016 - [info] Checking replication filtering settings..

Fri Jul 22 09:30:04 2016 - [info]  binlog_do_db= , binlog_ignore_db= mysql

Fri Jul 22 09:30:04 2016 - [info]  Replication filtering check ok.

Fri Jul 22 09:30:04 2016 - [error][/usr/share/perl5/vendor_perl/MHA/Server.pm, ln393] 192.168.21.11(192.168.21.11:3306): User repl does not exist or does not have REPLICATION SLAVE privilege! Other slaves can not start replication from this host.

Fri Jul 22 09:30:04 2016 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln424] Error happened on checking configurations.  at /usr/share/perl5/vendor_perl/MHA/ServerManager.pm line 1403

Fri Jul 22 09:30:04 2016 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln523] Error happened on monitoring servers.

Fri Jul 22 09:30:04 2016 - [info] Got exit code 1 (Not master dead).

解决方法:

具有复制权限的用户必须在所有节点上都创建一次,具有管理权限的用户也是一样,这两点在网上的好多博文上都没说清楚。

问题4

[[email protected] ~]# masterha_check_repl --conf=/etc/mha/app1.conf

Fri Jul 22 09:42:46 2016 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.

Fri Jul 22 09:42:46 2016 - [info] Reading application default configuration from /etc/mha/app1.conf..

Fri Jul 22 09:42:46 2016 - [info] Reading server configuration from /etc/mha/app1.conf..

Fri Jul 22 09:42:46 2016 - [info] MHA::MasterMonitor version 0.56.

Fri Jul 22 09:42:46 2016 - [info] GTID failover mode = 0

Fri Jul 22 09:42:46 2016 - [info] Dead Servers:

Fri Jul 22 09:42:46 2016 - [info] Alive Servers:

Fri Jul 22 09:42:46 2016 - [info]   192.168.21.10(192.168.21.10:3306)

Fri Jul 22 09:42:46 2016 - [info]   192.168.21.11(192.168.21.11:3306)

Fri Jul 22 09:42:46 2016 - [info]   192.168.21.12(192.168.21.12:3306)

Fri Jul 22 09:42:46 2016 - [info] Alive Slaves:

Fri Jul 22 09:42:46 2016 - [info]   192.168.21.11(192.168.21.11:3306)  Version=5.7.16-log (oldest major version between slaves) log-bin:enabled

Fri Jul 22 09:42:46 2016 - [info]     Replicating from 192.168.21.10(192.168.21.10:3306)

Fri Jul 22 09:42:46 2016 - [info]     Primary candidate for the new Master (candidate_master is set)

Fri Jul 22 09:42:46 2016 - [info]   192.168.21.12(192.168.21.12:3306)  Version=5.7.16-log (oldest major version between slaves) log-bin:enabled

Fri Jul 22 09:42:46 2016 - [info]     Replicating from 192.168.21.10(192.168.21.10:3306)

Fri Jul 22 09:42:46 2016 - [info] Current Alive Master: 192.168.21.10(192.168.21.10:3306)

Fri Jul 22 09:42:46 2016 - [info] Checking slave configurations..

Fri Jul 22 09:42:46 2016 - [info]  read_only=1 is not set on slave 192.168.21.11(192.168.21.11:3306).

Fri Jul 22 09:42:46 2016 - [warning]  relay_log_purge=0 is not set on slave 192.168.21.11(192.168.21.11:3306).

Fri Jul 22 09:42:46 2016 - [info]  read_only=1 is not set on slave 192.168.21.12(192.168.21.12:3306).

Fri Jul 22 09:42:46 2016 - [warning]  relay_log_purge=0 is not set on slave 192.168.21.12(192.168.21.12:3306).

Fri Jul 22 09:42:46 2016 - [info] Checking replication filtering settings..

Fri Jul 22 09:42:46 2016 - [info]  binlog_do_db= , binlog_ignore_db= mysql

Fri Jul 22 09:42:46 2016 - [info]  Replication filtering check ok.

Fri Jul 22 09:42:47 2016 - [info] GTID (with auto-pos) is not supported

Fri Jul 22 09:42:47 2016 - [info] Starting SSH connection tests..

Fri Jul 22 09:42:48 2016 - [info] All SSH connection tests passed successfully.

Fri Jul 22 09:42:48 2016 - [info] Checking MHA Node version..

Fri Jul 22 09:42:49 2016 - [info]  Version check ok.

Fri Jul 22 09:42:49 2016 - [info] Checking SSH publickey authentication settings on the current master..

Fri Jul 22 09:42:49 2016 - [info] HealthCheck: SSH to 192.168.21.10 is reachable.

Fri Jul 22 09:42:49 2016 - [info] Master MHA Node version is 0.56.

Fri Jul 22 09:42:49 2016 - [info] Checking recovery script configurations on 192.168.21.10(192.168.21.10:3306)..

Fri Jul 22 09:42:49 2016 - [info]   Executing command: save_binary_logs --command=test --start_pos=4 --binlog_dir=/logs/mysqllog/mysql-bin --output_file=/var/tmp/save_binary_logs_test --manager_version=0.56 --start_file=mysql-bin.000001

Fri Jul 22 09:42:49 2016 - [info]   Connecting to [email protected](192.168.21.10:22)..

Failed to save binary log: Binlog not found from /logs/mysqllog/mysql-bin! If you got this error at MHA Manager, please set "master_binlog_dir=/path/to/binlog_directory_of_the_master" correctly in the MHA Manager‘s configuration file and try again.

at /usr/bin/save_binary_logs line 123

eval {...} called at /usr/bin/save_binary_logs line 70

main::main() called at /usr/bin/save_binary_logs line 66

Fri Jul 22 09:42:49 2016 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln158] Binlog setting check failed!

Fri Jul 22 09:42:49 2016 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln405] Master configuration failed.

Fri Jul 22 09:42:49 2016 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln424] Error happened on checking configurations.  at /usr/bin/masterha_check_repl line 48

Fri Jul 22 09:42:49 2016 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln523] Error happened on monitoring servers.

Fri Jul 22 09:42:49 2016 - [info] Got exit code 1 (Not master dead).

解决方法:

如果手动定义了二进制日志文件的路径,就必须在mha的配置文件中制定master_binlog_dir=‘二进制日志文件所在目录‘

总结:用我博文中介绍的MHA版本,应该需要在所有的数据库中都开启二进制日志,中继日志,授权也应该都相同,配置文件也基本相同。我想在这个前提下在安装执行MHA应该不会遇上太多问题了。只是目前还不能确定这种做法是不是正解。

时间: 2024-10-06 06:24:36

mha0.56版本安装使用排错的相关文章

mysql-5.5.56版本(二进制包安装)-自定义安装路径

mysql-5.5.56版本(二进制包安装)-自定义安装路径 安装路径:/application/mysql-5.5.56 1.前期准备 mysql依赖 libaio yum install -y libaio 创建用户mysql,以该用户的身份执行mysql useradd -s /bin/false -M mysql 下载mysql二进制包并解压 cd /tools wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.56

mysql数据库高可用架构-----MHA-0.56的详解

大家都知道,任何线上环境,都必须搭载高可用架构,是web的,也要是数据库的,严格来说更是整个架构的高可用. mysql作为时下比较热的数据库,高可用架构更加需求大.不过,以前老旧那一套已经不合时宜,现在用的比较多的就是MHA和PXC了. PXC的优势是做到同写同回滚,达到数据高度一致性,通过一些程序和代码来做第三方分发,可以做到一定程度的读写分离,是个相当不错的高可用解决方案,不过对网络要求比较高,配置也略复杂一些,最好是同一个机房里面做,不过这并不是本文重点,后面找时间再写相关的文章. 本文要

Centos X64 6.9版本安装postfix2.6.6+dovecot+openwebmail

Centos X64 6.9版本安装postfix2.6.6+dovecot+openwebmail 测试完成日期:2017.06.07 附件为配置文件,可以直接使用 使用系统自带的帐号.密码文件进行认证,不用安装mysql,方法简单. 测试发现Centos 6.5\6.9 x64都使用SHA-512加密. 一.先卸载sendmain [[email protected] ~]#  yum remove sendmail # chkconfig sendmail off 二.安装postfix

Visual Studio 2013版本安装

这周老师布置了关于Visual Studio 2013版本安装过程的概述,下面我就分享给大家看吧! 首先要下载安装文件,等待下载完成之后,虽然下载文件是ios格式,但我们可以用解压缩工具解压打开.解压好后,双击vs_ultimate,开始安装. 自定义选择安装路径时,注意所属路径的预留空间要充足,否则安装会失败,同意许可条款,进行下一步. 在选择安装的可选功能这里,大家可以根据自己需要勾选,也可以默认全选. 等待大概30分钟,就可以完成安装.安装过程中,VS会占用很多的系统资源,所以最好不要开启

python多版本安装配置流程

情景:最新开始学习python,之前由于某个项目接触过python语言,但是那时候只是在项目平台上借助python这门工具语言罢了.趁着寒假这短暂的休闲时光,自己系统地开始学习python这门胶水语言,简易而全能.学习一门少不了一个开发工具的安装,同时目前python流行版本为2/3,所以为了方便使用,也知道pyhton可以多版本安装,故在自己的win7 32位电脑上进行多版本安装. 环境:WIN7 32位系统 软件包: python2.7.3和python3.5.3 问题:首先肯定是pytho

Cocos2d-x 2.0以上版本安装方法

1,cd 到2dx根目录,MAC平台使用./create-multi-platform-projects.py  然后提示: -bash: ./create-multi-platform-projects.py: /usr/bin/evn: bad interpreter: No such file or directory 没关系,我们打开.py文件,发现其实引用的是tools/project-creator/create_project.py 这文件 2,我们再cd 到tools/proje

firefox os 开发模拟器1.4版本安装开发详解

首先在使用firefox os 模拟器的时候必须先下载firefox 浏览器,这个是众多web开发者必备的工具,下载地址firefox 浏览器 ,在最新的官方版本是1.5版的模拟器,但是现在还不是很稳定,所以暂时就以较稳定的1.4版本做为蓝本供开发者交流学习,下载地址firefox os 模拟器 ,接下了就是图文教程,教你一步一步安装1.4版的firefox os 模拟器,开始新的firefox os开发之旅! 编辑(5狐网)--更多资料教程请到Firefox os 论坛(5狐网) 连接地址:h

Windows zip版本安装MySQL

Windows --MySQL zip版本安装记录: step1. 官网download zip包:http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.10-winx64.zip step2. 解压包,path中增加E:\software\mysql-5.7.10\bin step3. 修改 my-default.ini文件:basedir = E:\software\mysql-5.7.10datadir = E:\software\mysq

httpd-2.2版本安装及配置

一.httpd-2.2版本安装及配置 1.安装httpd-2.2.3 #yun -y install httpd 2.查看httpd安装生成的文件 #rpm -ql httpd | less 3.启动服务 #service httpd start 4.开机自动启动服务 #chkconfig --add httpd #chkconfig --level 345 httpd on 5.建立测试页面 #cd /var/www/html #vim index.html 6.httpd服务的配置文件 #c