[[email protected] mha]#masterha_master_switch--master_state = alive--conf = /etc/mha / app1.cnf--new_master_host = MHA - S1--new_master_port = 3306--orig_master_is_new_slave Fri Sep 1 17 : 00 : 14 2017 - [info] MHA: :MasterRotate version 0.57.Fri Sep 1 17 : 00 : 14 2017 - [info] Starting online master
switch..Fri Sep 1 17 : 00 : 14 2017 - [info] Fri Sep 1 17 : 00 : 14 2017 - [info] * Phase 1 : Configuration Check Phase..Fri Sep 1 17 : 00 : 14 2017 - [info] Fri Sep 1 17 : 00 : 14 2017 - [warning] Global configuration file / etc / masterha_default.cnf not found.Skipping.Fri Sep 1 17 : 00 : 14 2017 - [info] Reading application
default configuration from / etc / mha / app1.cnf..Fri Sep 1 17 : 00 : 14 2017 - [info] Reading server configuration from / etc / mha / app1.cnf..Fri Sep 1 17 : 00 : 14 2017 - [info] GTID failover mode = 1 Fri Sep 1 17 : 00 : 14 2017 - [info] Current Alive Master: MHA - M1(10.180.2.163 : 3306) Fri Sep 1 17 : 00 : 14 2017 - [info] Alive Slaves: Fri Sep 1 17 : 00 : 14 2017 - [info] MHA - S1(10.180.2.164 : 3306) Version = 5.7.18 - log(oldest major version between slaves) log - bin: enabled Fri Sep 1 17 : 00 : 14 2017 - [info] GTID ON Fri Sep 1 17 : 00 : 14 2017 - [info] Replicating from MHA - M1(10.180.2.163 : 3306) Fri Sep 1 17 : 00 : 14 2017 - [info] Primary candidate
for the new Master(candidate_master is set) Fri Sep 1 17 : 00 : 14 2017 - [info] MHA - S2(10.180.2.165 : 3306) Version = 5.7.18 - log(oldest major version between slaves) log - bin: enabled Fri Sep 1 17 : 00 : 14 2017 - [info] GTID ON Fri Sep 1 17 : 00 : 14 2017 - [info] Replicating from MHA - M1(10.180.2.163 : 3306)
It is better to execute FLUSH NO_WRITE_TO_BINLOG TABLES on the master before switching.Is it ok to execute on MHA - M1(10.180.2.163 : 3306) ? (YES / no) : yes Fri Sep 1 17 : 00 : 46 2017 - [info] Executing FLUSH NO_WRITE_TO_BINLOG TABLES.This may take long time..Fri Sep 1 17 : 00 : 46 2017 - [info] ok.Fri Sep 1 17 : 00 : 46 2017 - [info] Checking MHA is not monitoring or doing failover..Fri Sep 1 17 : 00 : 46 2017 - [info] Checking replication health on MHA - S1..Fri Sep 1 17 : 00 : 46 2017 - [info] ok.Fri Sep 1 17 : 00 : 46 2017 - [info] Checking replication health on MHA - S2..Fri Sep 1 17 : 00 : 46 2017 - [info] ok.Fri Sep 1 17 : 00 : 46 2017 - [info] MHA - S1 can be new master.Fri Sep 1 17 : 00 : 46 2017 - [info] From: MHA - M1(10.180.2.163 : 3306)(current master) + --MHA - S1(10.180.2.164 : 3306) + --MHA - S2(10.180.2.165 : 3306)
To: MHA - S1(10.180.2.164 : 3306)(new master) + --MHA - S2(10.180.2.165 : 3306) + --MHA - M1(10.180.2.163 : 3306)
Starting master
switch from MHA - M1(10.180.2.163 : 3306) to MHA - S1(10.180.2.164 : 3306) ? (yes / NO) : yes Fri Sep 1 17 : 00 : 59 2017 - [info] Checking whether MHA - S1(10.180.2.164 : 3306) is ok
for the new master..Fri Sep 1 17 : 00 : 59 2017 - [info] ok.Fri Sep 1 17 : 00 : 59 2017 - [info] MHA - M1(10.180.2.163 : 3306) : SHOW SLAVE STATUS returned empty result.To check replication filtering rules,
temporarily executing CHANGE MASTER to a dummy host.Fri Sep 1 17 : 00 : 59 2017 - [info] MHA - M1(10.180.2.163 : 3306) : Resetting slave pointing to the dummy host.Fri Sep 1 17 : 00 : 59 2017 - [info] * *Phase 1 : Configuration Check Phase completed.Fri Sep 1 17 : 00 : 59 2017 - [info] Fri Sep 1 17 : 00 : 59 2017 - [info] * Phase 2 : Rejecting updates Phase..Fri Sep 1 17 : 00 : 59 2017 - [info] Fri Sep 1 17 : 00 : 59 2017 - [info] Executing master ip online change script to disable write on the current master: Fri Sep 1 17 : 00 : 59 2017 - [info] / usr / local / bin / master_ip_online_change--command = stop--orig_master_host = MHA - M1--orig_master_ip = 10.180.2.163--orig_master_port = 3306--orig_master_user = ‘root‘--new_master_host = MHA - S1--new_master_ip = 10.180.2.164--new_master_port = 3306--new_master_user = ‘root‘--orig_master_ssh_user = root--new_master_ssh_user = root--orig_master_is_new_slave--orig_master_password = xxx--new_master_password = xxx Unknown option: orig_master_ssh_user Unknown option: new_master_ssh_user Unknown option: orig_master_is_new_slave Unknown option: orig_master_password Unknown option: new_master_password Fri Sep 1 17 : 00 : 59 2017 957805 Set read_only on the new master..ok.Fri Sep 1 17 : 00 : 59 2017 963583 Waiting all running 2 threads are disconnected.. (max 1500 milliseconds) {‘Time‘ = >‘1711541‘,
‘Command‘ = >‘Binlog Dump GTID‘,
‘db‘ = >undef,
‘Id‘ = >‘16‘,
‘Info‘ = >undef,
‘User‘ = >‘repl‘,
‘State‘ = >‘Master has sent all binlog to slave;
waiting
for more updates‘,
‘Host‘ = >‘MHA - S2: 44384‘
} {‘Time‘ = >‘1711541‘,
‘Command‘ = >‘Binlog Dump GTID‘,
‘db‘ = >undef,
‘Id‘ = >‘17‘,
‘Info‘ = >undef,
‘User‘ = >‘repl‘,
‘State‘ = >‘Master has sent all binlog to slave;
waiting
for more updates‘,
‘Host‘ = >‘MHA - S1: 52664‘
}
Fri Sep 1 17 : 01 : 00 2017 464591 Waiting all running 3 threads are disconnected.. (max 1000 milliseconds) {‘Time‘ = >‘1711542‘,
‘Command‘ = >‘Binlog Dump GTID‘,
‘db‘ = >undef,
‘Id‘ = >‘16‘,
‘Info‘ = >undef,
‘User‘ = >‘repl‘,
‘State‘ = >‘Master has sent all binlog to slave;
waiting
for more updates‘,
‘Host‘ = >‘MHA - S2: 44384‘
} {‘Time‘ = >‘1711542‘,
‘Command‘ = >‘Binlog Dump GTID‘,
‘db‘ = >undef,
‘Id‘ = >‘17‘,
‘Info‘ = >undef,
‘User‘ = >‘repl‘,
‘State‘ = >‘Master has sent all binlog to slave;
waiting
for more updates‘,
‘Host‘ = >‘MHA - S1: 52664‘
} {‘Time‘ = >‘0‘,
‘Command‘ = >‘Sleep‘,
‘db‘ = >undef,
‘Id‘ = >‘1418‘,
‘Info‘ = >undef,
‘User‘ = >‘proxysql‘,
‘State‘ = >‘‘,
‘Host‘ = >‘10.180.3.1 : 58934‘
}
Fri Sep 1 17 : 01 : 00 2017 966039 Waiting all running 3 threads are disconnected.. (max 500 milliseconds) {‘Time‘ = >‘1711542‘,
‘Command‘ = >‘Binlog Dump GTID‘,
‘db‘ = >undef,
‘Id‘ = >‘16‘,
‘Info‘ = >undef,
‘User‘ = >‘repl‘,
‘State‘ = >‘Master has sent all binlog to slave;
waiting
for more updates‘,
‘Host‘ = >‘MHA - S2: 44384‘
} {‘Time‘ = >‘1711542‘,
‘Command‘ = >‘Binlog Dump GTID‘,
‘db‘ = >undef,
‘Id‘ = >‘17‘,
‘Info‘ = >undef,
‘User‘ = >‘repl‘,
‘State‘ = >‘Master has sent all binlog to slave;
waiting
for more updates‘,
‘Host‘ = >‘MHA - S1: 52664‘
} {‘Time‘ = >‘0‘,
‘Command‘ = >‘Sleep‘,
‘db‘ = >undef,
‘Id‘ = >‘1418‘,
‘Info‘ = >undef,
‘User‘ = >‘proxysql‘,
‘State‘ = >‘‘,
‘Host‘ = >‘10.180.3.1 : 58934‘
}
Fri Sep 1 17 : 01 : 01 2017 466934 Set read_only = 1 on the orig master..ok.Fri Sep 1 17 : 01 : 01 2017 469136 Waiting all running 2 queries are disconnected.. (max 500 milliseconds) {‘Time‘ = >‘1711543‘,
‘Command‘ = >‘Binlog Dump GTID‘,
‘db‘ = >undef,
‘Id‘ = >‘16‘,
‘Info‘ = >undef,
‘User‘ = >‘repl‘,
‘State‘ = >‘Master has sent all binlog to slave;
waiting
for more updates‘,
‘Host‘ = >‘MHA - S2: 44384‘
} {‘Time‘ = >‘1711543‘,
‘Command‘ = >‘Binlog Dump GTID‘,
‘db‘ = >undef,
‘Id‘ = >‘17‘,
‘Info‘ = >undef,
‘User‘ = >‘repl‘,
‘State‘ = >‘Master has sent all binlog to slave;
waiting
for more updates‘,
‘Host‘ = >‘MHA - S1: 52664‘
}
Disabling the VIP on old master: MHA - M1 Fri Sep 1 17 : 01 : 02 2017 091930 Killing all application threads..Fri Sep 1 17 : 01 : 02 2017 093785 done.Fri Sep 1 17 : 01 : 02 2017 - [info] ok.Fri Sep 1 17 : 01 : 02 2017 - [info] Locking all tables on the orig master to reject updates from everybody(including root) : Fri Sep 1 17 : 01 : 02 2017 - [info] Executing FLUSH TABLES WITH READ LOCK..Fri Sep 1 17 : 01 : 02 2017 - [info] ok.Fri Sep 1 17 : 01 : 02 2017 - [info] Orig master binlog: pos is 3306 - binlog.000005 : 3916.Fri Sep 1 17 : 01 : 02 2017 - [info] Waiting to execute all relay logs on MHA - S1(10.180.2.164 : 3306)..Fri Sep 1 17 : 01 : 02 2017 - [info] master_pos_wait(3306 - binlog.000005 : 3916) completed on MHA - S1(10.180.2.164 : 3306).Executed 0 events.Fri Sep 1 17 : 01 : 02 2017 - [info] done.Fri Sep 1 17 : 01 : 02 2017 - [info] Getting new master‘s binlog name and position..Fri Sep 1 17 : 01 : 02 2017 - [info] 3306 - binlog.000003 : 61948637 Fri Sep 1 17 : 01 : 02 2017 - [info] All other slaves should start replication from here.Statement should be: CHANGE MASTER TO MASTER_HOST = ‘MHA - S1 or 10.180.2.164‘,
MASTER_PORT = 3306,
MASTER_AUTO_POSITION = 1,
MASTER_USER = ‘repl‘,
MASTER_PASSWORD = ‘xxx‘;
Fri Sep 1 17 : 01 : 02 2017 - [info] Executing master ip online change script to allow write on the new master: Fri Sep 1 17 : 01 : 02 2017 - [info] / usr / local / bin / master_ip_online_change--command = start--orig_master_host = MHA - M1--orig_master_ip = 10.180.2.163--orig_master_port = 3306--orig_master_user = ‘root‘--new_master_host = MHA - S1--new_master_ip = 10.180.2.164--new_master_port = 3306--new_master_user = ‘root‘--orig_master_ssh_user = root--new_master_ssh_user = root--orig_master_is_new_slave--orig_master_password = xxx--new_master_password = xxx Unknown option: orig_master_ssh_user Unknown option: new_master_ssh_user Unknown option: orig_master_is_new_slave Unknown option: orig_master_password Unknown option: new_master_password Fri Sep 1 17 : 01 : 02 2017 282150 Set read_only = 0 on the new master.Enabling the VIP - 10.180.2.168 / 19 on the new master - MHA - S1 Fri Sep 1 17 : 01 : 02 2017 - [info] ok.Fri Sep 1 17 : 01 : 02 2017 - [info] Fri Sep 1 17 : 01 : 02 2017 - [info] * Switching slaves in parallel..Fri Sep 1 17 : 01 : 02 2017 - [info] Fri Sep 1 17 : 01 : 02 2017 - [info]--Slave
switch on host MHA - S2(10.180.2.165 : 3306) started,
pid: 7360 Fri Sep 1 17 : 01 : 02 2017 - [info] Fri Sep 1 17 : 01 : 03 2017 - [info] Log messages from MHA - S2...Fri Sep 1 17 : 01 : 03 2017 - [info] Fri Sep 1 17 : 01 : 02 2017 - [info] Waiting to execute all relay logs on MHA - S2(10.180.2.165 : 3306)..Fri Sep 1 17 : 01 : 02 2017 - [info] master_pos_wait(3306 - binlog.000005 : 3916) completed on MHA - S2(10.180.2.165 : 3306).Executed 0 events.Fri Sep 1 17 : 01 : 02 2017 - [info] done.Fri Sep 1 17 : 01 : 02 2017 - [info] Resetting slave MHA - S2(10.180.2.165 : 3306) and starting replication from the new master MHA - S1(10.180.2.164 : 3306)..Fri Sep 1 17 : 01 : 02 2017 - [info] Executed CHANGE MASTER.Fri Sep 1 17 : 01 : 03 2017 - [info] Slave started.Fri Sep 1 17 : 01 : 03 2017 - [info] End of log messages from MHA - S2...Fri Sep 1 17 : 01 : 03 2017 - [info] Fri Sep 1 17 : 01 : 03 2017 - [info]--Slave
switch on host MHA - S2(10.180.2.165 : 3306) succeeded.Fri Sep 1 17 : 01 : 03 2017 - [info] Unlocking all tables on the orig master: Fri Sep 1 17 : 01 : 03 2017 - [info] Executing UNLOCK TABLES..Fri Sep 1 17 : 01 : 03 2017 - [info] ok.Fri Sep 1 17 : 01 : 03 2017 - [info] Starting orig master as a new slave..Fri Sep 1 17 : 01 : 03 2017 - [info] Resetting slave MHA - M1(10.180.2.163 : 3306) and starting replication from the new master MHA - S1(10.180.2.164 : 3306)..Fri Sep 1 17 : 01 : 03 2017 - [info] Executed CHANGE MASTER.Fri Sep 1 17 : 01 : 04 2017 - [info] Slave started.Fri Sep 1 17 : 01 : 04 2017 - [info] All new slave servers switched successfully.Fri Sep 1 17 : 01 : 04 2017 - [info] Fri Sep 1 17 : 01 : 04 2017 - [info] * Phase 5 : New master cleanup phase..Fri Sep 1 17 : 01 : 04 2017 - [info] Fri Sep 1 17 : 01 : 04 2017 - [info] MHA - S1: Resetting slave info succeeded.Fri Sep 1 17 : 01 : 04 2017 - [info] Switching master to MHA - S1(10.180.2.164 : 3306) completed successfully.
来源: http://www.bubuko.com/infodetail-2287045.html