主从机器关机一段时间后,先启动了主库(因为设置了expire_logs_days参数,启动后就会自动删除过期的binlog),启动从库后,发现从库报如下错误,找不到主库的binlog了
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'
一种方法是重新部署主从(主库已经有业务数据写入),另一种方法是:若发现主库业务使用的话,可以尝试使用如下方式:
/home/middle/mysql57/bin/mysql -h localhost -uroot -P13306 -p
mysql> stop slave;
mysql> reset slave;
mysql> reset master;
主库获取gtid
mysql> show master status \G;
*************************** 1. row ***************************
File: binlog.033206
Position: 154
Binlog_Do_DB:
Binlog_Ignore_DB:
Executed_Gtid_Set: 20c37c3a-a2aa-11eb-9a6b-fa163e89c1d3:1-62580571
1 row in set (0.00 sec)
mysql> set global gtid_purged='20c37c3a-a2aa-11eb-9a6b-fa163e89c1d3:1-62580571';
这个gtid是从主库上获取的
mysql>change master to master_host='192.168.1.100',
master_user='repuser',
master_password='123456',
master_port=13306,
master_auto_position=1;
mysql>start slave;
标签:主库,1236,Last,Error,master,mysql,fatal From: https://www.cnblogs.com/hxlasky/p/18530221