MySQL 5.6 GTID+MHA-12413959
1.关闭主库MySQL实例在Master上:service mysqld stop,查看MHA manager日志:
SunAug 14 11:51:14 2016 - Got error on MySQL select ping: 2006 (MySQLserver has gone away)
SunAug 14 11:51:14 2016 - Executing SSH check script: exit 0
SunAug 14 11:51:14 2016 - HealthCheck: SSH to 192.168.1.103 is reachable.
SunAug 14 11:51:15 2016 - Got error on MySQL connect: 2013 (Lostconnection to MySQL server at 'reading initial communication packet', systemerror: 111)
SunAug 14 11:51:15 2016 - Connection failed 2 time(s)..
SunAug 14 11:51:16 2016 - Got error on MySQL connect: 2013 (Lostconnection to MySQL server at 'reading initial communication packet', systemerror: 111)
SunAug 14 11:51:16 2016 - Connection failed 3 time(s)..
SunAug 14 11:51:17 2016 - Got error on MySQL connect: 2013 (Lostconnection to MySQL server at 'reading initial communication packet', systemerror: 111)
SunAug 14 11:51:17 2016 - Connection failed 4 time(s)..
SunAug 14 11:51:17 2016 - Master is not reachable from health checker!
Sun Aug 14 11:51:17 2016 - Master192.168.1.103(192.168.1.103:3306) is not reachable!
SunAug 14 11:51:17 2016 - SSH is reachable.
SunAug 14 11:51:17 2016 - Connecting to a master server failed. Readingconfiguration file /etc/masterha_default.cnf and /etc/mha/app1.cnf again, andtrying to connect to all servers to check server status..
SunAug 14 11:51:17 2016 - Global configuration file/etc/masterha_default.cnf not found. Skipping.
SunAug 14 11:51:17 2016 - Reading application default configuration from/etc/mha/app1.cnf..
SunAug 14 11:51:17 2016 - Reading server configuration from/etc/mha/app1.cnf..
Sun Aug 14 11:51:17 2016 - GTID failover mode = 1
Sun Aug14 11:51:17 2016 - Dead Servers:
SunAug 14 11:51:17 2016 - 192.168.1.103(192.168.1.103:3306)
SunAug 14 11:51:17 2016 - Alive Servers:
SunAug 14 11:51:17 2016 - 192.168.1.104(192.168.1.104:3306)
SunAug 14 11:51:17 2016 - Alive Slaves:
SunAug 14 11:51:17 2016 - 192.168.1.104(192.168.1.104:3306) Version=5.6.30-enterprise-commercial-advanced-log (oldest majorversion between slaves) log-bin:enabled
SunAug 14 11:51:17 2016 - GTIDON
SunAug 14 11:51:17 2016 - Replicating from 192.168.1.103(192.168.1.103:3306)
SunAug 14 11:51:17 2016 - Primary candidate for the new Master (candidate_master is set)
SunAug 14 11:51:17 2016 - Checking slave configurations..
SunAug 14 11:51:17 2016 - read_only=1 is not set on slave 192.168.1.104(192.168.1.104:3306).
SunAug 14 11:51:17 2016 - Checking replication filtering settings..
SunAug 14 11:51:17 2016 - Replication filtering check ok.
SunAug 14 11:51:17 2016 - Master is down!
SunAug 14 11:51:17 2016 - Terminating monitoring script.
SunAug 14 11:51:17 2016 - Got exit code 20 (Master dead).
SunAug 14 11:51:17 2016 - MHA::MasterFailover version 0.56.
SunAug 14 11:51:17 2016 - Starting master failover.
SunAug 14 11:51:17 2016 -
SunAug 14 11:51:17 2016 - * Phase 1: Configuration Check Phase..
SunAug 14 11:51:17 2016 -
SunAug 14 11:51:17 2016 - GTID failover mode = 1
SunAug 14 11:51:17 2016 - Dead Servers:
SunAug 14 11:51:17 2016 - 192.168.1.103(192.168.1.103:3306)
SunAug 14 11:51:17 2016 - Checking master reachability via MySQL(doublecheck)...
SunAug 14 11:51:17 2016 - ok.
SunAug 14 11:51:17 2016 - Alive Servers:
SunAug 14 11:51:17 2016 - 192.168.1.104(192.168.1.104:3306)
SunAug 14 11:51:17 2016 - Alive Slaves:
SunAug 14 11:51:17 2016 - 192.168.1.104(192.168.1.104:3306) Version=5.6.30-enterprise-commercial-advanced-log (oldest majorversion between slaves) log-bin:enabled
SunAug 14 11:51:17 2016 - GTIDON
SunAug 14 11:51:17 2016 - Replicating from 192.168.1.103(192.168.1.103:3306)
SunAug 14 11:51:17 2016 - Primary candidate for the new Master (candidate_master is set)
SunAug 14 11:51:17 2016 - Starting GTID based failover.
SunAug 14 11:51:17 2016 -
SunAug 14 11:51:17 2016 - ** Phase 1: Configuration Check Phasecompleted.
SunAug 14 11:51:17 2016 -
Sun Aug14 11:51:17 2016 - * Phase 2: Dead Master Shutdown Phase..
SunAug 14 11:51:17 2016 -
SunAug 14 11:51:17 2016 - Forcing shutdown so that applications neverconnect to the current master..
SunAug 14 11:51:17 2016 - Executing master IP deactivation script:
SunAug 14 11:51:17 2016 - /etc/mha/master_ip_failover --orig_master_host=192.168.1.103--orig_master_ip=192.168.1.103 --orig_master_port=3306 --command=stopssh--ssh_user=root
INSCRIPT TEST====/sbin/ifconfig eth1:1 down==/sbin/ifconfig eth1:1192.168.1.108;/sbin/arping -I eth1 -c 3 -s 192.168.1.108 192.168.1.1>/dev/null 2>&1===
Disablingthe VIP on old master if the server is still UP: 192.168.1.103
SunAug 14 11:51:17 2016 - done.
SunAug 14 11:51:17 2016 - shutdown_script is not set. Skippingexplicit shutting down of the dead master.
SunAug 14 11:51:17 2016 - * Phase 2: Dead Master Shutdown Phasecompleted.
SunAug 14 11:51:17 2016 -
SunAug 14 11:51:17 2016 - * Phase 3: Master Recovery Phase..
SunAug 14 11:51:17 2016 -
SunAug 14 11:51:17 2016 - * Phase 3.1: Getting Latest Slaves Phase..
SunAug 14 11:51:17 2016 -
SunAug 14 11:51:17 2016 - The latest binary log file/position on allslaves is bin.000014:231
SunAug 14 11:51:17 2016 - Latest slaves (Slaves that received>
SunAug 14 11:51:17 2016 - 192.168.1.104(192.168.1.104:3306) Version=5.6.30-enterprise-commercial-advanced-log (oldest majorversion between slaves) log-bin:enabled
SunAug 14 11:51:17 2016 - GTIDON
SunAug 14 11:51:17 2016 - Replicating from 192.168.1.103(192.168.1.103:3306)
SunAug 14 11:51:17 2016 - Primary candidate for the new Master (candidate_master is set)
SunAug 14 11:51:17 2016 - The oldest binary log file/position on allslaves is bin.000014:231
SunAug 14 11:51:17 2016 - Oldest slaves:
SunAug 14 11:51:17 2016 - 192.168.1.104(192.168.1.104:3306) Version=5.6.30-enterprise-commercial-advanced-log (oldest majorversion between slaves) log-bin:enabled
SunAug 14 11:51:17 2016 - GTIDON
SunAug 14 11:51:17 2016 - Replicating from 192.168.1.103(192.168.1.103:3306)
SunAug 14 11:51:17 2016 - Primary candidate for the new Master (candidate_master is set)
SunAug 14 11:51:17 2016 -
SunAug 14 11:51:17 2016 - * Phase 3.3: Determining New Master Phase..
SunAug 14 11:51:17 2016 -
SunAug 14 11:51:17 2016 - Searching new master from slaves..
SunAug 14 11:51:17 2016 - Candidate masters from the configuration file:
SunAug 14 11:51:17 2016 - 192.168.1.104(192.168.1.104:3306) Version=5.6.30-enterprise-commercial-advanced-log (oldest majorversion between slaves) log-bin:enabled
SunAug 14 11:51:17 2016 - GTIDON
SunAug 14 11:51:17 2016 - Replicating from192.168.1.103(192.168.1.103:3306)
SunAug 14 11:51:17 2016 - Primary candidate for the new Master (candidate_master is set)
SunAug 14 11:51:17 2016 - Non-candidate masters:
SunAug 14 11:51:17 2016 - Searchingfrom candidate_master slaves which have received the latest>
SunAug 14 11:51:17 2016 - New master is 192.168.1.104(192.168.1.104:3306)
SunAug 14 11:51:17 2016 - Starting master failover..
SunAug 14 11:51:17 2016 -
From:
192.168.1.103(192.168.1.103:3306)(current master)
+--192.168.1.104(192.168.1.104:3306)
To:
192.168.1.104(192.168.1.104:3306)(new master)
SunAug 14 11:51:17 2016 -
SunAug 14 11:51:17 2016 - * Phase 3.3: New Master Recovery Phase..
SunAug 14 11:51:17 2016 -
SunAug 14 11:51:17 2016 - Waitingall logs to be applied..
SunAug 14 11:51:17 2016 - done.
SunAug 14 11:51:17 2016 - Getting new master's binlog name and position..
SunAug 14 11:51:17 2016 - bin.000015:231
SunAug 14 11:51:17 2016 - Allother slaves should start replication from here. Statement should be: CHANGEMASTER TO MASTER_HOST='192.168.1.104', MASTER_PORT=3306,MASTER_AUTO_POSITION=1, MASTER_USER='repl', MASTER_PASSWORD='xxx';
SunAug 14 11:51:17 2016 - Master Recovery succeeded.File:Pos:Exec_Gtid_Set: bin.000015, 231,1683955a-6102-11e6-8b6f-080027ca1592:1-8,
1c3a7f53-6102-11e6-8b6f-08002722cc6d:1-10
SunAug 14 11:51:17 2016 - Executing master IP activate script:
SunAug 14 11:51:17 2016 - /etc/mha/master_ip_failover --command=start --ssh_user=root--orig_master_host=192.168.1.103 --orig_master_ip=192.168.1.103--orig_master_port=3306 --new_master_host=192.168.1.104--new_master_ip=192.168.1.104 --new_master_port=3306 --new_master_user='root'--new_master_password='111111'
INSCRIPT TEST====/sbin/ifconfig eth1:1 down==/sbin/ifconfig eth1:1192.168.1.108;/sbin/arping -I eth1 -c 3 -s 192.168.1.108 192.168.1.1 >/dev/null2>&1===
Enabling the VIP - 192.168.1.108 on the new master - 192.168.1.104
SunAug 14 11:51:20 2016 - OK.
SunAug 14 11:51:20 2016 - ** Finished master recovery successfully.
SunAug 14 11:51:20 2016 - * Phase 3: Master Recovery Phase completed.
SunAug 14 11:51:20 2016 -
SunAug 14 11:51:20 2016 - * Phase 4: Slaves Recovery Phase..
SunAug 14 11:51:20 2016 -
SunAug 14 11:51:20 2016 -
SunAug 14 11:51:20 2016 - * Phase 4.1: Starting Slaves in parallel..
SunAug 14 11:51:20 2016 -
SunAug 14 11:51:20 2016 - All new slave servers recovered successfully.
SunAug 14 11:51:20 2016 -
SunAug 14 11:51:20 2016 - * Phase 5: New master cleanup phase..
SunAug 14 11:51:20 2016 -
SunAug 14 11:51:20 2016 - Resetting slave info on the new master..
SunAug 14 11:51:20 2016 - 192.168.1.104: Resetting slave info succeeded.
SunAug 14 11:51:20 2016 - Master failover to 192.168.1.104(192.168.1.104:3306)completed successfully.
SunAug 14 11:51:20 2016 -
----- Failover Report -----
app1: MySQL Master failover 192.168.1.103(192.168.1.103:3306) to192.168.1.104(192.168.1.104:3306) succeeded
Master 192.168.1.103(192.168.1.103:3306) is down!
Check MHA Manager logs at lab1:/etc/mha/manager.log for details.
Started automated(non-interactive) failover.
Invalidated master IP address on 192.168.1.103(192.168.1.103:3306)
Selected 192.168.1.104(192.168.1.104:3306) as a new master.
192.168.1.104(192.168.1.104:3306): OK: Applying all logssucceeded.
192.168.1.104(192.168.1.104:3306): OK: Activated master IPaddress.
192.168.1.104(192.168.1.104:3306): Resetting slave info succeeded.
Master failover to 192.168.1.104(192.168.1.104:3306) completedsuccessfully.
从日志中可以看到,master切换至192.168.1.104 slave上,并且VIP也随之绑定到192.168.1.104
对应的网卡设备上。
2.主库服务器当机
(1)把192.168.1.03与192.168.1.104复制关系重新建立:
change master to master_host='192.168.1.104',master_user='repl',master_password='111111',master_auto_position=1;
start slave;
(2)重新启动MHA:
nohup masterha_manager--conf=/etc/mha/app1.cnf < /dev/null >/etc/mha/app1.log 2>&1&
(3)直接关闭192.168.1.104服务器,查看切换情况:
Shutdown –h now
对应MHA manager日志:
Sun Aug 14 11:59:092016 - MHA::MasterMonitor version 0.56.
Sun Aug 14 11:59:092016 - GTID failover mode = 1
Sun Aug 14 11:59:092016 - Dead Servers:
Sun Aug 14 11:59:092016 - Alive Servers:
Sun Aug 14 11:59:092016 - 192.168.1.104(192.168.1.104:3306)
Sun Aug 14 11:59:092016 - 192.168.1.103(192.168.1.103:3306)
Sun Aug 14 11:59:092016 - Alive Slaves:
Sun Aug 14 11:59:092016 - 192.168.1.103(192.168.1.103:3306) Version=5.6.30-enterprise-commercial-advanced-log (oldest majorversion between slaves) log-bin:enabled
Sun Aug 14 11:59:092016 - GTID ON
Sun Aug 14 11:59:092016 - Replicating from192.168.1.104(192.168.1.104:3306)
Sun Aug 14 11:59:092016 - Primary candidate forthe new Master (candidate_master is set)
Sun Aug 14 11:59:092016 - Current Alive Master: 192.168.1.104(192.168.1.104:3306)
Sun Aug 14 11:59:092016 - Checking slave configurations..
Sun Aug 14 11:59:092016 - read_only=1 is not seton slave 192.168.1.103(192.168.1.103:3306).
Sun Aug 14 11:59:092016 - Checking replication filtering settings..
Sun Aug 14 11:59:092016 - binlog_do_db= ,binlog_ignore_db=
Sun Aug 14 11:59:092016 - Replication filteringcheck ok.
Sun Aug 14 11:59:092016 - GTID (with auto-pos) is supported. Skipping all SSH and Nodepackage checking.
Sun Aug 14 11:59:092016 - Checking SSH publickey authentication settings on the currentmaster..
Sun Aug 14 11:59:092016 - HealthCheck: SSH to 192.168.1.104 is reachable.
Sun Aug 14 11:59:092016 -
192.168.1.104(192.168.1.104:3306)(current master)
+--192.168.1.103(192.168.1.103:3306)
Sun Aug 14 11:59:092016 - Checking master_ip_failover_script status:
Sun Aug 14 11:59:092016 - /etc/mha/master_ip_failover --command=status --ssh_user=root--orig_master_host=192.168.1.104 --orig_master_ip=192.168.1.104--orig_master_port=3306
IN SCRIPT TEST====/sbin/ifconfigeth1:1 down==/sbin/ifconfig eth1:1 192.168.1.108;/sbin/arping -I eth1 -c 3 -s192.168.1.108 192.168.1.1 >/dev/null 2>&1===
Checking the Status ofthe script.. OK
Sun Aug 14 11:59:122016 - OK.
Sun Aug 14 11:59:122016 - shutdown_script is not defined.
Sun Aug 14 11:59:122016 - Set master ping interval 1 seconds.
Sun Aug 14 11:59:122016 - secondary_check_script is not defined. It is highlyrecommended setting it to check master reachability from two or more routes.
Sun Aug 14 11:59:122016 - Starting ping health check on192.168.1.104(192.168.1.104:3306)..
Sun Aug 14 11:59:122016 - Ping(SELECT) succeeded, waiting until MySQL doesn't respond..
Sun Aug 14 11:59:232016 - Got error on MySQL select ping: 2006 (MySQL server has goneaway)
Sun Aug 14 11:59:232016 - Executing SSH check script: exit 0
Sun Aug 14 11:59:232016 - HealthCheck: SSH to 192.168.1.104 is NOT reachable.
Sun Aug 14 11:59:242016 - Got error on MySQL connect: 2013 (Lost connection to MySQLserver at 'reading initial communication packet', system error: 111)
Sun Aug 14 11:59:242016 - Connection failed 2 time(s)..
Sun Aug 14 11:59:252016 - Got error on MySQL connect: 2013 (Lost connection to MySQLserver at 'reading initial communication packet', system error: 111)
Sun Aug 14 11:59:252016 - Connection failed 3 time(s)..
Sun Aug 14 11:59:262016 - Got error on MySQL connect: 2013 (Lost connection to MySQLserver at 'reading initial communication packet', system error: 111)
Sun Aug 14 11:59:262016 - Connection failed 4 time(s)..
Sun Aug 14 11:59:262016 - Master is not reachable from health checker!
Sun Aug 14 11:59:262016 - Master 192.168.1.104(192.168.1.104:3306) is not reachable!
Sun Aug 14 11:59:262016 - SSH is NOT reachable.
Sun Aug 14 11:59:262016 - Connecting to a master server failed. Reading configuration file/etc/masterha_default.cnf and /etc/mha/app1.cnf again, and trying to connectto all servers to check server status..
Sun Aug 14 11:59:262016 - Global configuration file /etc/masterha_default.cnf notfound. Skipping.
Sun Aug 14 11:59:262016 - Reading application default configuration from/etc/mha/app1.cnf..
Sun Aug 14 11:59:262016 - Reading server configuration from /etc/mha/app1.cnf..
Sun Aug 14 11:59:272016 - GTID failover mode = 1
Sun Aug 14 11:59:272016 - Dead Servers:
Sun Aug 14 11:59:272016 - 192.168.1.104(192.168.1.104:3306)
Sun Aug 14 11:59:272016 - Alive Servers:
Sun Aug 14 11:59:272016 - 192.168.1.103(192.168.1.103:3306)
Sun Aug 14 11:59:272016 - Alive Slaves:
Sun Aug 14 11:59:272016 - 192.168.1.103(192.168.1.103:3306) Version=5.6.30-enterprise-commercial-advanced-log (oldest majorversion between slaves) log-bin:enabled
Sun Aug 14 11:59:272016 - GTID ON
Sun Aug 14 11:59:272016 - Replicating from192.168.1.104(192.168.1.104:3306)
Sun Aug 14 11:59:272016 - Primary candidate forthe new Master (candidate_master is set)
Sun Aug 14 11:59:272016 - Checking slave configurations..
Sun Aug 14 11:59:272016 - read_only=1 is not seton slave 192.168.1.103(192.168.1.103:3306).
Sun Aug 14 11:59:272016 - Checking replication filtering settings..
Sun Aug 14 11:59:272016 - Replication filteringcheck ok.
Sun Aug 14 11:59:272016 - Master is down!
Sun Aug 14 11:59:272016 - Terminating monitoring script.
Sun Aug 14 11:59:272016 - Got exit code 20 (Master dead).
Sun Aug 14 11:59:272016 - MHA::MasterFailover version 0.56.
Sun Aug 14 11:59:272016 - Starting master failover.
Sun Aug 14 11:59:272016 -
Sun Aug 14 11:59:272016 - * Phase 1: Configuration Check Phase..
Sun Aug 14 11:59:272016 -
Sun Aug 14 11:59:272016 - GTID failover mode = 1
Sun Aug 14 11:59:272016 - Dead Servers:
Sun Aug 14 11:59:272016 - 192.168.1.104(192.168.1.104:3306)
Sun Aug 14 11:59:272016 - Checking master reachability via MySQL(double check)...
Sun Aug 14 11:59:282016 - ok.
Sun Aug 14 11:59:282016 - Alive Servers:
Sun Aug 14 11:59:282016 - 192.168.1.103(192.168.1.103:3306)
Sun Aug 14 11:59:282016 - Alive Slaves:
Sun Aug 14 11:59:282016 - 192.168.1.103(192.168.1.103:3306) Version=5.6.30-enterprise-commercial-advanced-log (oldest majorversion between slaves) log-bin:enabled
Sun Aug 14 11:59:282016 - GTID ON
Sun Aug 14 11:59:282016 - Replicating from192.168.1.104(192.168.1.104:3306)
Sun Aug 14 11:59:282016 - Primary candidate forthe new Master (candidate_master is set)
Sun Aug 14 11:59:282016 - Starting GTID based failover.
Sun Aug 14 11:59:282016 -
Sun Aug 14 11:59:282016 - ** Phase 1: Configuration Check Phase completed.
Sun Aug 14 11:59:282016 -
Sun Aug 14 11:59:282016 - * Phase 2: Dead Master Shutdown Phase..
Sun Aug 14 11:59:282016 -
Sun Aug 14 11:59:282016 - Forcing shutdown so that applications never connect to thecurrent master..
Sun Aug 14 11:59:282016 - Executing master IP deactivation script:
Sun Aug 14 11:59:282016 - /etc/mha/master_ip_failover --orig_master_host=192.168.1.104--orig_master_ip=192.168.1.104 --orig_master_port=3306 --command=stop
IN SCRIPTTEST====/sbin/ifconfig eth1:1 down==/sbin/ifconfig eth1:1 192.168.1.108;/sbin/arping-I eth1 -c 3 -s 192.168.1.108 192.168.1.1 >/dev/null 2>&1===
Disabling the VIP onold master if the server is still UP: 192.168.1.104
Sun Aug 14 11:59:342016 - done.
Sun Aug 14 11:59:342016 - shutdown_script is not set. Skipping explicit shutting downof the dead master.
Sun Aug 14 11:59:342016 - * Phase 2: Dead Master Shutdown Phase completed.
Sun Aug 14 11:59:342016 -
Sun Aug 14 11:59:342016 - * Phase 3: Master Recovery Phase..
Sun Aug 14 11:59:342016 -
Sun Aug 14 11:59:342016 - * Phase 3.1: Getting Latest Slaves Phase..
Sun Aug 14 11:59:342016 -
Sun Aug 14 11:59:342016 - The latest binary log file/position on all slaves isbin.000015:231
Sun Aug 14 11:59:342016 - Latest slaves (Slaves that received>
Sun Aug 14 11:59:342016 - 192.168.1.103(192.168.1.103:3306) Version=5.6.30-enterprise-commercial-advanced-log (oldest majorversion between slaves) log-bin:enabled
Sun Aug 14 11:59:342016 - GTID ON
Sun Aug 14 11:59:342016 - Replicating from192.168.1.104(192.168.1.104:3306)
Sun Aug 14 11:59:342016 - Primary candidate forthe new Master (candidate_master is set)
Sun Aug 14 11:59:342016 - The oldest binary log file/position on all slaves isbin.000015:231
Sun Aug 14 11:59:342016 - Oldest slaves:
Sun Aug 14 11:59:342016 - 192.168.1.103(192.168.1.103:3306) Version=5.6.30-enterprise-commercial-advanced-log (oldest majorversion between slaves) log-bin:enabled
Sun Aug 14 11:59:342016 - GTID ON
Sun Aug 14 11:59:342016 - Replicating from192.168.1.104(192.168.1.104:3306)
Sun Aug 14 11:59:342016 - Primary candidate forthe new Master (candidate_master is set)
Sun Aug 14 11:59:342016 -
Sun Aug 14 11:59:342016 - * Phase 3.3: Determining New Master Phase..
Sun Aug 14 11:59:342016 -
Sun Aug 14 11:59:342016 - Searching new master from slaves..
Sun Aug 14 11:59:342016 - Candidate masters fromthe configuration file:
Sun Aug 14 11:59:342016 - 192.168.1.103(192.168.1.103:3306) Version=5.6.30-enterprise-commercial-advanced-log (oldest majorversion between slaves) log-bin:enabled
Sun Aug 14 11:59:342016 - GTID ON
Sun Aug 14 11:59:342016 - Replicating from192.168.1.104(192.168.1.104:3306)
Sun Aug 14 11:59:342016 - Primary candidate forthe new Master (candidate_master is set)
Sun Aug 14 11:59:342016 - Non-candidate masters:
Sun Aug 14 11:59:342016 - Searching fromcandidate_master slaves which have received the latest>
Sun Aug 14 11:59:342016 - New master is 192.168.1.103(192.168.1.103:3306)
Sun Aug 14 11:59:34 2016- Starting master failover..
Sun Aug 14 11:59:342016 -
From:
192.168.1.104(192.168.1.104:3306)(current master)
+--192.168.1.103(192.168.1.103:3306)
To:
192.168.1.103(192.168.1.103:3306)(new master)
Sun Aug 14 11:59:342016 -
Sun Aug 14 11:59:342016 - * Phase 3.3: New Master Recovery Phase..
Sun Aug 14 11:59:342016 -
Sun Aug 14 11:59:342016 - Waiting all logs to beapplied..
Sun Aug 14 11:59:342016 - done.
Sun Aug 14 11:59:342016 - Getting new master's binlog name and position..
Sun Aug 14 11:59:342016 - bin.000015:231
Sun Aug 14 11:59:342016 - All other slaves shouldstart replication from here. Statement should be: CHANGE MASTER TOMASTER_HOST='192.168.1.103', MASTER_PORT=3306, MASTER_AUTO_POSITION=1,MASTER_USER='repl', MASTER_PASSWORD='xxx';
Sun Aug 14 11:59:342016 - Master Recovery succeeded. File:Pos:Exec_Gtid_Set: bin.000015,231, 1683955a-6102-11e6-8b6f-080027ca1592:1-8,
1c3a7f53-6102-11e6-8b6f-08002722cc6d:1-10
Sun Aug 14 11:59:342016 - Executing master IP activate script:
Sun Aug 14 11:59:342016 - /etc/mha/master_ip_failover --command=start --ssh_user=root--orig_master_host=192.168.1.104 --orig_master_ip=192.168.1.104--orig_master_port=3306 --new_master_host=192.168.1.103--new_master_ip=192.168.1.103 --new_master_port=3306 --new_master_user='root'--new_master_password='111111'
IN SCRIPTTEST====/sbin/ifconfig eth1:1 down==/sbin/ifconfig eth1:1192.168.1.108;/sbin/arping -I eth1 -c 3 -s 192.168.1.108 192.168.1.1>/dev/null 2>&1===
Enabling theVIP - 192.168.1.108 on the new master - 192.168.1.103
Sun Aug 14 11:59:372016 - OK.
Sun Aug 14 11:59:372016 - ** Finished master recovery successfully.
Sun Aug 14 11:59:372016 - * Phase 3: Master Recovery Phase completed.
Sun Aug 14 11:59:372016 -
Sun Aug 14 11:59:372016 - * Phase 4: Slaves Recovery Phase..
Sun Aug 14 11:59:372016 -
Sun Aug 14 11:59:372016 -
Sun Aug 14 11:59:372016 - * Phase 4.1: Starting Slaves in parallel..
Sun Aug 14 11:59:372016 -
Sun Aug 14 11:59:372016 - All new slave servers recovered successfully.
Sun Aug 14 11:59:372016 -
Sun Aug 14 11:59:372016 - * Phase 5: New master cleanup phase..
Sun Aug 14 11:59:372016 -
Sun Aug 14 11:59:372016 - Resetting slave info on the new master..
Sun Aug 14 11:59:372016 - 192.168.1.103: Resettingslave info succeeded.
Sun Aug 14 11:59:372016 - Master failover to 192.168.1.103(192.168.1.103:3306) completedsuccessfully.
Sun Aug 14 11:59:372016 -
-----Failover Report -----
app1: MySQLMaster failover 192.168.1.104(192.168.1.104:3306) to192.168.1.103(192.168.1.103:3306) succeeded
Master192.168.1.104(192.168.1.104:3306) is down!
Check MHAManager logs at lab1:/etc/mha/manager.log for details.
Startedautomated(non-interactive) failover.
Invalidatedmaster IP address on 192.168.1.104(192.168.1.104:3306)
Selected192.168.1.103(192.168.1.103:3306) as a new master.
192.168.1.103(192.168.1.103:3306):OK: Applying all logs succeeded.
192.168.1.103(192.168.1.103:3306):OK: Activated master IP address.
192.168.1.103(192.168.1.103:3306):Resetting slave info succeeded.
Masterfailover to 192.168.1.103(192.168.1.103:3306) completed successfully.
可以看到Master已经切换至192.168.1.103 上,VIP也绑定至192.168.1.103上。
页:
[1]