天天看點

MySQL5.7主從熱備的一個BUG導緻Slave_IO_Running:NO

[ERROR] Slave I/O for channel ”: The slave I/O thread stops because a fatal error is encountered when it try to get the value of SERVER_ID variable from master. Error: , Error_code: 0

為了使mysql讀寫分離,降低網站延遲,需要搭建主從熱備(主主熱備)。

分别嘗試了MySQL5.7.9,5.7.20版本,發現Slave_IO_Running:NO ,并一直報以上錯誤:

根據網上查詢的建議,重新開機MySQL多次,未能解決。

經過查閱官方的bug記錄發現,當slave賬戶權限不夠無法獲得master的一些資訊時可能會導緻這種錯誤

解決方式是在master節點進行授權并重新開機:

GRANT ALL PRIVILEGES ON . TO ‘slave’@’140.xxx.xxx.xxx’;

flush privileges;

這裡注意一定要重新開機才能使授權生效。

參考位址:https://bugs.mysql.com/bug.php?id=77732