久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

MySQL斷電出現(xiàn) Error 1236該怎么辦

153次閱讀
沒有評論

共計 1686 個字符,預(yù)計需要花費 5 分鐘才能閱讀完成。

MySQL 斷電出現(xiàn) Error 1236 該怎么辦,很多新手對此不是很清楚,為了幫助大家解決這個難題,下面丸趣 TV 小編將為大家詳細(xì)講解,有這方面需求的人可以來學(xué)習(xí)下,希望你能有所收獲。

今天幾臺 MySQL 服務(wù)器突然停電,重啟后復(fù)制無法啟動,總是報如下錯誤:

080922 10:29:01 [Note] Slave SQL thread initialized, starting replication in log mysql-bin.000778 at position 2874108, relay log
./relay-bin.003287 position: 2874245
080922 10:29:01 [Note] Slave I/O thread: connected to master replication@192.168.0.10:3306 ,  replication started in log mysql-b
in.000778 at position 2874108
080922 10:29:01 [ERROR] Error reading packet from server: Client requested master to start replication from impossible position (se
rver_errno=1236)
080922 10:29:01 [ERROR] Got fatal error 1236: Client requested master to start replication from impossible position from master wh
en reading data from binary log

[@more@]

為什么會報 impossible position 呢?打開 mysql-bin.000778 看看。

mysqlbinlog mysql-bin.000778 log.sql

tail -f log.sql

# at 2871574
#080922 10:20:27 server id 2  end_log_pos 2871601       Xid = 2516638
COMMIT/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/

最后一個 position 是 2871574,而從庫要從 2874108 開始,難怪報 impossible position,難道是斷電時有部分 log 在緩存中還沒來得及寫入 binglog?無論如何先恢復(fù)再說吧

stop slave;

CHANGE MASTER TO
MASTER_LOG_FILE= mysql-bin.000778 ,
MASTER_LOG_POS=2871574;

start slave;

show slave statusG

同步正常。。

后來查看主庫的啟動日志中這樣一段

InnoDB: Last MySQL binlog file position 0 2874108, file name ./mysql-bin.000778
080922 10:22:09  InnoDB: Started; log sequence number 6 2534366248
080922 10:22:09 [Note] Recovering after a crash using mysql-bin
080922 10:22:09 [Note] Starting crash recovery…
080922 10:22:09 [Note] Crash recovery finished.
080922 10:22:09 [Note] /usr/sbin/mysqld: ready for connections.

這里 Last MySQL binlog file position 0 2874108 也是錯誤的,這個信息到底是哪里來的呢?為什么會這樣呢?不明白。

為了保證以后 binglog 及時寫入,將主庫 sync_binlog 變量設(shè)置 1。

看完上述內(nèi)容是否對您有幫助呢?如果還想對相關(guān)知識有進(jìn)一步的了解或閱讀更多相關(guān)文章,請關(guān)注丸趣 TV 行業(yè)資訊頻道,感謝您對丸趣 TV 的支持。

正文完
 
丸趣
版權(quán)聲明:本站原創(chuàng)文章,由 丸趣 2023-07-19發(fā)表,共計1686字。
轉(zhuǎn)載說明:除特殊說明外本站除技術(shù)相關(guān)以外文章皆由網(wǎng)絡(luò)搜集發(fā)布,轉(zhuǎn)載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 宜宾市| 师宗县| 永定县| 柳林县| 浦县| 潮州市| 漳浦县| 大石桥市| 海宁市| 乌鲁木齐市| 措美县| 班戈县| 顺昌县| 云阳县| 磐安县| 乌苏市| 东台市| 昭通市| 通化市| 曲沃县| 景德镇市| 高阳县| 大安市| 来凤县| 屏边| 饶河县| 张家港市| 常宁市| 通城县| 木里| 伽师县| 克拉玛依市| 龙口市| 文成县| 屏东县| 玉溪市| 金华市| 威信县| 微山县| 玉龙| 汝州市|