ERROR 1858 (HY000): sql_slave_skip_counter can not be set when the server is running with GTID_MO...

發(fā)現(xiàn)Mysql主從不同步,找到解決方案:
mysql > stop slave;
mysql > set global sql_slave_skip_counter =1;
mysql > start slave;
但是在執(zhí)行第二步的時候報錯:
ERROR 1858 (HY000): sql_slave_skip_counter can not be set when the server is running with GTID_MODE = ON. Instead, for each transaction that you want to skip, generate an empty transaction with the same GTID as the transaction

通過分析原來是Gtid的同步方式,需要通過Gtid來修復(fù)
mysql> show slave status\G;


image.png

上圖中是表示正常的。懶的模擬環(huán)境了,比如有下列情況:
Retrieved_Gtid_Set: ffd80980-c7cb-11e9-beda-0050569051da:1-8 檢索到主已經(jīng)8個事務(wù)了。
ffd80980-c7cb-11e9-beda-0050569051da這個是表示主的UUID,唯一的
Executed_Gtid_Set: c46aebe0-c8e9-11e9-8057-005056a20520:1-135710,
ffd80980-c7cb-11e9-beda-0050569051da:1-7 表示從上已經(jīng)執(zhí)行了7個事務(wù)了。
如果是這種情況,可采用下列方法修復(fù):
mysql > stop slave;
mysql >SET GTID_NEXT=' ffd80980-c7cb-11e9-beda-0050569051da:8';
mysql > begin;commit;
mysql > SET GTID_NEXT="AUTOMATIC";
mysql > start slave;

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容