mysql主从复制1236错误
Posted warren
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql主从复制1236错误相关的知识,希望对你有一定的参考价值。
今天监控显示mysql主从复制出错了,信息如下:
mysql> show slave status\G; *************************** 1. row *************************** Slave_IO_State: Master_Host: 192.168.33.230 Master_User: repl Master_Port: 3306 Connect_Retry: 60 Master_Log_File: master-bin.000774 Read_Master_Log_Pos: 202924128 Relay_Log_File: 192-168-33-236-relay-bin.000065 Relay_Log_Pos: 202924292 Relay_Master_Log_File: master-bin.000774 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: 202924128 Relay_Log_Space: 202924521 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 ‘master-bin.000774‘ at 202924128, the last event read from ‘./master-bin.000774‘ at 4, the last byte read from ‘./master-bin.000774‘ at 4.‘ Last_SQL_Errno: 0 Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 1 Master_UUID: f7c24af7-a54a-11e6-88b4-525400169c04 Master_Info_File: /Data/mysql/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: 170817 15:37:11 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) ERROR: No query specified
在mysql.cnf里面有一句跳过经常出现的错误,但是还是报了1236错误
slave-skip-errors = 1062,1091,1396,1050,1060,1054,1146,1236
尝试stop slave ; start slave 还是没有恢复
然后就照着上面的错误提示更新pos点
mysql> stop slave; Query OK, 0 rows affected (0.01 sec) mysql> change master to master_log_file=‘master-bin.000774‘, master_log_pos=4; Query OK, 0 rows affected (0.12 sec) mysql> start slave; Query OK, 0 rows affected (0.00 sec)
然后查看状态就恢复正常了,具体原因再慢慢分析,,,,,,,
有时候还会报下面这个信息
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: ‘could not find next log; the first event ‘mysql-bin.001891‘ at 897184977, the last event read from ‘./mysql-bin.001891‘ at 1109808979, the last byte read from ‘./mysql-bin.001891‘ at 1109808979.‘
上面这个错误尝试stop slave ; start slave 就恢复了
以上是关于mysql主从复制1236错误的主要内容,如果未能解决你的问题,请参考以下文章