MHA主库宕机,binlog保存
1.配置MHA实时备份binlog
[ ~]# vim /service/mha/app1.cnf [ ~]# vim /service/mha/app1.cnf ...... [binlog1] # 把主库的binlog日志备份到本地 no_master=1 hostname=172.16.1.53 # 主库的ip # 不能跟当前机器数据库的binlog存放目录一样 master_binlog_dir=/root/binlog/
2.创建binlog存放目录
# 进入该目录 [ ~]# cd /root/binlog/ # 备份binlog [ binlog]# mysqlbinlog -R --host=172.16.1.52 --user=mha --password=mha --raw --stop-never mysql-bin.000001 &
3.手动执行备份binlog
# 进入该目录 [ ~]# cd /root/binlog/ #备份binlog [ binlog]# mysqlbinlog -R --host=172.16.1.52 --user=mha --password=mha --raw --stop-never mysql-bin.000001 &
4.重启MHA
[ binlog]# masterha_stop --conf=/service/mha/app1.cnf Stopped app1 successfully. [ binlog]# nohup masterha_manager --conf=/service/mha/app1.cnf --remove_dead_master_conf --ignore_last_failover < /dev/null > /service/mha/manager.log 2>&1 &
5.主库添加数据查看binlog
# 主库 mysql> create database mha; Query OK, 1 row affected (0.01 sec) [ ~]# ll /usr/local/mysql/data/mysql-bin.000008 -rw-rw---- 1 mysql mysql 67576 Jul 28 10:33 /usr/local/mysql/data/mysql-bin.000008 # MHA机器查看binlog [ binlog]# ll total 96 -rw-rw---- 1 root root 852 Jul 28 10:30 mysql-bin.000001 -rw-rw---- 1 root root 214 Jul 28 10:30 mysql-bin.000002 -rw-rw---- 1 root root 214 Jul 28 10:30 mysql-bin.000003 -rw-rw---- 1 root root 214 Jul 28 10:30 mysql-bin.000004 -rw-rw---- 1 root root 465 Jul 28 10:30 mysql-bin.000005 -rw-rw---- 1 root root 214 Jul 28 10:30 mysql-bin.000006 -rw-rw---- 1 root root 214 Jul 28 10:30 mysql-bin.000007 -rw-rw---- 1 root root 67576 Jul 28 10:33 mysql-bin.000008
相关推荐
herohope 2020-07-19
KFLING 2020-06-13
inhumming 2020-06-10
李高峰 2020-05-25
这些年来 2020-05-25
wiseMale 2020-05-11
ithzhang 2020-04-19
会哭的雨 2020-02-24
xiaojiang0 2020-02-22
康慧欣 2020-02-18
阿亮 2019-12-25
xiaobaif 2019-12-25
xiaoxiangyu 2019-12-23
ShiShuo 2019-12-23
贤冰 2019-12-19
herohope 2019-12-14
achiverhai 2019-12-06
mycosmos 2019-11-04