MySQL主从问题 Error_code: 1236

备机报错信息:

2020-04-27 14:51:48 2265 [ERROR] Error reading packet from server: Client requested master to start replication from position > file size; the first event 'mysql-bin.000010' at 16868418, the last event read from '/dom/loglink/mysql/mysql-bin.000010' at 4, the last byte read from '/dom/loglink/mysql/mysql-bin.000010' at 4. (server_errno=1236)
2020-04-27 14:51:48 2265 [ERROR] Slave I/O: Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from position > file size; the first event 'mysql-bin.000010' at 16868418, the last event read from '/dom/loglink/mysql/mysql-bin.000010' at 4, the last byte read from '/dom/loglink/mysql/mysql-bin.000010' at 4.', Error_code: 1236
2020-04-27 14:51:48 2265 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000010', position 16868418

在备机上执行命令查看slave状态:show slave status\G;

Master_Log_File: mysql-bin.000010
Read_Master_Log_Pos: 16868418
Last_IO_Errno: 1236
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from position > file size; the first event 'mysql-bin.000010' at 16868418, the last event read from '/dom/loglink/mysql/mysql-bin.000010' at 4, the last byte read from '/dom/loglink/mysql/mysql-bin.000010' at 4.'
Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it

说明:

(1)mysql-relay-bin.0000xx文件记录的是本机数据库的操作记录日志
(2)mysql-relay-bin.0000xx文件为从另一个master机器拉取的binlog日志,通过该log文件同步数据。

处理方案:

根据binlog记录的最后一次同步位置,重置备机同步记录信息,重新同步:

stop slave;
reset slave all;
change master to master_host='master-ip', master_port=3306, master_user='user', master_password='passwd', master_log_file='mysql-bin.000010', master_log_pos=4;
start slave;

注:如果是mysql双主环境,则别再两台机器上执行如上 类似操作即可

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值