之前的都看不到了 可以看到最后检测成功
再检查下MySQL复制
masterha_check_repl --conf=/etc/app1.cnf---------------------由于截图太小 直接贴出检测文字 可以看出 最后检测都成功(虽然有些警告信息,不用去管它)
[root@mastersql ~]# masterha_check_repl --conf=/etc/app1.cnf
Mon Jul 1 02:08:33 2013 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Mon Jul 1 02:08:33 2013 - [info] Reading application default configurations from /etc/app1.cnf..
Mon Jul 1 02:08:33 2013 - [info] Reading server configurations from /etc/app1.cnf..
Mon Jul 1 02:08:33 2013 - [info] MHA::MasterMonitor version 0.52.
Mon Jul 1 02:08:33 2013 - [info] Dead Servers:
Mon Jul 1 02:08:33 2013 - [info] Alive Servers:
Mon Jul 1 02:08:33 2013 - [info] 192.168.1.1(192.168.1.1:3306)
Mon Jul 1 02:08:33 2013 - [info] 192.168.1.2(192.168.1.2:3306)
Mon Jul 1 02:08:33 2013 - [info] 192.168.1.3(192.168.1.3:3306)
Mon Jul 1 02:08:33 2013 - [info] 192.168.1.4(192.168.1.4:3306)
Mon Jul 1 02:08:33 2013 - [info] Alive Slaves:
Mon Jul 1 02:08:33 2013 - [info] 192.168.1.2(192.168.1.2:3306) Version=5.0.77-log (oldest major version between slaves) log-bin:enabled
Mon Jul 1 02:08:33 2013 - [info] Replicating from 192.168.1.1(192.168.1.1:3306)
Mon Jul 1 02:08:33 2013 - [info] Primary candidate for the new Master (candidate_master is set)
Mon Jul 1 02:08:33 2013 - [info] 192.168.1.3(192.168.1.3:3306) Version=5.0.77-log (oldest major version between slaves) log-bin:enabled
Mon Jul 1 02:08:33 2013 - [info] Replicating from 192.168.1.1(192.168.1.1:3306)
Mon Jul 1 02:08:33 2013 - [info] Not candidate for the new Master (no_master is set)
Mon Jul 1 02:08:33 2013 - [info] 192.168.1.4(192.168.1.4:3306) Version=5.0.77-log (oldest major version between slaves) log-bin:enabled
Mon Jul 1 02:08:33 2013 - [info] Replicating from 192.168.1.1(192.168.1.1:3306)
Mon Jul 1 02:08:33 2013 - [info] Not candidate for the new Master (no_master is set)
Mon Jul 1 02:08:33 2013 - [info] Current Alive Master: 192.168.1.1(192.168.1.1:3306)
Mon Jul 1 02:08:33 2013 - [info] Checking slave configurations..
Mon Jul 1 02:08:33 2013 - [warning] read_only=1 is not set on slave 192.168.1.2(192.168.1.2:3306).
Mon Jul 1 02:08:33 2013 - [warning] relay_log_purge=0 is not set on slave 192.168.1.2(192.168.1.2:3306).
Mon Jul 1 02:08:33 2013 - [warning] relay_log_purge=0 is not set on slave 192.168.1.3(192.168.1.3:3306).
Mon Jul 1 02:08:33 2013 - [warning] relay_log_purge=0 is not set on slave 192.168.1.4(192.168.1.4:3306).
Mon Jul 1 02:08:33 2013 - [info] Checking replication filtering settings..
Mon Jul 1 02:08:33 2013 - [info] binlog_do_db= , binlog_ignore_db=
Mon Jul 1 02:08:33 2013 - [info] Replication filtering check ok.
Mon Jul 1 02:08:33 2013 - [info] Starting SSH connection tests..
Mon Jul 1 02:08:36 2013 - [info] All SSH connection tests passed successfully.
Mon Jul 1 02:08:36 2013 - [info] Checking MHA Node version..
Mon Jul 1 02:08:36 2013 - [info] Version check ok.
Mon Jul 1 02:08:36 2013 - [info] Checking SSH publickey authentication and checking recovery script configurations on the current master..
Mon Jul 1 02:08:36 2013 - [info] Executing command: save_binary_logs --command=test --start_file=binlog.000003 --start_pos=4 --binlog_dir=/var/lib/mysql,/var/log/mysql --output_file=/var/log/masterha/app1/save_binary_logs_test --manager_version=0.52
Mon Jul 1 02:08:36 2013 - [info] Connecting to root@192.168.1.1(192.168.1.1)..
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 binlog.000003
Mon Jul 1 02:08:37 2013 - [info] Master setting check done.
Mon Jul 1 02:08:37 2013 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..
Mon Jul 1 02:08:37 2013 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user=root --slave_host=192.168.1.2 --slave_ip=192.168.1.2 --slave_port=3306 --workdir=/var/log/masterha/app1 --target_version=5.0.77-log --manager_version=0.52 --relay_log_info=/var/lib/mysql/relay-log.info --slave_pass=xxx
Mon Jul 1 02:08:37 2013 - [info] Connecting to root@192.168.1.2(192.168.1.2)..
mysqlbinlog version is 3.2 (included in MySQL Client 5.0 or lower). This is not recommended. Consider upgrading MySQL Client to 5.1 or higher.
Checking slave recovery environment settings..
Opening /var/lib/mysql/relay-log.info ... ok.
Relay log found at /var/lib/mysql, up to mysql-relay-bin.000002
Temporary> Testing mysql connection and privileges.. done.
Testing mysqlbinlog output.. done.
Cleaning up test file(s).. done.
Mon Jul 1 02:08:37 2013 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user=root --slave_host=192.168.1.3 --slave_ip=192.168.1.3 --slave_port=3306 --workdir=/var/log/masterha/app1 --target_version=5.0.77-log --manager_version=0.52 --relay_log_info=/var/lib/mysql/relay-log.info --slave_pass=xxx
Mon Jul 1 02:08:37 2013 - [info] Connecting to root@192.168.1.3(192.168.1.3)..
mysqlbinlog version is 3.2 (included in MySQL Client 5.0 or lower). This is not recommended. Consider upgrading MySQL Client to 5.1 or higher.
Checking slave recovery environment settings..
Opening /var/lib/mysql/relay-log.info ... ok.
Relay log found at /var/lib/mysql, up to mysql-relay-bin.000002
Temporary> Testing mysql connection and privileges.. done.
Testing mysqlbinlog output.. done.
Cleaning up test file(s).. done.
Mon Jul 1 02:08:37 2013 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user=root --slave_host=192.168.1.4 --slave_ip=192.168.1.4 --slave_port=3306 --workdir=/var/log/masterha/app1 --target_version=5.0.77-log --manager_version=0.52 --relay_log_info=/var/lib/mysql/relay-log.info --slave_pass=xxx
Mon Jul 1 02:08:37 2013 - [info] Connecting to root@192.168.1.4(192.168.1.4)..
mysqlbinlog version is 3.2 (included in MySQL Client 5.0 or lower). This is not recommended. Consider upgrading MySQL Client to 5.1 or higher.
Creating directory /var/log/masterha/app1.. done.
Checking slave recovery environment settings..
Opening /var/lib/mysql/relay-log.info ... ok.
Relay log found at /var/lib/mysql, up to mysql-relay-bin.000002
Temporary> Testing mysql connection and privileges.. done.
Testing mysqlbinlog output.. done.
Cleaning up test file(s).. done.
Mon Jul 1 02:08:37 2013 - [info] Slaves settings check done.
Mon Jul 1 02:08:37 2013 - [info]
192.168.1.1 (current master)
+--192.168.1.2
+--192.168.1.3
+--192.168.1.4
Mon Jul 1 02:08:37 2013 - [info] Checking replication health on 192.168.1.2..
Mon Jul 1 02:08:37 2013 - [info] ok.
Mon Jul 1 02:08:37 2013 - [info] Checking replication health on 192.168.1.3..
Mon Jul 1 02:08:37 2013 - [info] ok.
Mon Jul 1 02:08:37 2013 - [info] Checking replication health on 192.168.1.4..
Mon Jul 1 02:08:37 2013 - [info] ok.
Mon Jul 1 02:08:37 2013 - [warning] master_ip_failover_script is not defined.
Mon Jul 1 02:08:37 2013 - [warning] shutdown_script is not defined.
Mon Jul 1 02:08:37 2013 - [info] Got exit code 0 (Not master dead).
MySQL Replication Health is OK.
这时用虚拟机的话得要做个快照,因为下面我们要进行两个小实验 这个实验是不可逆的
开启MHA进程
这时我们模拟主Mysql宕机,看看数据库是否能够切换到备份机上
service mysqld stop
在从属机中
mysql>show slave status \G