現(xiàn)象說明:老數(shù)據(jù)庫版本是5.6,新庫版本5.7,數(shù)據(jù)量不大,備份恢復數(shù)據(jù)均正常,配置主從使用gtid復制后也是正常的,第二天查看新庫的時候,發(fā)現(xiàn)新庫復制出現(xiàn)問題,報錯如下:
成都創(chuàng)新互聯(lián)公司主要從事網(wǎng)站設(shè)計、網(wǎng)站制作、網(wǎng)頁設(shè)計、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)冷水灘,十年網(wǎng)站建設(shè)經(jīng)驗,價格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):028-86922220
2019-10-10T10:15:27.541697+08:00 4256 [Warning] Master server does not support semi-sync, fallback to asynchronous replication
2019-10-10T10:15:29.993985+08:00 4257 [ERROR] Transaction is tagged with inconsistent logical timestamps: sequence_number (3546074770274598260) <= last_committed (8314045271803935669)
2019-10-10T10:15:29.994028+08:00 4257 [Warning] Slave SQL for channel '': Coordinator thread of multi-threaded slave is being stopped in the middle of assigning a group of events; deferring to exit until the group completion ... , Error_code: 0
2019-10-10T10:15:29.994052+08:00 4257 [ERROR] Slave SQL for channel '': Cannot execute the current event group in the parallel mode. Encountered event Gtid, relay-log name ./relay.000002, position 1090573 which prevents execution of this event group in parallel mode. Reason: The master event is logically timestamped incorrectly.. Error_code: 1755
2019-10-10T10:15:29.994066+08:00 4257 [Warning] Slave: Cannot execute the current event group in the parallel mode. Encountered event Gtid, relay-log name ./relay.000002, position 1090573 which prevents execution of this event group in parallel mode. Reason: The master event is logically timestamped incorrectly.. Error_code: 1755
2019-10-10T10:15:29.994070+08:00 4257 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'logbin.000015' position 234960156
2019-10-10T10:16:01.494097+08:00 4256 [Note] Slave I/O thread killed while reading event for channel ''
查看數(shù)據(jù)庫的變量參數(shù) slave_parallel_workers ,發(fā)現(xiàn)老庫的是0,串行復制,新庫的是4,并行組復制,根據(jù)網(wǎng)上查到的內(nèi)容,也是由于這個參數(shù)導致
修復方法:修改新庫的slave_parallel_workers 參數(shù)為0,清理數(shù)據(jù)庫,清理binlog 日志,恢復數(shù)據(jù),重建主從關(guān)系,主從復制OK