MHA高可用修复过程

故障处理:

1. 检查MHA状态

[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状态:

[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. 确认主库,恢复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. 检查主从状态

[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

你可能感兴趣的:(MHA高可用修复过程)