MHA 切换的2个异常(masterha_master_switch line 53)

        MHA 在测试手动故障转移和在线切换的过程中,碰到了2个比较诡异的问题,在使用IP地址调用的时候均无法测试成功,出现了Detected dead master xxx does not match with specified dead master以及xxx is not alive。下面是这2个错误问题的描述及解决方案。

 

1、MHA配置文件
[root@vdbsrv4 ~]# more /etc/masterha/app1.cnf
[server default]
manager_workdir=/var/log/masterha/app1
manager_log=/var/log/masterha/app1/manager.log

user=mha
password=xxx
ssh_user=root
repl_user=repl  
repl_password=repl  
ping_interval=1
shutdown_script=""
master_ip_online_change_script=""
report_script=""
#master_ip_failover_script=/usr/bin/master_ip_failover
master_ip_failover_script=/tmp/master_ip_failover
 
[server1]
hostname=vdbsrv1
master_binlog_dir=/data/mysqldata

[server2]
hostname=vdbsrv2
master_binlog_dir=/data/mysqldata

[server3]
hostname=vdbsrv3
master_binlog_dir=/data/mysqldata/
#candidate_master=1

 

2、手动故障转移时的错误提示
[root@vdbsrv4 ~]# masterha_master_switch --master_state=dead --conf=/etc/masterha/app1.cnf --dead_master_host=192.168.1.6 \
> --dead_master_port=3306 --new_master_host=192.168.1.8 --new_master_port=3306 --ignore_last_failover
--dead_master_ip=<dead_master_ip> is not set. Using 192.168.1.6.
Wed Apr 21 09:08:30 2015 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Wed Apr 21 09:08:30 2015 - [info] Reading application default configuration from /etc/masterha/app1.cnf..
Wed Apr 21 09:08:30 2015 - [info] Reading server configuration from /etc/masterha/app1.cnf..
Wed Apr 21 09:08:30 2015 - [info] MHA::MasterFailover version 0.56.
Wed Apr 21 09:08:30 2015 - [info] Starting master failover.
Wed Apr 21 09:08:30 2015 - [info]
Wed Apr 21 09:08:30 2015 - [info] * Phase 1: Configuration Check Phase..
Wed Apr 21 09:08:30 2015 - [info]
Wed Apr 21 09:08:31 2015 - [info] GTID failover mode = 0
Wed Apr 21 09:08:31 2015 - [error][/usr/lib/perl5/site_perl/5.8.8/MHA/MasterFailover.pm, ln2083] Detected dead master vdbsrv1(192.168.1.6:3306)
   does not match with specified dead master 192.168.1.6(192.168.1.6:3306)!
Wed Apr 21 09:08:31 2015 - [error][/usr/lib/perl5/site_perl/5.8.8/MHA/MasterFailover.pm, ln2151]
   Got ERROR:  at /usr/bin/masterha_master_switch line 53

 

3、在线切换时的错误提示
[root@vdbsrv4 ~]# masterha_master_switch --conf=/etc/masterha/app1.cnf --master_state=alive --new_master_host=192.168.1.8 \
> --orig_master_is_new_slave --running_updates_limit=10000
Tue Apr 21 11:50:14 2015 - [info] MHA::MasterRotate version 0.56.
Tue Apr 21 11:50:14 2015 - [info] Starting online master switch..
Tue Apr 21 11:50:14 2015 - [info]
Tue Apr 21 11:50:14 2015 - [info] * Phase 1: Configuration Check Phase..
Tue Apr 21 11:50:14 2015 - [info]
Tue Apr 21 11:50:14 2015 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Tue Apr 21 11:50:14 2015 - [info] Reading application default configuration from /etc/masterha/app1.cnf..
Tue Apr 21 11:50:14 2015 - [info] Reading server configuration from /etc/masterha/app1.cnf..
Tue Apr 21 11:50:14 2015 - [info] GTID failover mode = 0
Tue Apr 21 11:50:14 2015 - [info] Current Alive Master: vdbsrv1(192.168.1.6:3306)
Tue Apr 21 11:50:14 2015 - [info] Alive Slaves:
Tue Apr 21 11:50:14 2015 - [info]   vdbsrv2(192.168.1.7:3306)  Version=5.6.22-log (oldest major version between slaves) log-bin:enabled
Tue Apr 21 11:50:14 2015 - [info]     Replicating from 192.168.1.6(192.168.1.6:3306)
Tue Apr 21 11:50:14 2015 - [info]   vdbsrv3(192.168.1.8:3306)  Version=5.6.22-log (oldest major version between slaves) log-bin:enabled
Tue Apr 21 11:50:14 2015 - [info]     Replicating from 192.168.1.6(192.168.1.6:3306)

It is better to execute FLUSH NO_WRITE_TO_BINLOG TABLES on the master before switching. Is it ok to execute on vdbsrv1(192.168.1.6:3306)? (YES/no): yes
Tue Apr 21 11:50:41 2015 - [info] Executing FLUSH NO_WRITE_TO_BINLOG TABLES. This may take long time..
Tue Apr 21 11:50:41 2015 - [info]  ok.
Tue Apr 21 11:50:41 2015 - [info] Checking MHA is not monitoring or doing failover..
Tue Apr 21 11:50:41 2015 - [info] Checking replication health on vdbsrv2..
Tue Apr 21 11:50:41 2015 - [info]  ok.
Tue Apr 21 11:50:41 2015 - [info] Checking replication health on vdbsrv3..
Tue Apr 21 11:50:41 2015 - [info]  ok.
Tue Apr 21 11:50:41 2015 - [error][/usr/lib/perl5/site_perl/5.8.8/MHA/MasterRotate.pm, ln228] 192.168.1.8 is not alive!
Tue Apr 21 11:50:41 2015 - [error][/usr/lib/perl5/site_perl/5.8.8/MHA/MasterRotate.pm, ln613] Failed to get new master!
Tue Apr 21 11:50:41 2015 - [error][/usr/lib/perl5/site_perl/5.8.8/MHA/MasterRotate.pm, ln652] Got ERROR:  at /usr/bin/masterha_master_switch line 53

 

