MHA手动切换 原创2 (主参与复制)
monitor 执行下面命令后,
--orig_master_is_new_slave :原主变为新从,即server1变成了slave1的从.
slave2跟据app1.conf中配制也变成了slave1的从
[root@monitor app1]# masterha_master_switch --conf=/etc/masterha/app1.conf --master_state=alive --new_master_host=slave1 --orig_master_is_new_slave
Mon May :: - [info] MHA::MasterRotate version 0.56.
Mon May :: - [info] Starting online master switch..
Mon May :: - [info]
Mon May :: - [info] * Phase : Configuration Check Phase..
Mon May :: - [info]
Mon May :: - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Mon May :: - [info] Reading application default configuration from /etc/masterha/app1.conf..
Mon May :: - [info] Reading server configuration from /etc/masterha/app1.conf..
Mon May :: - [debug] Connecting to servers..
Mon May :: - [debug] Connected to: server1(10.24.220.232:), user=root
Mon May :: - [debug] Number of slave worker threads on host server1(10.24.220.232:):
Mon May :: - [debug] Connected to: slave1(10.24.220.70:), user=root
Mon May :: - [debug] Number of slave worker threads on host slave1(10.24.220.70:):
Mon May :: - [debug] Connected to: slave2(10.169.214.33:), user=root
Mon May :: - [debug] Number of slave worker threads on host slave2(10.169.214.33:):
Mon May :: - [debug] Comparing MySQL versions..
Mon May :: - [debug] Comparing MySQL versions done.
Mon May :: - [debug] Connecting to servers done.
Mon May :: - [info] GTID failover mode =
Mon May :: - [info] Current Alive Master: server1(10.24.220.232:)
Mon May :: - [info] Alive Slaves:
Mon May :: - [info] slave1(10.24.220.70:) Version=5.7.-log (oldest major version between slaves) log-bin:enabled
Mon May :: - [info] GTID ON
Mon May :: - [debug] Relay log info repository: FILE
Mon May :: - [info] Replicating from 10.24.220.232(10.24.220.232:)
Mon May :: - [info] Primary candidate for the new Master (candidate_master is set)
Mon May :: - [info] slave2(10.169.214.33:) Version=5.7.-log (oldest major version between slaves) log-bin:enabled
Mon May :: - [info] GTID ON
Mon May :: - [debug] Relay log info repository: FILE
Mon May :: - [info] Replicating from 10.24.220.232(10.24.220.232:)
Mon May :: - [info] Not candidate for the new Master (no_master is set) It is better to execute FLUSH NO_WRITE_TO_BINLOG TABLES on the master before switching. Is it ok to execute on server1(10.24.220.232:)? (YES/no): YES
Mon May :: - [info] Executing FLUSH NO_WRITE_TO_BINLOG TABLES. This may take long time..
Mon May :: - [info] ok.
Mon May :: - [info] Checking MHA is not monitoring or doing failover..
Mon May :: - [info] Checking replication health on slave1..
Mon May :: - [info] ok.
Mon May :: - [info] Checking replication health on slave2..
Mon May :: - [info] ok.
Mon May :: - [info] slave1 can be new master.
Mon May :: - [info]
From:
server1(10.24.220.232:) (current master)
+--slave1(10.24.220.70:)
+--slave2(10.169.214.33:) To:
slave1(10.24.220.70:) (new master)
+--slave2(10.169.214.33:)
+--server1(10.24.220.232:) Starting master switch from server1(10.24.220.232:) to slave1(10.24.220.70:)? (yes/NO): YES
Mon May :: - [info] Checking whether slave1(10.24.220.70:) is ok for the new master..
Mon May :: - [info] ok.
Mon May :: - [info] server1(10.24.220.232:): SHOW SLAVE STATUS returned empty result. To check replication filtering rules, temporarily executing CHANGE MASTER to a dummy host.
Mon May :: - [info] server1(10.24.220.232:): Resetting slave pointing to the dummy host.
Mon May :: - [info] ** Phase : Configuration Check Phase completed.
Mon May :: - [info]
Mon May :: - [debug] Disconnected from server1(10.24.220.232:)
Mon May :: - [info] * Phase : Rejecting updates Phase..
Mon May :: - [info]
master_ip_online_change_script is not defined. If you do not disable writes on the current master manually, applications keep writing on the current master. Is it ok to proceed? (yes/NO): YES
Mon May :: - [info] Locking all tables on the orig master to reject updates from everybody (including root):
Mon May :: - [info] Executing FLUSH TABLES WITH READ LOCK..
Mon May :: - [info] ok.
Mon May :: - [info] Orig master binlog:pos is log.:.
Mon May :: - [debug] Fetching current slave status..
Mon May :: - [debug] Fetching current slave status done.
Mon May :: - [info] Waiting to execute all relay logs on slave1(10.24.220.70:)..
Mon May :: - [info] master_pos_wait(log.:) completed on slave1(10.24.220.70:). Executed events.
Mon May :: - [info] done.
Mon May :: - [debug] Stopping SQL thread on slave1(10.24.220.70:)..
Mon May :: - [debug] done.
Mon May :: - [info] Getting new master's binlog name and position..
Mon May :: - [info] log.:
Mon May :: - [info] All other slaves should start replication from here. Statement should be: CHANGE MASTER TO MASTER_HOST='slave1 or 10.24.220.70', MASTER_PORT=, MASTER_AUTO_POSITION=, MASTER_USER='repl', MASTER_PASSWORD='xxx';
Mon May :: - [info] Setting read_only= on slave1(10.24.220.70:)..
Mon May :: - [info] ok.
Mon May :: - [info]
Mon May :: - [info] * Switching slaves in parallel..
Mon May :: - [info]
Mon May :: - [info] -- Slave switch on host slave2(10.169.214.33:) started, pid:
Mon May :: - [info]
Mon May :: - [info] Log messages from slave2 ...
Mon May :: - [info]
Mon May :: - [info] Waiting to execute all relay logs on slave2(10.169.214.33:)..
Mon May :: - [info] master_pos_wait(log.:) completed on slave2(10.169.214.33:). Executed events.
Mon May :: - [info] done.
Mon May :: - [debug] Stopping SQL thread on slave2(10.169.214.33:)..
Mon May :: - [debug] done.
Mon May :: - [info] Resetting slave slave2(10.169.214.33:) and starting replication from the new master slave1(10.24.220.70:)..
Mon May :: - [debug] Stopping slave IO/SQL thread on slave2(10.169.214.33:)..
Mon May :: - [debug] done.
Mon May :: - [info] Executed CHANGE MASTER.
Mon May :: - [debug] Starting slave IO/SQL thread on slave2(10.169.214.33:)..
Mon May :: - [debug] done.
Mon May :: - [info] Slave started.
Mon May :: - [info] End of log messages from slave2 ...
Mon May :: - [info]
Mon May :: - [info] -- Slave switch on host slave2(10.169.214.33:) succeeded.
Mon May :: - [info] Unlocking all tables on the orig master:
Mon May :: - [info] Executing UNLOCK TABLES..
Mon May :: - [info] ok.
Mon May :: - [info] Starting orig master as a new slave..
Mon May :: - [info] Resetting slave server1(10.24.220.232:) and starting replication from the new master slave1(10.24.220.70:)..
Mon May :: - [info] Executed CHANGE MASTER.
Mon May :: - [debug] Starting slave IO/SQL thread on server1(10.24.220.232:)..
Mon May :: - [debug] done.
Mon May :: - [info] Slave started.
Mon May :: - [debug] ok.
Mon May :: - [info] All new slave servers switched successfully.
Mon May :: - [info]
Mon May :: - [info] * Phase : New master cleanup phase..
Mon May :: - [info]
Mon May :: - [debug] Clearing slave info..
Mon May :: - [debug] Stopping slave IO/SQL thread on slave1(10.24.220.70:)..
Mon May :: - [debug] done.
Mon May :: - [debug] SHOW SLAVE STATUS shows new master does not replicate from anywhere. OK.
Mon May :: - [info] slave1: Resetting slave info succeeded.
Mon May :: - [info] Switching master to slave1(10.24.220.70:) completed successfully.
Mon May :: - [debug] Disconnected from server1(10.24.220.232:)
Mon May :: - [debug] Disconnected from slave1(10.24.220.70:)
Mon May :: - [debug] Disconnected from slave2(10.169.214.33:)
[root@monitor app1]#
MHA手动切换 原创2 (主参与复制)的更多相关文章
- MHA手动切换 原创1(主故障)
MHA提供了3种方式用于实现故障转移,分别自动故障转移,需要启用MHA监控: 在无监控的情况下的手动故障转移以及基于在线手动切换. 三种方式可以应对MySQL主从故障的任意场景.本文主要描述在无监控的 ...
- MHA手动切换 原创4 (非交互式切换)
非交互式切换:不输 YES 或者 NO [root@monitor app1]# masterha_master_switch --conf=/etc/masterha/app1.conf --mas ...
- 关于mha手动切换的一些记录(mha方案来自网络)
mha方案出自:http://www.cnblogs.com/xuanzhi201111/p/4231412.html 当主服务器故障时,人工手动调用MHA来进行故障切换操作,具体命令如下: 先停MH ...
- MHA手动在线切换主 原创3(主不参与复制)
monitor 执行:slave2连接到slave1,server1 不做(主/从复制角色,停在那里) [root@monitor app1]# masterha_master_switch --co ...
- MHA 安装过程 原创
root@monitor yum.repos.d]# cat CentOS-Base.repo [base]name=CentOS-$releasever - Basefailovermethod=p ...
- 【MySQL】主备复制
复制对于mysql的重要性不言而喻,mysql集群的负载均衡,读写分离和高可用都是基于复制实现.下文主要从4个方面展开,mysql的异步复制,半同步复制和并行复制,最后会简单聊下第三方复制工具.由于生 ...
- MHA在线切换过程
MHA 在线切换是MHA除了自动监控切换换提供的另外一种方式,多用于诸如硬件升级,MySQL数据库迁移等等.该方式提供快速切换和优雅的阻塞写入,无关关闭原有服务器,整个切换过程在0.5-2s 的时间左 ...
- MHA在线切换的步骤及原理
在日常工作中,会碰到如下的场景,如mysql数据库升级,主服务器硬件升级等,这个时候就需要将写操作切换到另外一台服务器上,那么如何进行在线切换呢?同时,要求切换过程短,对业务的影响比较小. MHA就提 ...
- MySQL高可用方案MHA在线切换的步骤及原理
在日常工作中,会碰到如下的场景,如mysql数据库升级,主服务器硬件升级等,这个时候就需要将写操作切换到另外一台服务器上,那么如何进行在线切换呢?同时,要求切换过程短,对业务的影响比较小. MHA就提 ...
随机推荐
- 【和我一起学python吧】初学Python,版本如何选择?
早在四年多以前,在我进入英才网之前,去面试过一家海归创业的公司.他们需要的是有unix开发经验的技术人员,但是因为他们当时所处的阶段对很多成熟 技术人员不是很吸引,所以条件放宽为熟悉面向对象的程序开发 ...
- 杂谈:HTML 5页面可视性API
译文来源:http://www.ido321.com/1126.html 原文:HTML5 Page Visibility API 译文:HTML 5的页面可视性API 译者:dwqs 在早期,浏览器 ...
- 《Linux命令行与shell脚本编程大全》 第三章 学习笔记
第三章:基本的bash shell命令 bash程序使用命令行参数来修改所启动shell的类型 参数 描述 -c string 从string中读取命令并处理他们 -r 启动限制性shell,限制用户 ...
- web服务器分析与设计(一)
自己写一个简单的服务器. 面向对象分析与设计第一步:获取需求(基于用例) 功能:1,支持html静态网页,2,支持常用HTTP请求,且容易扩展支持不现请求 3,可以发布站点 补充:至于对动态网页等高级 ...
- 题目1437:To Fill or Not to Fill:贪心算法解决加油站选择问题(未解决)
//贪心算法解决加油站选择问题 //# include<iostream> # include<stdio.h> using namespace std; # include& ...
- .net组件技术
.NET是什么? •.NET是一个平台,而不是一种语言. •.NET是Microsoft的用以创建XML Web服务(下一代软件)平台,该平台将信息.设备和人以一种统一的.个性化的方式联系起来. ...
- Javascript原理
1.javascript创建对象 创建新对象有两种不同的方法: 定义并创建对象的实例 person=new Object(); person.firstname="Bill"; p ...
- hadoop conf中xml文件修改
core-site.xml <?xml version="1.0"?><?xml-stylesheet type="text/xsl" hre ...
- 关于C# XML序列化的一个BUG的修改
关于C# XML序列化的一个BUG的修改 在我前一篇博客中提到用XML序列化作为数据库的一个方案,@拿笔小心 提到他们在用XML序列化时,遇到了一个比较严重的bug,即XML不闭合,系统不能正确的加载 ...
- aspose.cell制作excel常见写法
//设置Excel的基本格式信息 Workbook workbook = new Workbook(); Worksheet worksheet = workbook.Worksheets[]; St ...