MHA自动切换步骤及过程剖析(八)

2015-11-21 01:45:19 · 作者: · 浏览: 32
及决定新的master Mon Apr 20 14:30:24 2015 - [info] Candidate masters from the configuration file: Mon Apr 20 14:30:24 2015 - [info] Non-candidate masters: Mon Apr 20 14:30:24 2015 - [info] New master is vdbsrv2(192.168.1.7:3306) Mon Apr 20 14:30:24 2015 - [info] Starting master failover.. ###执行failover Mon Apr 20 14:30:24 2015 - [info] From: vdbsrv1(192.168.1.6:3306) (current master) +--vdbsrv2(192.168.1.7:3306) +--vdbsrv3(192.168.1.8:3306) To: vdbsrv2(192.168.1.7:3306) (new master) +--vdbsrv3(192.168.1.8:3306) Mon Apr 20 14:30:24 2015 - [info] Mon Apr 20 14:30:24 2015 - [info] * Phase 3.3: New Master Diff Log Generation Phase.. Mon Apr 20 14:30:24 2015 - [info] Mon Apr 20 14:30:24 2015 - [info] This server has all relay logs. No need to generate diff files from the latest slave. Mon Apr 20 14:30:24 2015 - [info] Sending binlog.. Mon Apr 20 14:30:25 2015 - [info] scp from local:/var/log/masterha/app1/saved_master_binlog_from_vdbsrv1_3306_20150420143022.binlog to root@vdbsrv2:/var/tmp/saved_master_binlog_from_vdbsrv1_3306_20150420143022.binlog succeeded. Mon Apr 20 14:30:25 2015 - [info] Mon Apr 20 14:30:25 2015 - [info] * Phase 3.4: Master Log Apply Phase.. Mon Apr 20 14:30:25 2015 - [info] Mon Apr 20 14:30:25 2015 - [info] *NOTICE: If any error happens from this phase, manual recovery is needed. Mon Apr 20 14:30:25 2015 - [info] Starting recovery on vdbsrv2(192.168.1.7:3306).. Mon Apr 20 14:30:25 2015 - [info] Generating diffs succeeded. Mon Apr 20 14:30:25 2015 - [info] Waiting until all relay logs are applied. Mon Apr 20 14:30:36 2015 - [info] done. Mon Apr 20 14:30:36 2015 - [info] Getting slave status.. Mon Apr 20 14:30:36 2
015 - [info] This slave(vdbsrv2)'s Exec_Master_Log_Pos equals to Read_Master_Log_Pos(mysql-bin.000020:315514388). No need to recover from Exec_Master_Log_Pos. Mon Apr 20 14:30:36 2015 - [info] Connecting to the target slave host vdbsrv2, running recover script.. ###基于新主库Apply差量日志 Mon Apr 20 14:30:36 2015 - [info] Executing command: apply_diff_relay_logs --command=apply --slave_user='mha' --slave_host=vdbsrv2 --slave_ip=192.168.1.7 --slave_port=3306 --apply_files=/var/tmp/saved_master_binlog_from_vdbsrv1_3306_20150420143022.binlog --workdir=/var/tmp --target_version=5.6.22-log --timestamp=20150420143022 --handle_raw_binlog=1 --disable_log_bin=0 --manager_version=0.56 --slave_pass=xxx Mon Apr 20 14:30:36 2015 - [info] Applying differential binary/relay log files /var/tmp/saved_master_binlog_from_vdbsrv1_3306_20150420143022.binlog on vdbsrv2:3306. This may take long time... Applying log files succeeded. Mon Apr 20 14:30:36 2015 - [info] All relay logs were successfully applied. Mon Apr 20 14:30:36 2015 - [info] Getting new master's binlog name and position.. Mon Apr 20 14:30:36 2015 - [info] mysql-bin.000011:241926689 Mon Apr 20 14:30:36 2015 - [info] All other slaves should start replication from here. Statement should be: CHANGE MASTER TO MASTER_HOST='vdbsrv2 or 192.168.1.7', MASTER_PORT=3306, MASTER_LOG_FILE='mysql-bin.000011', MASTER_LOG_POS=241926689, MASTER_USER='repl', MASTER_PASSWORD='xxx'; Mon Apr 20 14:30:36 2015 - [info] Executing master IP activate script: ###IP漂移 Mon Apr 20 14:30:36 2015 - [info] /tmp/master_ip_failover --command=start --ssh_user=root --orig_master_host=vdbsrv1 --orig_master_ip=192.168.1.6 --orig_master_por