4、解决方案
      直接将IP地址替换为主机名后问题解决,不再演示。

       按官方文档描述,参数--dead_master_host=(hostname),而不是可以用IP地址。

       If these parameters are not set, --dead_master_ip will be the result of gethostbyname(dead_master_host), and --dead_master_port will be 3306.

       补充: 如果配置文件里hostname=IP地址,则在切换的时候使用IP地址也是可行的。 @20150522



时间: 2024-10-02 23:17:10

MHA 切换的2个异常(masterha_master_switch line 53)的相关文章

Silverlight 中xmal 报异常XamlParseException: [Line: 0 Position: 0]

问题描述 代码:在UserControl这个标签上报异常XamlParseException:[Line:0Position:0]求解决<UserControlx:Class="UploadManager.Views.NaviViewOne"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:telerik="http://schemas.telerik.com

MHA failover NON-GTID 专题

MHA failover NON-GTID 专题 这里以masterha_master_switch为背景详解各种可能遇到的场景 假定环境(经典三节点) host_1(host_1:3306) (current master) +--host_2(host_2:3306 slave[candidate master]) +--host_3(host_3:3306 etl) 一.Master : MySQL down 1.1 etl 延迟8小时 配置文件中加上no_check_delay=0 即可

MHA failover GTID 专题

MHA failover GTID 专题 这里以masterha_master_switch为背景详解各种可能遇到的场景 假定环境(经典三节点) host_1(host_1:3306) (current master) +--host_2(host_2:3306 slave[candidate master]) +--host_3(host_3:3306 etl) 一.Master : MySQL down 1.1 etl 延迟8小时 配置文件中加上no_check_delay=0 即可忽略报错

MySQL 高可用MHA安装部署以及故障转移详细资料汇总

  1,简介 1.1mha简介 MHA,即MasterHigh Availability Manager and Tools for MySQL,是日本的一位MySQL专家采用Perl语言编写的一个脚本管理工具,该工具仅适用于MySQLReplication(二层)环境,目的在于维持Master主库的高可用性.   MHA(Master High Availability)是自动的master故障转移和Slave提升的软件包.它是基于标准的MySQL复制(异步/半同步).      MHA有两部

MySQL Master High Available 实战篇

测试背景 以下所有测试,全部基于以下复制结构完成 host_1(host_1:3306) (current master) +--host_2(host_2:3306) +--host_3(host_3:3306) 一.MHA安装 mha node 所有服务器节点都要安装 mha manager 只需要安装在manager节点 MHA NODE 1. yum install perl-DBD-MySQL 2. rpm -ivh mha4mysql-node-0.56-0.el6.noarch.r

【MHA】命系列介绍--[masterha_master_switch]

介绍: masterha_master_switch 不监控主库,但是可以用于主库宕机后failover,可以用于在线切换主库 手动failover: 有时候需要手动执行failover机制,masterha_master_switch 命令可以用于 手动执行failover. eg: masterha_master_switch --master_state=alive --conf=/etc/app.cnf --dead_master_host=host1 常用参数介绍: --master_

android中fragment切换的时候遇到非法参数异常的问题

问题描述 android中fragment切换的时候遇到非法参数异常的问题 FragmentTabHost中加入了两个fragment,片段1和片段2.运行后从片段1到片段2没有出问题,当从片段2再回到片段1的时候出现非法参数异常. 异常代码如图 找到错误主要原因是设置了一个布局的ID: gridview_layout.setId(CAL_LAYOUT_ID); 请问为什么在fragment中设置id切换片段后会发生异常? 解决方案 你这两个页面的id相同 但是页面不是同一种类型的 有冲突

MHA VIP切换脚本

    MHA能够在10~30秒内实现自动故障检测和故障转移,适用于对高可用性,数据完整性要求较高的场合.要做到无缝切换,还需要依赖于VIP漂移.VIP漂移比较常用的方式为使用keepalived或者使用脚本直接实现.脚本方式无须安装及复杂配置,相对简单.本文描述了基于脚本实现VIP切换.   对于keepalived的相关配置可以参考:CentOS 5.9下安装配置keepalived   1.当前主机环境及MHA配置  [root@vdbsrv1 ~]# more /etc/hosts127

MHA实施

1.关于MHA MHA(Master High Availability)目前在MySQL高可用方面是一个相对成熟的解决方案,它由日本DeNA公司youshimaton(现就职于Facebook公司)开发,是一套优秀的作为MySQL高可用性环境下故障切换和主从提升的高可用软件.在MySQL故障切换过程中,MHA能做到在0~30秒之内自动完成数据库的故障切换操作,并且在进行故障切换的过程中,MHA能在最大程度上保证数据的一致性,以达到真正意义上的高可用. 该软件由两部分组成:MHA Manager