mysql 主从同步 Client requested master to start replication from position > file size; the first even...

MYSQL Manual for more information.
2019-07-13 09:49:06 2844 [Note] Slave I/O thread: connected to master '[email protected]:3306',replication started in log 'log-bin.000567' at position 121779612
2019-07-13 09:49:06 2844 [Warning] Slave SQL: If a crash happens this configuration does not guarantee that the relay log info will be consistent, Error_code: 0
2019-07-13 09:49:06 2844 [Note] Slave SQL thread initialized, starting replication in log 'log-bin.000567' at position 121779515, relay log '/data/mysql/log-relay/log-relay.000046' position: 121779676
2019-07-13 09:49:06 2844 [ERROR] Error reading packet from server: Client requested master to start replication from position > file size; the first event 'log-bin.000567' at 121779612, the last event read from '/data/mysql/log-bin/log-bin.000567' at 4, the last byte read from '/data/mysql/log-bin/log-bin.000567' at 4. (server_errno=1236)
2019-07-13 09:49:06 2844 [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 'log-bin.000567' at 121779612, the last event read from '/data/mysql/log-bin/log-bin.000567' at 4, the last byte read from '/data/mysql/log-bin/log-bin.000567' at 4.', Error_code: 1236
2019-07-13 09:49:06 2844 [Note] Slave I/O thread exiting, read up to log 'log-bin.000567', position 121779612
2019-07-13 09:49:06 2844 [Note] Event Scheduler: Loaded 0 events
2019-07-13 09:49:06 2844 [Note] /usr/local/mysql/bin/mysqld: ready for connections.

主库上查看log-bin.000567 文件 tail -100

[root@usserver1 mysql]# mysqlbinlog log-bin.000567 > /tmp/log-bin.000567.log
[root@usserver1 mysql]# tail -10 /tmp/log-bin.000567.log

log-bin.000567文件最后几行 发现最后偏移量是121521539,上面的121779515远大于这个121521539,也就是参数sync_binlog=1000导致的。

/*!*/;
# at 121521539
#190712 14:39:15 server id 54  end_log_pos 121521570 CRC32 0x6b3c6680   Xid = 137561829
COMMIT/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;

从库上执行

stop slave;
change master to master_log_file='log-bin.000567',master_log_pos=121521539;
start slave;

你可能感兴趣的:(mysql 主从同步 Client requested master to start replication from position > file size; the first even...)