MySQL之MHA+keepalived方案演示(四)
# pkill mysqld # tailf /var/log/masterha/app1/manager.logSun Jul1 17:04:27 2018 - Got error on MySQL select ping: 2006 (MySQL server has gone away)
Sun Jul1 17:04:27 2018 - Executing SSH check script: save_binary_logs --command=test --start_pos=4 --binlog_dir=/data/mysql/logs/bin-log --output_file=/tmp/save_binary_logs_test --manager_version=0.56 --binlog_prefix=mysql-bin
Sun Jul1 17:04:27 2018 - Executing secondary network check script: /usr/local/bin/masterha_secondary_check -s server03 -s server02 --user=root --master_host=server02 --master_ip=192.168.2.128 --master_port=3306--user=root--master_host=192.168.2.128--master_ip=192.168.2.128--master_port=3306 --master_user=monitor --master_password=123456 --ping_type=SELECT
Monitoring server server03 is reachable, Master is not reachable from server03. OK.
Sun Jul1 17:04:28 2018 - HealthCheck: SSH to 192.168.2.128 is reachable.
Monitoring server server02 is reachable, Master is not reachable from server02. OK.
Sun Jul1 17:04:28 2018 - Master is not reachable from all other monitoring servers. Failover should start.
Sun Jul1 17:04:28 2018 - Got error on MySQL connect: 2013 (Lost connection to MySQL server at 'reading initial communication packet', system error: 111)
Sun Jul1 17:04:28 2018 - Connection failed 2 time(s)..
Sun Jul1 17:04:29 2018 - Got error on MySQL connect: 2013 (Lost connection to MySQL server at 'reading initial communication packet', system error: 111)
Sun Jul1 17:04:29 2018 - Connection failed 3 time(s)..
Sun Jul1 17:04:30 2018 - Got error on MySQL connect: 2013 (Lost connection to MySQL server at 'reading initial communication packet', system error: 111)
Sun Jul1 17:04:30 2018 - Connection failed 4 time(s)..
Sun Jul1 17:04:30 2018 - Master is not reachable from health checker!
Sun Jul1 17:04:30 2018 - Master 192.168.2.128(192.168.2.128:3306) is not reachable!
Sun Jul1 17:04:30 2018 - SSH is reachable.
Sun Jul1 17:04:30 2018 - Connecting to a master server failed. Reading configuration file /etc/masterha_default.cnf and /etc/masterha/app1.cnf again, and trying to connect to all servers to check server status..
Sun Jul1 17:04:30 2018 - Global configuration file /etc/masterha_default.cnf not found. Skipping.
Sun Jul1 17:04:30 2018 - Reading application default configuration from /etc/masterha/app1.cnf..
Sun Jul1 17:04:30 2018 - Reading server configuration from /etc/masterha/app1.cnf..
Sun Jul1 17:04:31 2018 - GTID failover mode = 0
Sun Jul1 17:04:31 2018 - Dead Servers:
Sun Jul1 17:04:31 2018 - 192.168.2.128(192.168.2.128:3306)
Sun Jul1 17:04:31 2018 - Alive Servers:
Sun Jul1 17:04:31 2018 - 192.168.2.129(192.168.2.129:3306)
Sun Jul1 17:04:31 2018 - 192.168.2.130(192.168.2.130:3306)
Sun Jul1 17:04:31 2018 - Alive Slaves:
Sun Jul1 17:04:31 2018 - 192.168.2.129(192.168.2.129:3306)Version=5.7.21-log (oldest major version between slaves) log-bin:enabled
Sun Jul1 17:04:31 2018 - Replicating from 192.168.2.128(192.168.2.128:3306)
Sun Jul1 17:04:31 2018 - Primary candidate for the new Master (candidate_master is set)
Sun Jul1 17:04:31 2018 - 192.168.2.130(192.168.2.130:3306)Version=5.7.21-log (oldest major version between slaves) log-bin:enabled
Sun Jul1 17:04:31 2018 - Replicating from 192.168.2.128(192.168.2.128:3306)
Sun Jul1 17:04:31 2018 - Checking slave configurations..
Sun Jul1 17:04:31 2018 - read_only=1 is not set on slave 192.168.2.129(192.168.2.129:3306).
Sun Jul1 17:04:31 2018 - Checking replication filtering settings..
Sun Jul1 17:04:31 2018 - Replication filtering check ok.
Sun Jul1 17:04:31 2018 - Master is down!
Sun Jul1 17:04:31 2018 - Terminating monitoring script.
Sun Jul1 17:04:31 2018 - Got exit code 20 (Master dead).
Sun Jul1 17:04:31 2018 - MHA::MasterFailover version 0.56.
Sun Jul1 17:04:31 2018 - Starting master failover.
Sun Jul1 17:04:31 2018 -
Sun Jul1 17:04:31 2018 - * Phase 1: Configuration Check Phase..
Sun Jul1 17:04:31 2018 -
Sun Jul1 17:04:31 2018 - GTID failover mode = 0
Sun Jul1 17:04:31 2018 - Dead Servers:
Sun Jul1 17:04:31 2018 - 192.168.2.128(192.168.2.128:3306)
Sun Jul1 17:04:31 2018 - Checking master reachability via MySQL(double check)...
Sun Jul1 17:04:31 2018 - ok.
Sun Jul1 17:04:31 2018 - Alive Servers:
Sun Jul1 17:04:31 2018 - 192.168.2.129(192.168.2.129:3306)
Sun Jul1 17:04:31 2018 - 192.168.2.130(192.168.2.130:3306)
Sun Jul1 17:04:31 2018 - Alive Slaves:
Sun Jul1 17:04:31 2018 - 192.168.2.129(192.168.2.129:3306)Version=5.7.21-log (oldest major version between slaves) log-bin:enabled
Sun Jul1 17:04:31 2018 - Replicating from 192.168.2.128(192.168.2.128:3306)
Sun Jul1 17:04:31 2018 - Primary candidate for the new Master (candidate_master is set)
Sun Jul1 17:04:31 2018 - 192.168.2.130(192.168.2.130:3306)Version=5.7.21-log (oldest major version between slaves) log-bin:enabled
Sun Jul1 17:04:31 2018 - Replicating from 192.168.2.128(192.168.2.128:3306)
Sun Jul1 17:04:31 2018 - Starting Non-GTID based failover.
Sun Jul1 17:04:31 2018 -
Sun Jul1 17:04:31 2018 - ** Phase 1: Configuration Check Phase completed.
Sun Jul1 17:04:31 2018 -
Sun Jul1 17:04:31 2018 - * Phase 2: Dead Master Shutdown Phase..
Sun Jul1 17:04:31 2018 -
Sun Jul1 17:04:31 2018 - Forcing shutdown so that applications never connect to the current master..
Sun Jul1 17:04:31 2018 - Executing master IP deactivation script:
Sun Jul1 17:04:31 2018 - /usr/local/bin/master_ip_failover --orig_master_host=192.168.2.128 --orig_master_ip=192.168.2.128 --orig_master_port=3306 --command=stopssh --ssh_user=root
Sun Jul1 17:04:31 2018 - done.
Sun Jul1 17:04:31 2018 - shutdown_script is not set. Skipping explicit shutting down of the dead master.
Sun Jul1 17:04:31 2018 - * Phase 2: Dead Master Shutdown Phase completed.
Sun Jul1 17:04:31 2018 -
Sun Jul1 17:04:31 2018 - * Phase 3: Master Recovery Phase..
Sun Jul1 17:04:31 2018 -
Sun Jul1 17:04:31 2018 - * Phase 3.1: Getting Latest Slaves Phase..
Sun Jul1 17:04:31 2018 -
Sun Jul1 17:04:31 2018 - The latest binary log file/position on all slaves is mysql-bin.000006:154
Sun Jul1 17:04:31 2018 - Latest slaves (Slaves that received> Sun Jul1 17:04:31 2018 - 192.168.2.129(192.168.2.129:3306)Version=5.7.21-log (oldest major version between slaves) log-bin:enabled
Sun Jul1 17:04:31 2018 - Replicating from 192.168.2.128(192.168.2.128:3306)
Sun Jul1 17:04:31 2018 - Primary candidate for the new Master (candidate_master is set)
Sun Jul1 17:04:31 2018 - 192.168.2.130(192.168.2.130:3306)Version=5.7.21-log (oldest major version between slaves) log-bin:enabled
Sun Jul1 17:04:31 2018 - Replicating from 192.168.2.128(192.168.2.128:3306)
Sun Jul1 17:04:31 2018 - The oldest binary log file/position on all slaves is mysql-bin.000006:154
Sun Jul1 17:04:31 2018 - Oldest slaves:
Sun Jul1 17:04:31 2018 - 192.168.2.129(192.168.2.129:3306)Version=5.7.21-log (oldest major version between slaves) log-bin:enabled
Sun Jul1 17:04:31 2018 - Replicating from 192.168.2.128(192.168.2.128:3306)
Sun Jul1 17:04:31 2018 - Primary candidate for the new Master (candidate_master is set)
Sun Jul1 17:04:31 2018 - 192.168.2.130(192.168.2.130:3306)Version=5.7.21-log (oldest major version between slaves) log-bin:enabled
Sun Jul1 17:04:31 2018 - Replicating from 192.168.2.128(192.168.2.128:3306)
Sun Jul1 17:04:31 2018 -
Sun Jul1 17:04:31 2018 - * Phase 3.2: Saving Dead Master's Binlog Phase..
Sun Jul1 17:04:31 2018 -
Sun Jul1 17:04:31 2018 - Fetching dead master's binary logs..
Sun Jul1 17:04:31 2018 - Executing command on the dead master 192.168.2.128(192.168.2.128:3306): save_binary_logs --command=save --start_file=mysql-bin.000006--start_pos=154 --binlog_dir=/data/mysql/logs/bin-log --output_file=/tmp/saved_master_binlog_from_192.168.2.128_3306_20180701170431.binlog --handle_raw_binlog=1 --disable_log_bin=0 --manager_version=0.56
Creating /tmp if not exists.. ok.
Concat binary/relay logs from mysql-bin.000006 pos 154 to mysql-bin.000006 EOF into /tmp/saved_master_binlog_from_192.168.2.128_3306_20180701170431.binlog ..
Binlog Checksum enabled
Dumping binlog format description event, from position 0 to 154.. ok.
No need to dump effective binlog data from /data/mysql/logs/bin-log/mysql-bin.000006 (pos starts 154, filesize 154). Skipping.
Binlog Checksum enabled
/tmp/saved_master_binlog_from_192.168.2.128_3306_20180701170431.binlog has no effective data events.
Event not exists.
Sun Jul1 17:04:32 2018 - Additional events were not found from the orig master. No need to save.
Sun Jul1 17:04:32 2018 -
Sun Jul1 17:04:32 2018 - * Phase 3.3: Determining New Master Phase..
Sun Jul1 17:04:32 2018 -
Sun Jul1 17:04:32 2018 - Finding the latest slave that has all>
Sun Jul1 17:04:32 2018 - All slaves received> Sun Jul1 17:04:32 2018 - Searching new master from slaves..
Sun Jul1 17:04:32 2018 - Candidate masters from the configuration file:
Sun Jul1 17:04:32 2018 - 192.168.2.129(192.168.2.129:3306)Version=5.7.21-log (oldest major version between slaves) log-bin:enabled
Sun Jul1 17:04:32 2018 - Replicating from 192.168.2.128(192.168.2.128:3306)
Sun Jul1 17:04:32 2018 - Primary candidate for the new Master (candidate_master is set)
Sun Jul1 17:04:32 2018 - Non-candidate masters:
Sun Jul1 17:04:32 2018 - Searching from candidate_master slaves which have received the latest> Sun Jul1 17:04:32 2018 - New master is 192.168.2.129(192.168.2.129:3306)
Sun Jul1 17:04:32 2018 - Starting master failover..
Sun Jul1 17:04:32 2018 -
From:
192.168.2.128(192.168.2.128:3306) (current master)
+--192.168.2.129(192.168.2.129:3306)
+--192.168.2.130(192.168.2.130:3306)
To:
192.168.2.129(192.168.2.129:3306) (new master)
+--192.168.2.130(192.168.2.130:3306)
Sun Jul1 17:04:32 2018 -
Sun Jul1 17:04:32 2018 - * Phase 3.3: New Master Diff Log Generation Phase..
Sun Jul1 17:04:32 2018 -
Sun Jul1 17:04:32 2018 - This server has all> Sun Jul1 17:04:32 2018 -
Sun Jul1 17:04:32 2018 - * Phase 3.4: Master Log Apply Phase..
Sun Jul1 17:04:32 2018 -
Sun Jul1 17:04:32 2018 - *NOTICE: If any error happens from this phase, manual recovery is needed.
Sun Jul1 17:04:32 2018 - Starting recovery on 192.168.2.129(192.168.2.129:3306)..
Sun Jul1 17:04:32 2018 - This server has all> Sun Jul1 17:04:32 2018 - done.
Sun Jul1 17:04:32 2018 - All> Sun Jul1 17:04:32 2018 - Getting new master's binlog name and position..
Sun Jul1 17:04:32 2018 - mysql-bin.000003:154
Sun Jul1 17:04:32 2018 - All other slaves should start replication from here. Statement should be: CHANGE MASTER TO MASTER_HOST='192.168.2.129', MASTER_PORT=3306, MASTER_LOG_FILE='mysql-bin.000003', MASTER_LOG_POS=154, MASTER_USER='repmha', MASTER_PASSWORD='xxx';
Sun Jul1 17:04:32 2018 - Executing master IP activate script:
Sun Jul1 17:04:32 2018 - /usr/local/bin/master_ip_failover --command=start --ssh_user=root --orig_master_host=192.168.2.128 --orig_master_ip=192.168.2.128 --orig_master_port=3306 --new_master_host=192.168.2.129 --new_master_ip=192.168.2.129 --new_master_port=3306 --new_master_user='monitor' --new_master_password='123456'
Undefined subroutine &main::FIXME_xxx_create_user called at /usr/local/bin/master_ip_failover line 88.
Set read_only=0 on the new master.
Creating app user on the new master..
Sun Jul1 17:04:32 2018 - Failed to activate master IP address for 192.168.2.129(192.168.2.129:3306) with return code 10:0
Sun Jul1 17:04:32 2018 - Proceeding.
Sun Jul1 17:04:32 2018 - ** Finished master recovery successfully.
Sun Jul1 17:04:32 2018 - * Phase 3: Master Recovery Phase completed.
Sun Jul1 17:04:32 2018 -
Sun Jul1 17:04:32 2018 - * Phase 4: Slaves Recovery Phase..
Sun Jul1 17:04:32 2018 -
Sun Jul1 17:04:32 2018 - * Phase 4.1: Starting Parallel Slave Diff Log Generation Phase..
Sun Jul1 17:04:32 2018 -
Sun Jul1 17:04:32 2018 - -- Slave diff file generation on host 192.168.2.130(192.168.2.130:3306) started, pid: 49563. Check tmp log /var/log/masterha/app1.log/192.168.2.130_3306_20180701170431.log if it takes time..
Sun Jul1 17:04:32 2018 -
Sun Jul1 17:04:32 2018 - Log messages from 192.168.2.130 ...
Sun Jul1 17:04:32 2018 -
Sun Jul1 17:04:32 2018 - This server has all> Sun Jul1 17:04:32 2018 - End of log messages from 192.168.2.130.
Sun Jul1 17:04:32 2018 - -- 192.168.2.130(192.168.2.130:3306) has the latest>
Sun Jul1 17:04:32 2018 - Generating> Sun Jul1 17:04:32 2018 -
Sun Jul1 17:04:32 2018 - * Phase 4.2: Starting Parallel Slave Log Apply Phase..
Sun Jul1 17:04:32 2018 -
Sun Jul1 17:04:32 2018 - -- Slave recovery on host 192.168.2.130(192.168.2.130:3306) started, pid: 49565. Check tmp log /var/log/masterha/app1.log/192.168.2.130_3306_20180701170431.log if it takes time..
Sun Jul1 17:04:32 2018 -
Sun Jul1 17:04:32 2018 - Log messages from 192.168.2.130 ...
Sun Jul1 17:04:32 2018 -
Sun Jul1 17:04:32 2018 - Starting recovery on 192.168.2.130(192.168.2.130:3306)..
Sun Jul1 17:04:32 2018 - This server has all> Sun Jul1 17:04:32 2018 - done.
Sun Jul1 17:04:32 2018 - All> Sun Jul1 17:04:32 2018 - Resetting slave 192.168.2.130(192.168.2.130:3306) and starting replication from the new master 192.168.2.129(192.168.2.129:3306)..
Sun Jul1 17:04:32 2018 - Executed CHANGE MASTER.
Sun Jul1 17:04:32 2018 - Slave started.
Sun Jul1 17:04:32 2018 - End of log messages from 192.168.2.130.
Sun Jul1 17:04:32 2018 - -- Slave recovery on host 192.168.2.130(192.168.2.130:3306) succeeded.
Sun Jul1 17:04:32 2018 - All new slave servers recovered successfully.
Sun Jul1 17:04:32 2018 -
Sun Jul1 17:04:32 2018 - * Phase 5: New master cleanup phase..
Sun Jul1 17:04:32 2018 -
Sun Jul1 17:04:32 2018 - Resetting slave info on the new master..
Sun Jul1 17:04:32 2018 - 192.168.2.129: Resetting slave info succeeded.
Sun Jul1 17:04:32 2018 - Master failover to 192.168.2.129(192.168.2.129:3306) completed successfully.
Sun Jul1 17:04:32 2018 - Deleted server1 entry from /etc/masterha/app1.cnf .
Sun Jul1 17:04:32 2018 -
----- Failover Report -----
app1: MySQL Master failover 192.168.2.128(192.168.2.128:3306) to 192.168.2.129(192.168.2.129:3306) succeeded
Master 192.168.2.128(192.168.2.128:3306) is down!
Check MHA Manager logs at server04:/var/log/masterha/app1/manager.log for details.
Started automated(non-interactive) failover.
Invalidated master IP address on 192.168.2.128(192.168.2.128:3306)
The latest slave 192.168.2.129(192.168.2.129:3306) has all> Selected 192.168.2.129(192.168.2.129:3306) as a new master.
192.168.2.129(192.168.2.129:3306): OK: Applying all logs succeeded.
Failed to activate master IP address for 192.168.2.129(192.168.2.129:3306) with return code 10:0
192.168.2.130(192.168.2.130:3306): This host has the latest>
Generating> 192.168.2.130(192.168.2.130:3306): OK: Applying all logs succeeded. Slave started, replicating from 192.168.2.129(192.168.2.129:3306)
192.168.2.129(192.168.2.129:3306): Resetting slave info succeeded.
Master failover to 192.168.2.129(192.168.2.129:3306) completed successfully.
Sun Jul1 17:04:32 2018 - Sending mail..
Unknown option: conf
页:
[1]