部署mysql主从报错[1236]:
Slave_IO_Running: No
....
Last_IO_Errno: 1236
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires.'
出现原因:
1.在主库上手动执行清除二进制日志文件
2.主库重启,重新同步时
解决:
- 查看主库的gtid_purged
mysql> show global variables like '%gtid%'\G
*************************** 7. row ***************************
Variable_name: gtid_purged
Value: 0998f0f4-df8c-11e9-9a7f-000c29ed02cd:1-2
-
去从库中重置相关同步信息,并在从库上重新设置gtid_purged,值为主库中查询到的gtid_purged.
–> stop slave
–> reset slave
–> reset master
–> set global gtid_purged = ‘0998f0f4-df8c-11e9-9a7f-000c29ed02cd:1-2’; -
修改完成后再去重新change master
–> edit
–> start slave;
–> show slave status\G
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
- 配置完成