查看同步状态:
具体错误:
?检查mysql数据库日记
2021-06-10T03:45:43.522398Z 1 [ERROR] Error reading packet from server for channel '': event read from binlog did not pass crc check; the first event 'mysql-bin.000669' at 1108554596, the last event read from './mysql-bin.000669' at 123, the last byte read from './mysql-bin.000669' at 1108561927. (server_errno=1236)
2021-06-10T03:45:43.522415Z 1 [ERROR] Slave I/O for channel '': Got fatal error 1236 from master when reading data from binary log: 'event read from binlog did not pass crc check; the first event 'mysql-bin.000669' at 1108554596, the last event read from './mysql-bin.000669' at 123, the last byte read from './mysql-bin.000669' at 1108561927.', Error_code: 1236
2021-06-10T03:45:43.522423Z 1 [Note] Slave I/O thread exiting for channel '', read up to log 'mysql-bin.000669', position 1108554596
根据错误日记? 查检binlog文件
mysqlbinlog mysql-bin.000669 --start-position=1108554596 --stop-position=1108561927
另外一种方法查看错误:
?
发现biglog文件损坏,正好是日记文件尾部?
mysqlbinlog -v --start-position=1108554596? mysql-bin.000669
?
?尾部文件损坏,查看下一份日 记文件头部是否正常,如果正常从下一份日记文件开始同步
?
STOP SLAVE;
变更同步文件
CHANGE MASTER TO MASTER_HOST='172.xx.xx.211', MASTER_PORT=3306, MASTER_USER='userName', MASTER_PASSWORD='xxxxxx', MASTER_LOG_FILE='mysql-bin.000670', MASTER_LOG_POS=0;
START SLAVE;
SHOW SLAVE STATUS \G
恢复正常,如下图:
?
#查看主从同步状态
SHOW SLAVE STATUS
#允许执行错误的sql数量
SET GLOBAL sql_slave_skip_counter=1
#启动同步
START SLAVE
#停止同步
STOP SLAVE