MHA手动在线切换主 原创3(主不参与复制)
monitor
执行:slave2连接到slave1,server1 不做(主/从复制角色,停在那里) [root@monitor app1]# masterha_master_switch --conf=/etc/masterha/app1.conf --master_state=alive --new_master_host=slave1
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:) 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] ** 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] 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]# slave1 :上执行
mysql> show variables like "read_only";
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| read_only | OFF |
+---------------+-------+
1 row in set (0.00 sec)
注意已经由只读变为可写!!!!!!!!!
server1 没有变化,还是 read_only=OFF
在反复切换实验时注意读写状态
MHA手动在线切换主 原创3(主不参与复制)的更多相关文章
- MHA的在线切换后的一些总结(mha方案来自网络)
mha方案来自:http://www.cnblogs.com/xuanzhi201111/p/4231412.html MHA的在线切换 192.168.2.131 [root bin]$ maste ...
- MHA手动切换 原创1(主故障)
MHA提供了3种方式用于实现故障转移,分别自动故障转移,需要启用MHA监控: 在无监控的情况下的手动故障转移以及基于在线手动切换. 三种方式可以应对MySQL主从故障的任意场景.本文主要描述在无监控的 ...
- 关于mha手动切换的一些记录(mha方案来自网络)
mha方案出自:http://www.cnblogs.com/xuanzhi201111/p/4231412.html 当主服务器故障时,人工手动调用MHA来进行故障切换操作,具体命令如下: 先停MH ...
- MHA在线切换过程
MHA 在线切换是MHA除了自动监控切换换提供的另外一种方式,多用于诸如硬件升级,MySQL数据库迁移等等.该方式提供快速切换和优雅的阻塞写入,无关关闭原有服务器,整个切换过程在0.5-2s 的时间左 ...
- MHA在线切换的步骤及原理
在日常工作中,会碰到如下的场景,如mysql数据库升级,主服务器硬件升级等,这个时候就需要将写操作切换到另外一台服务器上,那么如何进行在线切换呢?同时,要求切换过程短,对业务的影响比较小. MHA就提 ...
- MySQL高可用方案MHA在线切换的步骤及原理
在日常工作中,会碰到如下的场景,如mysql数据库升级,主服务器硬件升级等,这个时候就需要将写操作切换到另外一台服务器上,那么如何进行在线切换呢?同时,要求切换过程短,对业务的影响比较小. MHA就提 ...
- MHA ssh检查,repl复制检查和在线切换日志分析
一.SSh 检查日志分析 执行过程及对应的日志: 1.读取MHA manger 节点上的配置文件 2.根据配置文件,得到各个主机的信息,逐一进行SSH检查 3.每个主机都通过SSH连接除了自己以外的其 ...
- mysql mha 主从自动切换 高可用
mha(Master High Availability)目前在MySQL多服务器(超过二台),高可用方面是一个相对成熟的解决方案. 一,什么是mha,有什么特性 1. 主服务器的自动监控和故障转移 ...
- MHA 实现VIP切换用到脚本
在MHA Manager端配置中,如果实现MHA的vip故障切换需要在配置文件/etc/masterha/app1/app1.cnf 中启用下面三个参数: master_ip_failover_scr ...
随机推荐
- [转]解决crystal report水晶报表在浏览器提示bobj未定义的错误
网上的中文文章(比如这篇文章)都是写的部署到服务器后出现的问题,同时也指出要把crystal report的aspnet_client文件夹拷贝到对应项目的根目录里,这样就可以正常显示了,但是具体到我 ...
- 《Python 学习手册4th》 第六章 动态类型简介
''' 时间: 9月5日 - 9月30日 要求: 1. 书本内容总结归纳,整理在博客园笔记上传 2. 完成所有课后习题 注:“#” 后加的是备注内容 (每天看42页内容,可以保证月底看完此书)“重点笔 ...
- U盘安装Centos5.3
一.制作 U 盘启动引导盘 1. 插上 U 盘,打开 UltraISO 软件,打开CentOS-5.3-i386-bin-DVD.iso 文件: 2.点启动--写入硬盘镜像,在硬盘驱动器里面选择你的 ...
- python学习之random模块
Python中的random模块用于生成随机数.下面介绍一下random模块中最常用的几个函数. random.random random.random()用于生成一个0到1的随机符点数: 0 < ...
- [HIve - LanguageManual] Joins
Hive Joins Hive Joins Join Syntax Examples MapJoin Restrictions Join Optimization Predicate Pushdown ...
- 《Java数据结构与算法》笔记-CH1
/** * 数据结构的特性 ************************************************************************************** ...
- 最大连续子数组问题-homework-01
1)先写我的 github 的介绍: github 的域名:http://www.github.com/zhuifeng1022 登入 github 大概是下面的视图: 按照助教的方法:我已经建好了代 ...
- LightOJ 1074 Extended Traffic (最短路spfa+标记负环点)
Extended Traffic 题目链接: http://acm.hust.edu.cn/vjudge/contest/122685#problem/O Description Dhaka city ...
- POJ Wormholes (SPFA)
http://poj.org/problem?id=3259 Description While exploring his many farms, Farmer John has discovere ...
- [C语言 - 3] 字符串
字符数组 char * 看做一个特殊的字符数组, 在字符串结束为止添加'\0'结束符 (ASCII码0), 没有\0结尾的是普通的字符数组. 使用双引号定义的字符串自动在尾部加上\0 puts(s)函 ...