故障處理:
1. 檢查MHA狀態(tài)
[root@db03 ~]# masterha_check_status --conf=/etc/mha/app1.cnf
2. 檢查配置文件
[server default]
manager_log=/var/log/mha/app1/manager
manager_workdir=/var/log/mha/app1
master_binlog_dir=/data/binlog
master_ip_failover_script=/usr/local/bin/master_ip_failover
password=mha
ping_interval=2
repl_password=123
repl_user=repl
report_script=/usr/local/bin/send
ssh_user=root
user=mha
[server1]
hostname=10.0.0.51
port=3306
[server2]
hostname=10.0.0.52
port=3306
[server3]
hostname=10.0.0.53
port=3306
[binlog1]
no_master=1
hostname=10.0.0.53
master_binlog_dir=/data/mysql/binlog
3. 檢查ssh狀態(tài):
[root@db03 ~]# masterha_check_ssh --conf=/etc/mha/app1.cnf
4. 檢查腳本
[root@db03 /usr/local/bin]# ls -l /usr/local/bin/
5. 檢查binlogserver
[root@db03 /usr/local/bin]# ps -ef |grep mysqlbinlog
6. 確認主庫,恢復(fù)binlog_server
db01 [(none)]>show master status
+------------------+----------+--------------+------------------+------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+------------------------------------------+
| mysql-bin.000006 | 194 | | | a5260572-c262-11e9-bab1-000c2980e248:1-2 |
+------------------+----------+--------------+------------------+------------------------------------------+
1 row in set (0.00 sec)
[root@db03 /usr/local/bin]# cd /data/mysql/binlog/
[root@db03 /data/mysql/binlog]# rm -rf *
[root@db03 /data/mysql/binlog]# mysqlbinlog -R --host=10.0.0.51 --user=mha --password=mha --raw --stop-never mysql-bin.000006 &
7. 檢查主庫vip
[root@db01 ~]# ifconfig eth0:1 10.0.0.55/24
8. 檢查主從狀態(tài)
[root@db03 /data/mysql/binlog]# masterha_check_repl --conf=/etc/mha/app1.cnf
9. 啟動MHA
nohup masterha_manager --conf=/etc/mha/app1.cnf --remove_dead_master_conf --ignore_last_failover < /dev/null > /var/log/mha/app1/manager.log 2>&1 &
[root@db03 ~]# masterha_check_status --conf=/etc/mha/app1.cnf
app1 (pid:8255) is running(0:PING_OK), master:10.0.0.51