标签:
好久没有写技术博客了, 这几天重新把《高可用mysql》 这本书捡起来看一遍,里面提到了用https://launchpad.net/mysql-replicant-python 来提供自动主备复制 , 由此想到了之前看中国数据库技术大会中提到的mysql-master-ha来提供master的高可用方案,在测试集群上做了一下测试。
测试环境:
OS: centos 6.5
mysql: 5.6.27-log
mysql-master-ha: 0.56
和https://code.google.com/p/mysql-master-ha/wiki/TableOfContents?tm=6提供的文档一样,采用了如下mysql测试拓扑结构:
MySQL master(一台 )
mysql slave (2 台 )
mysql-master-ha-manager(一台 )
在所有机器上安装 mysql-master-ha node 节点,安装mysql-master-ha node manager; 安装方法参考这里: https://code.google.com/p/mysql-master-ha/wiki/Tutorial
配置好mysql master 到 MySQL slave 的主从复制关系以后,我们在manger节点启动 masterha_manager
masterha_manager --conf=./app1.conf
然后我们在master节点上killall -9 mysqld mysqld_safe把master杀掉, 观察manager节点上的日志输出 , 来理解mysql-master-ha 是如何做mysql master的高可用的:
[root@server9 mysql-master-ha-conf]# masterha_manager --conf=./app1.conf
Tue Nov 10 10:49:40 2015 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Tue Nov 10 10:49:40 2015 - [info] Reading application default configuration from ./app1.conf..
Tue Nov 10 10:49:40 2015 - [info] Reading server configuration from ./app1.conf..
Tue Nov 10 10:49:40 2015 - [info] MHA::MasterMonitor version 0.56.
Tue Nov 10 10:49:40 2015 - [info] GTID failover mode = 0
1\发现old master不可用。
Tue Nov 10 10:49:40 2015 - [info] Dead Servers:
Tue Nov 10 10:49:40 2015 - [info] server7(server7:3307)
Tue Nov 10 10:49:40 2015 - [info] Alive Servers:
Tue Nov 10 10:49:40 2015 - [info] server6(server6:3307)
Tue Nov 10 10:49:40 2015 - [info] server8(server8:3307)
Tue Nov 10 10:49:40 2015 - [info] Alive Slaves:
Tue Nov 10 10:49:40 2015 - [info] server6(server6:3307) Version=5.6.27-log (oldest major version between slaves) log-bin:enabled
Tue Nov 10 10:49:40 2015 - [info] Replicating from server7(server7:3307)
Tue Nov 10 10:49:40 2015 - [info] server8(server8:3307) Version=5.6.27-log (oldest major version between slaves) log-bin:enabled
Tue Nov 10 10:49:40 2015 - [info] Replicating from server7(server7:3307)
Tue Nov 10 10:49:40 2015 - [warning] MySQL master is not currently alive!
2\检查slave配置, 检查master 的ssh连通性,检查master binlog备份脚本的有效性。
检查slave 的ssh联通性: 进入slave检查relay-log 的apply_diff_relay_logs脚本:
Tue Nov 10 10:49:40 2015 - [info] Checking slave configurations..
Tue Nov 10 10:49:40 2015 - [info] read_only=1 is not set on slave server6(server6:3307).
Tue Nov 10 10:49:40 2015 - [warning] relay_log_purge=0 is not set on slave server6(server6:3307).
Tue Nov 10 10:49:40 2015 - [info] read_only=1 is not set on slave server8(server8:3307).
Tue Nov 10 10:49:40 2015 - [info] Checking replication filtering settings..
Tue Nov 10 10:49:40 2015 - [info] Replication filtering check ok.
Tue Nov 10 10:49:40 2015 - [info] GTID (with auto-pos) is not supported
Tue Nov 10 10:49:40 2015 - [info] Starting SSH connection tests..
Tue Nov 10 10:49:41 2015 - [info] All SSH connection tests passed successfully.
Tue Nov 10 10:49:41 2015 - [info] Checking MHA Node version..
Tue Nov 10 10:49:42 2015 - [info] Version check ok.
Tue Nov 10 10:49:42 2015 - [info] Getting current master (maybe dead) info ..
Tue Nov 10 10:49:42 2015 - [info] Identified master is server7(server7:3307).
Tue Nov 10 10:49:42 2015 - [info] Checking SSH publickey authentication settings on the current master..
Tue Nov 10 10:49:42 2015 - [info] HealthCheck: SSH to server7 is reachable.
Tue Nov 10 10:49:43 2015 - [info] Master MHA Node version is 0.56.
Tue Nov 10 10:49:43 2015 - [info] Checking recovery script configurations on server7(server7:3307)..
Tue Nov 10 10:49:43 2015 - [info] Executing command: save_binary_logs --command=test --start_pos=4 --binlog_dir=/var/lib/mysql,/var/log/mysql --output_file=/var/log/masterha/app1/save_binary_logs_test --manager_version=0.56 --start_file=master-bin.000004
Tue Nov 10 10:49:43 2015 - [info] Connecting to root@server7(server7:22)..
Creating /var/log/masterha/app1 if not exists.. ok.
Checking output directory is accessible or not..
ok.
Binlog found at /var/lib/mysql, up to master-bin.000004
Tue Nov 10 10:49:43 2015 - [info] Binlog setting check done.
Tue Nov 10 10:49:43 2015 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..
Tue Nov 10 10:49:43 2015 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user=‘root‘ --slave_host=server6 --slave_ip=server6 --slave_port=3307 --workdir=/var/log/masterha/app1 --target_version=5.6.27-log --manager_version=0.56 --relay_log_info=/var/lib/mysql/relay-log.info --relay_dir=/var/lib/mysql/ --slave_pass=xxx
Tue Nov 10 10:49:43 2015 - [info] Connecting to root@server6(server6:22)..
Checking slave recovery environment settings..
Opening /var/lib/mysql/relay-log.info ... ok.
Relay log found at /var/lib/mysql, up to mysqld-relay-bin.000007
Temporary relay log file is /var/lib/mysql/mysqld-relay-bin.000007
Testing mysql connection and privileges..Warning: Using a password on the command line interface can be insecure.
done.
Testing mysqlbinlog output.. done.
Cleaning up test file(s).. done.
Tue Nov 10 10:49:43 2015 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user=‘root‘ --slave_host=server8 --slave_ip=server8 --slave_port=3307 --workdir=/var/log/masterha/app1 --target_version=5.6.27-log --manager_version=0.56 --relay_log_info=/var/lib/mysql/relay-log.info --relay_dir=/var/lib/mysql/ --slave_pass=xxx
Tue Nov 10 10:49:43 2015 - [info] Connecting to root@server8(server8:22)..
Checking slave recovery environment settings..
Opening /var/lib/mysql/relay-log.info ... ok.
Relay log found at /var/lib/mysql, up to slave-relay-bin.000004
Temporary relay log file is /var/lib/mysql/slave-relay-bin.000004
Testing mysql connection and privileges..Warning: Using a password on the command line interface can be insecure.
done.
Testing mysqlbinlog output.. done.
Cleaning up test file(s).. done.
Tue Nov 10 10:49:44 2015 - [info] Slaves settings check done.
Tue Nov 10 10:49:44 2015 - [info]
server7(server7:3307) (current master)
+--server6(server6:3307)
+--server8(server8:3307)
3、确认 old master的mysql不可到达 (ping 3307端口不可用, 建议设置二级检查, 从
多个路由确认old master不可到达。), 连续多次ping old master的3307端口不可到达以后,
准备启动master failover;
----
Tue Nov 10 10:49:44 2015 - [warning] master_ip_failover_script is not defined.
Tue Nov 10 10:49:44 2015 - [warning] shutdown_script is not defined.
Tue Nov 10 10:49:44 2015 - [error][/usr/local/share/perl5/MHA/Server.pm, ln457] Checking slave status failed on server6(server6:3307). err=Got error when executing SHOW SLAVE STATUS. MySQL server has gone away
Tue Nov 10 10:49:44 2015 - [info] Set master ping interval 3 seconds.
Tue Nov 10 10:49:44 2015 - [warning] secondary_check_script is not defined. It is highly recommended setting it to check master reachability from two or more routes.
Tue Nov 10 10:49:44 2015 - [info] Starting ping health check on server7(server7:3307)..
Tue Nov 10 10:49:44 2015 - [warning] Got error on MySQL connect: 2013 (Lost connection to MySQL server at ‘reading initial communication packet‘, system error: 111)
Tue Nov 10 10:49:44 2015 - [warning] Connection failed 1 time(s)..
Tue Nov 10 10:49:44 2015 - [info] Executing SSH check script: save_binary_logs --command=test --start_pos=4 --binlog_dir=/var/lib/mysql,/var/log/mysql --output_file=/var/log/masterha/app1/save_binary_logs_test --manager_version=0.56 --binlog_prefix=master-bin
Creating /var/log/masterha/app1 if not exists.. ok.
Checking output directory is accessible or not..
ok.
Binlog found at /var/lib/mysql, up to master-bin.000004
Tue Nov 10 10:49:44 2015 - [info] HealthCheck: SSH to server7 is reachable.
Tue Nov 10 10:49:47 2015 - [warning] Got error on MySQL connect: 2013 (Lost connection to MySQL server at ‘reading initial communication packet‘, system error: 111)
Tue Nov 10 10:49:47 2015 - [warning] Connection failed 2 time(s)..
Tue Nov 10 10:49:50 2015 - [warning] Got error on MySQL connect: 2013 (Lost connection to MySQL server at ‘reading initial communication packet‘, system error: 111)
Tue Nov 10 10:49:50 2015 - [warning] Connection failed 3 time(s)..
Tue Nov 10 10:49:53 2015 - [warning] Got error on MySQL connect: 2013 (Lost connection to MySQL server at ‘reading initial communication packet‘, system error: 111)
Tue Nov 10 10:49:53 2015 - [warning] Connection failed 4 time(s)..
Tue Nov 10 10:49:53 2015 - [warning] Master is not reachable from health checker!
Tue Nov 10 10:49:53 2015 - [warning] Master server7(server7:3307) is not reachable!
Tue Nov 10 10:49:53 2015 - [warning] SSH is reachable.
Tue Nov 10 10:49:53 2015 - [info] Connecting to a master server failed. Reading configuration file /etc/masterha_default.cnf and ./app1.conf again, and trying to connect to all servers to check server status..
Tue Nov 10 10:49:53 2015 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Tue Nov 10 10:49:53 2015 - [info] Reading application default configuration from ./app1.conf..
Tue Nov 10 10:49:53 2015 - [info] Reading server configuration from ./app1.conf..
Tue Nov 10 10:49:53 2015 - [info] GTID failover mode = 0
Tue Nov 10 10:49:53 2015 - [info] Dead Servers:
Tue Nov 10 10:49:53 2015 - [info] server7(server7:3307)
Tue Nov 10 10:49:53 2015 - [info] Alive Servers:
Tue Nov 10 10:49:53 2015 - [info] server6(server6:3307)
Tue Nov 10 10:49:53 2015 - [info] server8(server8:3307)
Tue Nov 10 10:49:53 2015 - [info] Alive Slaves:
Tue Nov 10 10:49:53 2015 - [info] server6(server6:3307) Version=5.6.27-log (oldest major version between slaves) log-bin:enabled
Tue Nov 10 10:49:53 2015 - [info] Replicating from server7(server7:3307)
Tue Nov 10 10:49:53 2015 - [info] server8(server8:3307) Version=5.6.27-log (oldest major version between slaves) log-bin:enabled
Tue Nov 10 10:49:53 2015 - [info] Replicating from server7(server7:3307)
Tue Nov 10 10:49:53 2015 - [info] Checking slave configurations..
Tue Nov 10 10:49:53 2015 - [info] read_only=1 is not set on slave server6(server6:3307).
Tue Nov 10 10:49:53 2015 - [warning] relay_log_purge=0 is not set on slave server6(server6:3307).
Tue Nov 10 10:49:53 2015 - [info] read_only=1 is not set on slave server8(server8:3307).
Tue Nov 10 10:49:53 2015 - [info] Checking replication filtering settings..
Tue Nov 10 10:49:53 2015 - [info] Replication filtering check ok.
Tue Nov 10 10:49:53 2015 - [info] Master is down!
Tue Nov 10 10:49:53 2015 - [info] Terminating monitoring script.
Tue Nov 10 10:49:53 2015 - [info] Got exit code 20 (Master dead).
Tue Nov 10 10:49:53 2015 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Tue Nov 10 10:49:53 2015 - [info] Reading application default configuration from ./app1.conf..
Tue Nov 10 10:49:53 2015 - [info] Reading server configuration from ./app1.conf..
Tue Nov 10 10:49:53 2015 - [info] MHA::MasterFailover version 0.56.
4、启动master failover :
1) 阶段1 : 配置检查:
Tue Nov 10 10:49:53 2015 - [info] Starting master failover.
Tue Nov 10 10:49:53 2015 - [info]
Tue Nov 10 10:49:53 2015 - [info] * Phase 1: Configuration Check Phase..
Tue Nov 10 10:49:53 2015 - [info]
Tue Nov 10 10:49:53 2015 - [info] GTID failover mode = 0
Tue Nov 10 10:49:53 2015 - [info] Dead Servers:
Tue Nov 10 10:49:53 2015 - [info] server7(server7:3307)
Tue Nov 10 10:49:53 2015 - [info] Checking master reachability via MySQL(double check)...
Tue Nov 10 10:49:53 2015 - [info] ok.
Tue Nov 10 10:49:53 2015 - [info] Alive Servers:
Tue Nov 10 10:49:53 2015 - [info] server6(server6:3307)
Tue Nov 10 10:49:53 2015 - [info] server8(server8:3307)
Tue Nov 10 10:49:53 2015 - [info] Alive Slaves:
Tue Nov 10 10:49:53 2015 - [info] server6(server6:3307) Version=5.6.27-log (oldest major version between slaves) log-bin:enabled
Tue Nov 10 10:49:53 2015 - [info] Replicating from server7(server7:3307)
Tue Nov 10 10:49:53 2015 - [info] server8(server8:3307) Version=5.6.27-log (oldest major version between slaves) log-bin:enabled
Tue Nov 10 10:49:53 2015 - [info] Replicating from server7(server7:3307)
Tue Nov 10 10:49:53 2015 - [info] Starting Non-GTID based failover.
Tue Nov 10 10:49:53 2015 - [info]
Tue Nov 10 10:49:53 2015 - [info] ** Phase 1: Configuration Check Phase completed.
Tue Nov 10 10:49:53 2015 - [info]
2) 阶段2: 关闭dead master(master_ip_failover_script脚本没有做 , 忽略对deadmaster
的ip 失效,。);
Tue Nov 10 10:49:53 2015 - [info] * Phase 2: Dead Master Shutdown Phase..
Tue Nov 10 10:49:53 2015 - [info]
Tue Nov 10 10:49:53 2015 - [info] Forcing shutdown so that applications never connect to the current master..
Tue Nov 10 10:49:53 2015 - [warning] master_ip_failover_script is not set. Skipping invalidating dead master IP address.
Tue Nov 10 10:49:53 2015 - [warning] shutdown_script is not set. Skipping explicit shutting down of the dead master.
Tue Nov 10 10:49:53 2015 - [info] * Phase 2: Dead Master Shutdown Phase completed.
Tue Nov 10 10:49:53 2015 - [info]
3) 阶段3 : master恢复阶段:
A:找lastest slave :
show slave status: 得到的Relay_Master_Log_File + Read_Master_Log_Pos 最大的就可以 。
因为server6和server8 的读取master位点一样,所以都是oldest和lastest ;
Tue Nov 10 10:49:53 2015 - [info] * Phase 3: Master Recovery Phase..
Tue Nov 10 10:49:53 2015 - [info]
Tue Nov 10 10:49:53 2015 - [info] * Phase 3.1: Getting Latest Slaves Phase..
Tue Nov 10 10:49:53 2015 - [info]
Tue Nov 10 10:49:53 2015 - [info] The latest binary log file/position on all slaves is master-bin.000004:120
Tue Nov 10 10:49:53 2015 - [info] Latest slaves (Slaves that received relay log files to the latest):
Tue Nov 10 10:49:53 2015 - [info] server6(server6:3307) Version=5.6.27-log (oldest major version between slaves) log-bin:enabled
Tue Nov 10 10:49:53 2015 - [info] Replicating from server7(server7:3307)
Tue Nov 10 10:49:53 2015 - [info] server8(server8:3307) Version=5.6.27-log (oldest major version between slaves) log-bin:enabled
Tue Nov 10 10:49:53 2015 - [info] Replicating from server7(server7:3307)
Tue Nov 10 10:49:53 2015 - [info] The oldest binary log file/position on all slaves is master-bin.000004:120
Tue Nov 10 10:49:53 2015 - [info] Oldest slaves:
Tue Nov 10 10:49:53 2015 - [info] server6(server6:3307) Version=5.6.27-log (oldest major version between slaves) log-bin:enabled
Tue Nov 10 10:49:53 2015 - [info] Replicating from server7(server7:3307)
Tue Nov 10 10:49:53 2015 - [info] server8(server8:3307) Version=5.6.27-log (oldest major version between slaves) log-bin:enabled
Tue Nov 10 10:49:53 2015 - [info] Replicating from server7(server7:3307)
Tue Nov 10 10:49:53 2015 - [info]
B:保存dead master binlog:
从lastest slave读到的master binlog 的位点开始截取dead master binlog ,加上binlog的文件描述信息。
Tue Nov 10 10:49:53 2015 - [info] * Phase 3.2: Saving Dead Master‘s Binlog Phase..
Tue Nov 10 10:49:53 2015 - [info]
Tue Nov 10 10:49:53 2015 - [info] Fetching dead master‘s binary logs..
Tue Nov 10 10:49:53 2015 - [info] Executing command on the dead master server7(server7:3307): save_binary_logs --command=save --start_file=master-bin.000004 --start_pos=120 --binlog_dir=/var/lib/mysql,/var/log/mysql --output_file=/var/log/masterha/app1/saved_master_binlog_from_server7_3307_20151110104953.binlog --handle_raw_binlog=1 --disable_log_bin=0 --manager_version=0.56
Creating /var/log/masterha/app1 if not exists.. ok.
Concat binary/relay logs from master-bin.000004 pos 120 to master-bin.000004 EOF into /var/log/masterha/app1/saved_master_binlog_from_server7_3307_20151110104953.binlog ..
Binlog Checksum enabled
Dumping binlog format description event, from position 0 to 120.. ok.
No need to dump effective binlog data from /var/lib/mysql/master-bin.000004 (pos starts 120, filesize 120). Skipping.
Binlog Checksum enabled
/var/log/masterha/app1/saved_master_binlog_from_server7_3307_20151110104953.binlog has no effective data events.
Event not exists.
Tue Nov 10 10:49:54 2015 - [info] Additional events were not found from the orig master. No need to save.
C: 选举新的master, 因为所有slave接收到的master位点信息是一样的,所以他们不用再做同步了。
随机找了一台server6 promote成为new master.
Tue Nov 10 10:49:54 2015 - [info]
Tue Nov 10 10:49:54 2015 - [info] * Phase 3.3: Determining New Master Phase..
Tue Nov 10 10:49:54 2015 - [info]
Tue Nov 10 10:49:54 2015 - [info] Finding the latest slave that has all relay logs for recovering other slaves..
Tue Nov 10 10:49:54 2015 - [info] All slaves received relay logs to the same position. No need to resync each other.
Tue Nov 10 10:49:54 2015 - [info] Searching new master from slaves..
Tue Nov 10 10:49:54 2015 - [info] Candidate masters from the configuration file:
Tue Nov 10 10:49:54 2015 - [info] Non-candidate masters:
Tue Nov 10 10:49:54 2015 - [info] New master is server6(server6:3307)
Tue Nov 10 10:49:54 2015 - [info] Starting master failover..
Tue Nov 10 10:49:54 2015 - [info]
From:
server7(server7:3307) (current master)
+--server6(server6:3307)
+--server8(server8:3307)
To:
server6(server6:3307) (new master)
+--server8(server8:3307)
D: 新的master的差异日志生成阶段
new master(server6)已经包含了所有 relay log (就是说dead master 的binlog和new master的 relay log没有差异了--即所谓的deadmaster binlog 和new master relaylog 的差异)
Tue Nov 10 10:49:54 2015 - [info]
Tue Nov 10 10:49:54 2015 - [info] * Phase 3.3: New Master Diff Log Generation Phase..
Tue Nov 10 10:49:54 2015 - [info]
Tue Nov 10 10:49:54 2015 - [info] This server has all relay logs. No need to generate diff files from the latest slave.
Tue Nov 10 10:49:54 2015 - [info]
E: 新的master log应用阶段,即把 new master的relay log和dead master的binlog差异在new master做一次重放。
然后获取到new master的binlog 文件和位点信息(master-bin.000003, pos=120)至此 ,dead master和new master已经同步了。
Tue Nov 10 10:49:54 2015 - [info] * Phase 3.4: Master Log Apply Phase..
Tue Nov 10 10:49:54 2015 - [info]
Tue Nov 10 10:49:54 2015 - [info] *NOTICE: If any error happens from this phase, manual recovery is needed.
Tue Nov 10 10:49:54 2015 - [info] Starting recovery on server6(server6:3307)..
Tue Nov 10 10:49:54 2015 - [info] This server has all relay logs. Waiting all logs to be applied..
Tue Nov 10 10:49:54 2015 - [info] done.
Tue Nov 10 10:49:54 2015 - [info] All relay logs were successfully applied.
Tue Nov 10 10:49:54 2015 - [info] Getting new master‘s binlog name and position..
Tue Nov 10 10:49:54 2015 - [info] master-bin.000003:120
Tue Nov 10 10:49:54 2015 - [info] All other slaves should start replication from here. Statement should be: CHANGE MASTER TO MASTER_HOST=‘server6 or server6‘, MASTER_PORT=3307, MASTER_LOG_FILE=‘master-bin.000003‘, MASTER_LOG_POS=120, MASTER_USER=‘repl_user‘, MASTER_PASSWORD=‘xxx‘;
Tue Nov 10 10:49:54 2015 - [warning] master_ip_failover_script is not set. Skipping taking over new master IP address.
Tue Nov 10 10:49:54 2015 - [info] ** Finished master recovery successfully.
Tue Nov 10 10:49:54 2015 - [info] * Phase 3: Master Recovery Phase completed.
Tue Nov 10 10:49:54 2015 - [info]
阶段4: 并行操作,对每一个slave .比较它和new master的relay log的位点差异,
然后把这个差异在slave 补全, 最后做change master to new master;
启动slave;
Tue Nov 10 10:49:54 2015 - [info] * Phase 4: Slaves Recovery Phase..
Tue Nov 10 10:49:54 2015 - [info]
Tue Nov 10 10:49:54 2015 - [info] * Phase 4.1: Starting Parallel Slave Diff Log Generation Phase..
Tue Nov 10 10:49:54 2015 - [info]
Tue Nov 10 10:49:54 2015 - [info] -- Slave diff file generation on host server8(server8:3307) started, pid: 34574. Check tmp log /var/log/masterha/app1/server8_3307_20151110104953.log if it takes time..
Tue Nov 10 10:49:54 2015 - [info]
Tue Nov 10 10:49:54 2015 - [info] Log messages from server8 ...
Tue Nov 10 10:49:54 2015 - [info]
Tue Nov 10 10:49:54 2015 - [info] This server has all relay logs. No need to generate diff files from the latest slave.
Tue Nov 10 10:49:54 2015 - [info] End of log messages from server8.
Tue Nov 10 10:49:54 2015 - [info] -- server8(server8:3307) has the latest relay log events.
Tue Nov 10 10:49:54 2015 - [info] Generating relay diff files from the latest slave succeeded.
Tue Nov 10 10:49:54 2015 - [info]
Tue Nov 10 10:49:54 2015 - [info] * Phase 4.2: Starting Parallel Slave Log Apply Phase..
Tue Nov 10 10:49:54 2015 - [info]
Tue Nov 10 10:49:54 2015 - [info] -- Slave recovery on host server8(server8:3307) started, pid: 34576. Check tmp log /var/log/masterha/app1/server8_3307_20151110104953.log if it takes time..
Tue Nov 10 10:49:54 2015 - [info]
Tue Nov 10 10:49:54 2015 - [info] Log messages from server8 ...
Tue Nov 10 10:49:54 2015 - [info]
Tue Nov 10 10:49:54 2015 - [info] Starting recovery on server8(server8:3307)..
Tue Nov 10 10:49:54 2015 - [info] This server has all relay logs. Waiting all logs to be applied..
Tue Nov 10 10:49:54 2015 - [info] done.
Tue Nov 10 10:49:54 2015 - [info] All relay logs were successfully applied.
Tue Nov 10 10:49:54 2015 - [info] Resetting slave server8(server8:3307) and starting replication from the new master server6(server6:3307)..
Tue Nov 10 10:49:54 2015 - [info] Executed CHANGE MASTER.
Tue Nov 10 10:49:54 2015 - [info] Slave started.
Tue Nov 10 10:49:54 2015 - [info] End of log messages from server8.
Tue Nov 10 10:49:54 2015 - [info] -- Slave recovery on host server8(server8:3307) succeeded.
Tue Nov 10 10:49:54 2015 - [info] All new slave servers recovered successfully.
Tue Nov 10 10:49:54 2015 - [info]
阶段5: : 重置new master上的slave info ., 启动new master;
Tue Nov 10 10:49:54 2015 - [info] * Phase 5: New master cleanup phase..
Tue Nov 10 10:49:54 2015 - [info]
Tue Nov 10 10:49:54 2015 - [info] Resetting slave info on the new master..
Tue Nov 10 10:49:54 2015 - [info] server6: Resetting slave info succeeded.
Tue Nov 10 10:49:54 2015 - [info] Master failover to server6(server6:3307) completed successfully.
Tue Nov 10 10:49:54 2015 - [info]
阶段6: 故障转移报告:
----- Failover Report -----
app1: MySQL Master failover server7(server7:3307) to server6(server6:3307) succeeded
Master server7(server7:3307) is down!
Check MHA Manager logs at server9 for details.
Started automated(non-interactive) failover.
The latest slave server6(server6:3307) has all relay logs for recovery.
Selected server6(server6:3307) as a new master.
server6(server6:3307): OK: Applying all logs succeeded.
server8(server8:3307): This host has the latest relay log events.
Generating relay diff files from the latest slave succeeded.
server8(server8:3307): OK: Applying all logs succeeded. Slave started, replicating from server6(server6:3307)
server6(server6:3307): Resetting slave info succeeded.
Master failover to server6(server6:3307) completed successfully.
mysql-master-ha 实现mysql master的高可用。
标签:
原文地址:http://www.cnblogs.com/dongqingswt/p/4952782.html