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双主环境,则别再两台机器上执行如上 类似操作即可

 

你可能感兴趣的:(数据库)