admin管理员组文章数量:1611902
--73从服务器报错 连接70主服务器失败(因为70服务器重启过),
说明:正常只要 #skip-slave-start 注释掉这个参数 复制进程就可以随着mysqld服务自启动,
但这里因为70主服务器的参数sync_binlog=1000的原因,不会实时的刷新数据到binlog文件中,
而是在os缓存中,1000条后统一fsync到磁盘的binlog文件中,
73从服务器可以读到70主服务器产生的 binlog 此时70主服务器恢复后,73从服务器接着之前的位点重新拉binlog,
但是70主服务器由于没有fsync最后的binlog,所以会返回1236 的错误。
正常建议配置sync_binlog=1 也就是每个事务都立即写入到binlog文件中
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 192.168.65.70
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000239
Read_Master_Log_Pos: 536592776
Relay_Log_File: mysql-relay-bin.000015
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.000239
Slave_IO_Running: No
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 536592776
Relay_Log_Space: 120
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
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.000239' at 536592776, the last event read from '/var/lib/mysql/mysql-bin.000239' at 4, the last byte read from '/var/lib/mysql/mysql-bin.000239' at 4.'
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID: 6352c503-d563-11e6-8254-192168065070
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp: 190201 04:05:35
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
1 row in set (0.00 sec)
--70主服务器查看mysql-bin.000239 文件 tail -100
[root@usserver1 mysql]# mysqlbinlog mysql-bin.000239 > binlog_bak_000239
[root@usserver1 mysql]# tail -10 binlog_bak_000239
--mysql-bin.000239 文件最后几行 发现最后偏移量是536037651,上面的536592776远大于这个536037651,也就是参数sync_binlog=1000导致的。
'/*!*/;
# at 536037651
#190131 15:23:00 server id 1 end_log_pos 536037682 CRC32 0x1d637583 Xid = 31487301
COMMIT/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--73从服务器重新配置 即可
stop slave;
change master to master_log_file='mysql-bin.000239',master_log_pos=536037651;
start slave;
本文标签: 主从不同步CLIENTrequestedmysql
版权声明:本文标题:Mysql主从不同步问题 1236:Client requested master to start replication from position > file size; the first 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1728607785a1165670.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论