【MySQL案例】HA: GTID_MODE配置不一致

來源:互聯網
上載者:User

1.1.1. HA: GTID_MODE配置不一致

【環境描述】

msyql5.6.14

【報錯資訊】

初始狀態Master和Slave都開啟了enforce-gtid-consistency和gtid-mode,然後在Master上把它倆都修改成了off關閉狀態,這時,Slave發生報錯:

Last_IO_Error: The slave IO thread stopsbecause the master has @@GLOBAL.GTID_MODE OFF and this server has@@GLOBAL.GTID_MODE ON

【報錯原因】

MySQL的Master和Slave必須同時開啟或者關閉enforce-gtid-consistency和gtid-mode功能,即要保持一致。

【解決方案】

關閉Slave上的enforce-gtid-consistency和gtid-mode功能。

 

【參考資料】

gtid-mode用來設定是否開啟GTID功能,如果要開啟GTID功能,需要同時開啟log-bin和log_slave_updates功能,另外還需要開啟enforce_gtid_consistency功能。gtid_mode參數可以設定為on、off、upgrade_step_1、upgrade_step_2四種值,其中upgrade_step_1和upgrade_step_2是給將來mysql可能的新功能預留的,對當前的myql沒有任何意義。同時,mysql建議在mysql_upgrade的時候,關閉gtid_mode功能和enforce_gtid_consistency功能,因為Mysql在upgrade期間可能會操作非事務的MyISAM儲存引擎表,會引起報錯。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.