MySQL 5.5 升級 5.6 後,error.log 狂刷 Warning:Storing MySQL user name or password information in the master info repository is not secure...。業務極低寫入 (QPS 1, TPS ~0,4-10 秒才有一筆寫入),從庫頻繁發起重連,導致日誌暴增、監控誤報。根因在於 slave_net_timeout 默認值 (5.6 默認 60 秒,舊版 3600 秒) 與低寫入間隔不匹配。本文詳細分析重連機制並給出調優方案。
slave_net_timeout2015-02-03 15:44:51 19633 [Warning] Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE...
master.info 明文存儲 MASTER_USER, MASTER_PASSWORD。CHANGE MASTER TO 中指定密碼,改用 START SLAVE USER='...' PASSWORD='...' 語法。若檢測到明文密碼,每次重連/啟動 Slave 時都會打印上述 Warning。Slave IO Thread 與 Master 建立連接後,發送 COM_BINLOG_DUMP 請求 Binlog 事件。若超過 slave_net_timeout 秒未收到任何數據包 (含 Heartbeat),Slave 判定連接超時,主動發起重連。
master.info / slave_master_info 表中的憑證 → 檢測到明文密碼 → **打印 Warning**。| 版本 | 默認值 | 單位 | 備註 |
|---|---|---|---|
| ≤ 5.5 | 3600 | 秒 | 1 小時,極少觸發重連 |
| 5.6 / 5.7 | 60 | 秒 | 大幅降低,配合 MASTER_HEARTBEAT_PERIOD 使用 |
| 8.0 | 60 | 秒 | 同 5.6 |