旃麒雅 发表于 2018-10-1 13:48:37

MySQL-MHA 安装配置及遇到的问题

  在192.168.17.199(manager)上 tailf /etc/masterha/app1/manager.log
  然后停止192.168.17.199的3306 mysql实例,并查看manager.log
  ]# tail -f /masterha/app1/manager.log
  192.168.17.199 (current master)
  +--192.168.17.200
  +--192.168.17.201
  Tue Nov 19 00:32:04 2013 - master_ip_failover_script is not defined.
  Tue Nov 19 00:32:04 2013 - shutdown_script is not defined.
  Tue Nov 19 00:32:04 2013 - Set master ping interval 1 seconds.
  Tue Nov 19 00:32:04 2013 - secondary_check_script is not defined. It is highly recommended setting it to check master reachability from two or more routes.
  Tue Nov 19 00:32:04 2013 - Starting ping health check on 192.168.17.199(192.168.17.199:3306)..
  Tue Nov 19 00:32:04 2013 - Ping(SELECT) succeeded, waiting until MySQL doesn't respond..
  Tue Nov 19 17:59:07 2013 - Got error on MySQL select ping: 2006 (MySQL server has gone away)
  Tue Nov 19 17:59:07 2013 - Executing SSH check script: save_binary_logs --command=test --start_pos=4 --binlog_dir=/data/mydb/db01/logs/binlog/ --output_file=/var/tmp/save_binary_logs_test --manager_version=0.54 --binlog_prefix=mysql-bin
  Tue Nov 19 17:59:08 2013 - HealthCheck: SSH to 192.168.17.199 is reachable.
  Tue Nov 19 17:59:08 2013 - Got error on MySQL connect: 2013 (Lost connection to MySQL server at 'reading initial communication packet', system error: 111)
  Tue Nov 19 17:59:08 2013 - Connection failed 1 time(s)..
  Tue Nov 19 17:59:09 2013 - Got error on MySQL connect: 2013 (Lost connection to MySQL server at 'reading initial communication packet', system error: 111)
  Tue Nov 19 17:59:09 2013 - Connection failed 2 time(s)..
  Tue Nov 19 17:59:10 2013 - Got error on MySQL connect: 2013 (Lost connection to MySQL server at 'reading initial communication packet', system error: 111)
  Tue Nov 19 17:59:10 2013 - Connection failed 3 time(s)..
  Tue Nov 19 17:59:10 2013 - Master is not reachable from health checker!
  Tue Nov 19 17:59:10 2013 - Master 192.168.17.199(192.168.17.199:3306) is not reachable!
  Tue Nov 19 17:59:10 2013 - SSH is reachable.
  Tue Nov 19 17:59:10 2013 - 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..
  Tue Nov 19 17:59:10 2013 - Global configuration file /etc/masterha_default.cnf not found. Skipping.
  Tue Nov 19 17:59:10 2013 - Reading application default configurations from /etc/masterha/app1.cnf..
  Tue Nov 19 17:59:10 2013 - Reading server configurations from /etc/masterha/app1.cnf..
  Tue Nov 19 17:59:10 2013 - Dead Servers:
  Tue Nov 19 17:59:10 2013 -    192.168.17.199(192.168.17.199:3306)
  Tue Nov 19 17:59:10 2013 - Alive Servers:
  Tue Nov 19 17:59:10 2013 -    192.168.17.200(192.168.17.200:3306)
  Tue Nov 19 17:59:10 2013 -    192.168.17.201(192.168.17.201:3306)
  Tue Nov 19 17:59:10 2013 - Alive Slaves:
  Tue Nov 19 17:59:10 2013 -    192.168.17.200(192.168.17.200:3306)Version=5.5.33-rel31.1-log (oldest major version between slaves) log-bin:enabled
  Tue Nov 19 17:59:10 2013 -    Replicating from 192.168.17.199(192.168.17.199:3306)
  Tue Nov 19 17:59:10 2013 -    Primary candidate for the new Master (candidate_master is set)
  Tue Nov 19 17:59:10 2013 -    192.168.17.201(192.168.17.201:3306)Version=5.5.33-rel31.1-log (oldest major version between slaves) log-bin:enabled
  Tue Nov 19 17:59:10 2013 -    Replicating from 192.168.17.199(192.168.17.199:3306)
  Tue Nov 19 17:59:10 2013 -    Primary candidate for the new Master (candidate_master is set)
  Tue Nov 19 17:59:10 2013 - Checking slave configurations..
  Tue Nov 19 17:59:10 2013 - read_only=1 is not set on slave 192.168.17.200(192.168.17.200:3306).
  Tue Nov 19 17:59:10 2013 - relay_log_purge=0 is not set on slave 192.168.17.200(192.168.17.200:3306).
  Tue Nov 19 17:59:10 2013 - read_only=1 is not set on slave 192.168.17.201(192.168.17.201:3306).
  Tue Nov 19 17:59:10 2013 - relay_log_purge=0 is not set on slave 192.168.17.201(192.168.17.201:3306).
  Tue Nov 19 17:59:10 2013 - Checking replication filtering settings..
  Tue Nov 19 17:59:10 2013 - Replication filtering check ok.
  Tue Nov 19 17:59:10 2013 - Master is down!
  Tue Nov 19 17:59:10 2013 - Terminating monitoring script.
  Tue Nov 19 17:59:10 2013 - Got exit code 20 (Master dead).
  Tue Nov 19 17:59:10 2013 - MHA::MasterFailover version 0.54.
  Tue Nov 19 17:59:10 2013 - Starting master failover.
  Tue Nov 19 17:59:10 2013 -
  Tue Nov 19 17:59:10 2013 - * Phase 1: Configuration Check Phase..
  Tue Nov 19 17:59:10 2013 -
  Tue Nov 19 17:59:11 2013 - Dead Servers:
  Tue Nov 19 17:59:11 2013 -    192.168.17.199(192.168.17.199:3306)
  Tue Nov 19 17:59:11 2013 - Checking master reachability via mysql(double check)..
  Tue Nov 19 17:59:11 2013 - ok.
  Tue Nov 19 17:59:11 2013 - Alive Servers:
  Tue Nov 19 17:59:11 2013 -    192.168.17.200(192.168.17.200:3306)
  Tue Nov 19 17:59:11 2013 -    192.168.17.201(192.168.17.201:3306)
  Tue Nov 19 17:59:11 2013 - Alive Slaves:
  Tue Nov 19 17:59:11 2013 -    192.168.17.200(192.168.17.200:3306)Version=5.5.33-rel31.1-log (oldest major version between slaves) log-bin:enabled
  Tue Nov 19 17:59:11 2013 -    Replicating from 192.168.17.199(192.168.17.199:3306)
  Tue Nov 19 17:59:11 2013 -    Primary candidate for the new Master (candidate_master is set)
  Tue Nov 19 17:59:11 2013 -    192.168.17.201(192.168.17.201:3306)Version=5.5.33-rel31.1-log (oldest major version between slaves) log-bin:enabled
  Tue Nov 19 17:59:11 2013 -    Replicating from 192.168.17.199(192.168.17.199:3306)
  Tue Nov 19 17:59:11 2013 -    Primary candidate for the new Master (candidate_master is set)
  Tue Nov 19 17:59:11 2013 - ** Phase 1: Configuration Check Phase completed.
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - * Phase 2: Dead Master Shutdown Phase..
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - Forcing shutdown so that applications never connect to the current master..
  Tue Nov 19 17:59:11 2013 - master_ip_failover_script is not set. Skipping invalidating dead master ip address.
  Tue Nov 19 17:59:11 2013 - shutdown_script is not set. Skipping explicit shutting down of the dead master.
  Tue Nov 19 17:59:11 2013 - * Phase 2: Dead Master Shutdown Phase completed.
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - * Phase 3: Master Recovery Phase..
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - * Phase 3.1: Getting Latest Slaves Phase..
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - The latest binary log file/position on all slaves is mysql-bin.000009:2386

  Tue Nov 19 17:59:11 2013 - Latest slaves (Slaves that received>  Tue Nov 19 17:59:11 2013 -    192.168.17.200(192.168.17.200:3306)Version=5.5.33-rel31.1-log (oldest major version between slaves) log-bin:enabled
  Tue Nov 19 17:59:11 2013 -    Replicating from 192.168.17.199(192.168.17.199:3306)
  Tue Nov 19 17:59:11 2013 -    Primary candidate for the new Master (candidate_master is set)
  Tue Nov 19 17:59:11 2013 -    192.168.17.201(192.168.17.201:3306)Version=5.5.33-rel31.1-log (oldest major version between slaves) log-bin:enabled
  Tue Nov 19 17:59:11 2013 -    Replicating from 192.168.17.199(192.168.17.199:3306)
  Tue Nov 19 17:59:11 2013 -    Primary candidate for the new Master (candidate_master is set)
  Tue Nov 19 17:59:11 2013 - The oldest binary log file/position on all slaves is mysql-bin.000009:2386
  Tue Nov 19 17:59:11 2013 - Oldest slaves:
  Tue Nov 19 17:59:11 2013 -    192.168.17.200(192.168.17.200:3306)Version=5.5.33-rel31.1-log (oldest major version between slaves) log-bin:enabled
  Tue Nov 19 17:59:11 2013 -    Replicating from 192.168.17.199(192.168.17.199:3306)
  Tue Nov 19 17:59:11 2013 -    Primary candidate for the new Master (candidate_master is set)
  Tue Nov 19 17:59:11 2013 -    192.168.17.201(192.168.17.201:3306)Version=5.5.33-rel31.1-log (oldest major version between slaves) log-bin:enabled
  Tue Nov 19 17:59:11 2013 -    Replicating from 192.168.17.199(192.168.17.199:3306)
  Tue Nov 19 17:59:11 2013 -    Primary candidate for the new Master (candidate_master is set)
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - * Phase 3.2: Saving Dead Master's Binlog Phase..
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - Fetching dead master's binary logs..
  Tue Nov 19 17:59:11 2013 - Executing command on the dead master 192.168.17.199(192.168.17.199:3306): save_binary_logs --command=save --start_file=mysql-bin.000009--start_pos=2386 --binlog_dir=/data/mydb/db01/logs/binlog/ --output_file=/var/tmp/saved_master_binlog_from_192.168.17.199_3306_20131119175910.binlog --handle_raw_binlog=1 --disable_log_bin=0 --manager_version=0.54
  Creating /var/tmp if not exists..    ok.
  Concat binary/relay logs from mysql-bin.000009 pos 2386 to mysql-bin.000009 EOF into /var/tmp/saved_master_binlog_from_192.168.17.199_3306_20131119175910.binlog ..
  Dumping binlog format description event, from position 0 to 107.. ok.
  Dumping effective binlog data from /data/mydb/db01/logs/binlog//mysql-bin.000009 position 2386 to tail(2405).. ok.
  sh: mysqlbinlog: command not found
  Failed to save binary log: /var/tmp/saved_master_binlog_from_192.168.17.199_3306_20131119175910.binlog is broken!
  at /usr/local/bin/save_binary_logs line 170
  Tue Nov 19 17:59:11 2013 - Failed to save binary log events from the orig master. Maybe disks on binary logs are not accessible or binary log itself is corrupt?
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - * Phase 3.3: Determining New Master Phase..
  Tue Nov 19 17:59:11 2013 -

  Tue Nov 19 17:59:11 2013 - Finding the latest slave that has all>
  Tue Nov 19 17:59:11 2013 - All slaves received>  Tue Nov 19 17:59:11 2013 - Searching new master from slaves..
  Tue Nov 19 17:59:11 2013 - Candidate masters from the configuration file:
  Tue Nov 19 17:59:11 2013 -    192.168.17.200(192.168.17.200:3306)Version=5.5.33-rel31.1-log (oldest major version between slaves) log-bin:enabled
  Tue Nov 19 17:59:11 2013 -    Replicating from 192.168.17.199(192.168.17.199:3306)
  Tue Nov 19 17:59:11 2013 -    Primary candidate for the new Master (candidate_master is set)
  Tue Nov 19 17:59:11 2013 -    192.168.17.201(192.168.17.201:3306)Version=5.5.33-rel31.1-log (oldest major version between slaves) log-bin:enabled
  Tue Nov 19 17:59:11 2013 -    Replicating from 192.168.17.199(192.168.17.199:3306)
  Tue Nov 19 17:59:11 2013 -    Primary candidate for the new Master (candidate_master is set)
  Tue Nov 19 17:59:11 2013 - Non-candidate masters:

  Tue Nov 19 17:59:11 2013 - Searching from candidate_master slaves which have received the latest>  Tue Nov 19 17:59:11 2013 - New master is 192.168.17.200(192.168.17.200:3306)
  Tue Nov 19 17:59:11 2013 - Starting master failover..
  Tue Nov 19 17:59:11 2013 -
  From:
  192.168.17.199 (current master)
  +--192.168.17.200
  +--192.168.17.201
  To:
  192.168.17.200 (new master)
  +--192.168.17.201
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - * Phase 3.3: New Master Diff Log Generation Phase..
  Tue Nov 19 17:59:11 2013 -

  Tue Nov 19 17:59:11 2013 - This server has all>  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - * Phase 3.4: Master Log Apply Phase..
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - *NOTICE: If any error happens from this phase, manual recovery is needed.
  Tue Nov 19 17:59:11 2013 - Starting recovery on 192.168.17.200(192.168.17.200:3306)..

  Tue Nov 19 17:59:11 2013 - This server has all>  Tue Nov 19 17:59:11 2013 -    done.

  Tue Nov 19 17:59:11 2013 - All>  Tue Nov 19 17:59:11 2013 - Getting new master's binlog name and position..
  Tue Nov 19 17:59:11 2013 - mysql-bin.000008:2606
  Tue Nov 19 17:59:11 2013 - All other slaves should start replication from here. Statement should be: CHANGE MASTER TO MASTER_HOST='192.168.17.200', MASTER_PORT=3306, MASTER_LOG_FILE='mysql-bin.000008', MASTER_LOG_POS=2606, MASTER_USER='repl', MASTER_PASSWORD='xxx';
  Tue Nov 19 17:59:11 2013 - master_ip_failover_script is not set. Skipping taking over new master ip address.
  Tue Nov 19 17:59:11 2013 - ** Finished master recovery successfully.
  Tue Nov 19 17:59:11 2013 - * Phase 3: Master Recovery Phase completed.
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - * Phase 4: Slaves Recovery Phase..
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - * Phase 4.1: Starting Parallel Slave Diff Log Generation Phase..
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - -- Slave diff file generation on host 192.168.17.201(192.168.17.201:3306) started, pid: 38557. Check tmp log /masterha/app1/192.168.17.201_3306_20131119175910.log if it takes time..
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - Log messages from 192.168.17.201 ...
  Tue Nov 19 17:59:11 2013 -

  Tue Nov 19 17:59:11 2013 - This server has all>  Tue Nov 19 17:59:11 2013 - End of log messages from 192.168.17.201.

  Tue Nov 19 17:59:11 2013 - -- 192.168.17.201(192.168.17.201:3306) has the latest>
  Tue Nov 19 17:59:11 2013 - Generating>  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - * Phase 4.2: Starting Parallel Slave Log Apply Phase..
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - -- Slave recovery on host 192.168.17.201(192.168.17.201:3306) started, pid: 38559. Check tmp log /masterha/app1/192.168.17.201_3306_20131119175910.log if it takes time..
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - Log messages from 192.168.17.201 ...
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - Starting recovery on 192.168.17.201(192.168.17.201:3306)..

  Tue Nov 19 17:59:11 2013 - This server has all>  Tue Nov 19 17:59:11 2013 -    done.

  Tue Nov 19 17:59:11 2013 - All>  Tue Nov 19 17:59:11 2013 - Resetting slave 192.168.17.201(192.168.17.201:3306) and starting replication from the new master 192.168.17.200(192.168.17.200:3306)..
  Tue Nov 19 17:59:11 2013 - Executed CHANGE MASTER.
  Tue Nov 19 17:59:11 2013 - Slave started.
  Tue Nov 19 17:59:11 2013 - End of log messages from 192.168.17.201.
  Tue Nov 19 17:59:11 2013 - -- Slave recovery on host 192.168.17.201(192.168.17.201:3306) succeeded.
  Tue Nov 19 17:59:11 2013 - All new slave servers recovered successfully.
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - * Phase 5: New master cleanup phase..
  Tue Nov 19 17:59:11 2013 -
  Tue Nov 19 17:59:11 2013 - Resetting slave info on the new master..
  Tue Nov 19 17:59:12 2013 - 192.168.17.200: Resetting slave info succeeded.
  Tue Nov 19 17:59:12 2013 - Master failover to 192.168.17.200(192.168.17.200:3306) completed successfully.
  Tue Nov 19 17:59:12 2013 -
  ----- Failover Report -----
  app1: MySQL Master failover 192.168.17.199 to 192.168.17.200 succeeded
  Master 192.168.17.199 is down!
  Check MHA Manager logs at rhel-king-01:/masterha/app1/manager.log for details.
  Started automated(non-interactive) failover.

  The latest slave 192.168.17.200(192.168.17.200:3306) has all>  Selected 192.168.17.200 as a new master.
  192.168.17.200: OK: Applying all logs succeeded.

  192.168.17.201: This host has the latest>
  Generating>  192.168.17.201: OK: Applying all logs succeeded. Slave started, replicating from 192.168.17.200.
  192.168.17.200: Resetting slave info succeeded.
  Master failover to 192.168.17.200(192.168.17.200:3306) completed successfully.

页: [1]
查看完整版本: MySQL-MHA 安装配置及遇到的问题