MySQL主库服务器内存条异常致使机器频繁重启,替换内存条解决后,发现从库同步状态异常。主从同步已中止。现象以下:mysql
--登陆从库服务器,查看从库的数据库状态: mysql> show slave status\G Slave_IO_Running: No Slave_SQL_Running: Yes 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 'master-bin.000824' at 601236980, the last event read from './master-bin.000824' at 4, the last byte read from './master-bin.000824' at 4.'
[root@db-001 ~]# cd /data/mysql/data/ [root@db-001 data]# [root@db-001 data]# mysqlbinlog master-bin.000824 > masterbin000824.log [root@db-001 data]# tail -f masterbin000824.log #171206 8:54:08 server id 1 end_log_pos 601220873 CRC32 0x2ebaec99 Xid = 2190302874 end_log_pos 601220873 比 报错提示的601236980小不少,直接从这个点开始从新配置主从
mysql> change master to master_host='192.168.1.106',master_port=3306,master_user='repl',master_password='repl',master_log_file='master-bin.000824',master_log_pos=601220873;
mysql> show slave status\G Slave_IO_Running: Yes Slave_SQL_Running: Yes Last_IO_Errno: 0 Last_IO_Error:
判断主从彻底同步方式: 首先Master_Log_File和Relay_Master_Log_File所指向的文件必须一致。 其次Relay_Log_Pos和Exec_Master_Log_Pos的为止也要一致才行。