Chinaunix首页 | 论坛 | 博客
  • 博客访问: 350733
  • 博文数量: 86
  • 博客积分: 1460
  • 博客等级: 上尉
  • 技术积分: 848
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-12 14:07
文章分类

全部博文(86)

文章存档

2017年(36)

2016年(17)

2015年(1)

2013年(12)

2012年(2)

2011年(1)

2010年(1)

2009年(16)

我的朋友

分类: Mysql/postgreSQL

2017-06-26 16:42:00

搭建1主2从  架构mha  进行测试

1. 报错如下
masterha_master_switch --master_state=alive --conf=/etc/mha/app1.cnf --new_master_host=172.16.1.79 --orig_master_is_new_slave --interactive=0

原因:  确认是由于监控主从状态的用户和主从复制用户缺少reload 权限,grant 就可以了,报错也可以切换但是发现新主库没有reset slave,清空原来同步信息,原主库没有设置read_only=on

Mon Jun 26 16:07:39 2017 - [info] GTID failover mode = 1
Mon Jun 26 16:07:39 2017 - [info] Current Alive Master: 172.16.1.79(172.16.1.79:3306)
Mon Jun 26 16:07:39 2017 - [info] Alive Slaves:
Mon Jun 26 16:07:39 2017 - [info]   172.16.1.80(172.16.1.80:3306)  Version=5.7.12-5-log (oldest major version between slaves) log-bin:enabled
Mon Jun 26 16:07:39 2017 - [info]     GTID ON
Mon Jun 26 16:07:39 2017 - [info]     Replicating from 172.16.1.79(172.16.1.79:3306)
Mon Jun 26 16:07:39 2017 - [info]     Primary candidate for the new Master (candidate_master is set)
Mon Jun 26 16:07:39 2017 - [info]   172.16.1.81(172.16.1.81:3306)  Version=5.7.12-5-log (oldest major version between slaves) log-bin:enabled
Mon Jun 26 16:07:39 2017 - [info]     GTID ON
Mon Jun 26 16:07:39 2017 - [info]     Replicating from 172.16.1.79(172.16.1.79:3306)
Mon Jun 26 16:07:39 2017 - [info]     Not candidate for the new Master (no_master is set)
Mon Jun 26 16:07:39 2017 - [info] Executing FLUSH NO_WRITE_TO_BINLOG TABLES. This may take long time..
Mon Jun 26 16:07:39 2017 - [error][/usr/local/share/perl5/MHA/Server.pm, ln642]  Failed! Access denied; you need (at least one of) the RELOAD privilege(s) for this operati
onMon Jun 26 16:07:39 2017 - [info] Checking MHA is not monitoring or doing failover..
Mon Jun 26 16:07:39 2017 - [info] Checking replication health on 172.16.1.80..
Mon Jun 26 16:07:39 2017 - [info]  ok.
Mon Jun 26 16:07:39 2017 - [info] Checking replication health on 172.16.1.81..
Mon Jun 26 16:07:39 2017 - [info]  ok.
Mon Jun 26 16:07:39 2017 - [info] 172.16.1.80 can be new master.
Mon Jun 26 16:07:39 2017 - [info] 



Mon Jun 26 16:03:42 2017 - [info] -- Slave switch on host 172.16.1.81(172.16.1.81:3306) succeeded.
Mon Jun 26 16:03:42 2017 - [info] Unlocking all tables on the orig master:
Mon Jun 26 16:03:42 2017 - [info] Executing UNLOCK TABLES..
Mon Jun 26 16:03:42 2017 - [info]  ok.
Mon Jun 26 16:03:42 2017 - [info] Starting orig master as a new slave..
Mon Jun 26 16:03:42 2017 - [info]  Resetting slave 172.16.1.80(172.16.1.80:3306) and starting replication from the new master 172.16.1.79(172.16.1.79:3306)..
Mon Jun 26 16:03:42 2017 - [info]  Executed CHANGE MASTER.
Mon Jun 26 16:03:43 2017 - [info]  Slave started.
Mon Jun 26 16:03:43 2017 - [info] All new slave servers switched successfully.
Mon Jun 26 16:03:43 2017 - [info] 
Mon Jun 26 16:03:43 2017 - [info] * Phase 5: New master cleanup phase..
Mon Jun 26 16:03:43 2017 - [info] 
Mon Jun 26 16:03:43 2017 - [error][/usr/local/share/perl5/MHA/Server.pm, ln710]  SHOW SLAVE STATUS shows new master replicates from somewhere. Check for details!
Mon Jun 26 16:03:43 2017 - [error][/usr/local/share/perl5/MHA/Server.pm, ln724]  172.16.1.79: Resetting slave info failed.
Mon Jun 26 16:03:43 2017 - [error][/usr/local/share/perl5/MHA/MasterRotate.pm, ln612] Switching master to 172.16.1.79(172.16.1.79:3306) done, but switching slaves partiall
y failed.





2.报错2
原因: 发现切换后,原来的主切换成从库,没有设置read_only=on

[root@localhost ~]# masterha_master_switch --master_state=alive --conf=/etc/mha/app1.cnf --new_master_host=172.16.1.79 --orig_master_is_new_slave --interactive=0
Mon Jun 26 16:11:40 2017 - [info] MHA::MasterRotate version 0.57.
Mon Jun 26 16:11:40 2017 - [info] Starting online master switch..
Mon Jun 26 16:11:40 2017 - [info] 
Mon Jun 26 16:11:40 2017 - [info] * Phase 1: Configuration Check Phase..
Mon Jun 26 16:11:40 2017 - [info] 
Mon Jun 26 16:11:40 2017 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Mon Jun 26 16:11:40 2017 - [info] Reading application default configuration from /etc/mha/app1.cnf..
Mon Jun 26 16:11:40 2017 - [info] Reading server configuration from /etc/mha/app1.cnf..
Mon Jun 26 16:11:41 2017 - [warning] SQL Thread is stopped(no error) on 172.16.1.80(172.16.1.80:3306)
Mon Jun 26 16:11:41 2017 - [error][/usr/local/share/perl5/MHA/ServerManager.pm, ln781] Multi-master configuration is detected, but two or more masters are either writable 
(read-only is not set) or dead! Check configurations for details. Master configurations are as below: Master 172.16.1.80(172.16.1.80:3306), replicating from 172.16.1.79(172.16.1.79:3306)
Master 172.16.1.79(172.16.1.79:3306), replicating from 172.16.1.80(172.16.1.80:3306)

阅读(2095) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~