1. 程式人生 > 其它 >redis叢集:MASTER aborted replication with an error: NOAUTH Authentication required.

redis叢集:MASTER aborted replication with an error: NOAUTH Authentication required.

發現個問題:redis叢集所在伺服器,磁碟空間很快就被佔滿,使用 “du -sh *”檢視每個資料夾的大小,發現redis叢集三個從節點的日誌檔案佔用空間很大。

下面記錄問題排查及解決辦法:


1. redis叢集從節點日誌檔案

2. 檢視redis叢集從節點日誌檔案資訊

32947:S 12 Dec 2022 11:12:17.970 * Retrying with SYNC...
32947:S 12 Dec 2022 11:12:17.970 # MASTER aborted replication with an error: NOAUTH Authentication required.
32947:S 12 Dec 2022 11:12:17.970 * Reconnecting to MASTER 192.168.0.120:6691 after failure 32947:S 12 Dec 2022 11:12:17.970 * MASTER <-> REPLICA sync started 32947:S 12 Dec 2022 11:12:17.970 * Non blocking connect for SYNC fired the event. 32947:S 12 Dec 2022 11:12:17.970 * Master replied to PING, replication can continue
... 32947:S 12 Dec 2022 11:12:17.970 * (Non critical) Master does not understand REPLCONF listening-port: -NOAUTH Authentication required. 32947:S 12 Dec 2022 11:12:17.970 * (Non critical) Master does not understand REPLCONF capa: -NOAUTH Authentication required. 32947:S 12 Dec 2022 11:12:17.970 * Partial resynchronization not possible (no cached master)
32947:S 12 Dec 2022 11:12:17.971 # Unexpected reply to PSYNC from master: -NOAUTH Authentication required. 32947:S 12 Dec 2022 11:12:17.971 * Retrying with SYNC... 32947:S 12 Dec 2022 11:12:17.971 # MASTER aborted replication with an error: NOAUTH Authentication required. 32947:S 12 Dec 2022 11:12:17.971 * Reconnecting to MASTER 192.168.0.120:6691 after failure 32947:S 12 Dec 2022 11:12:17.971 * MASTER <-> REPLICA sync started 32947:S 12 Dec 2022 11:12:17.971 * Non blocking connect for SYNC fired the event. 32947:S 12 Dec 2022 11:12:17.971 * Master replied to PING, replication can continue... 32947:S 12 Dec 2022 11:12:17.971 * (Non critical) Master does not understand REPLCONF listening-port: -NOAUTH Authentication required. 32947:S 12 Dec 2022 11:12:17.971 * (Non critical) Master does not understand REPLCONF capa: -NOAUTH Authentication required. 32947:S 12 Dec 2022 11:12:17.971 * Partial resynchronization not possible (no cached master) 32947:S 12 Dec 2022 11:12:17.971 # Unexpected reply to PSYNC from master: -NOAUTH Authentication required. 32947:S 12 Dec 2022 11:12:17.971 * Retrying with SYNC... 32947:S 12 Dec 2022 11:12:17.971 # MASTER aborted replication with an error: NOAUTH Authentication required. 32947:S 12 Dec 2022 11:12:17.971 * Reconnecting to MASTER 192.168.0.120:6691 after failure 32947:S 12 Dec 2022 11:12:17.971 * MASTER <-> REPLICA sync started 32947:S 12 Dec 2022 11:12:17.971 * Non blocking connect for SYNC fired the event. 32947:S 12 Dec 2022 11:12:17.971 * Master replied to PING, replication can continue... 32947:S 12 Dec 2022 11:12:17.971 * (Non critical) Master does not understand REPLCONF listening-port: -NOAUTH Authentication required. 32947:S 12 Dec 2022 11:12:17.971 * (Non critical) Master does not understand REPLCONF capa: -NOAUTH Authentication required. 32947:S 12 Dec 2022 11:12:17.971 * Partial resynchronization not possible (no cached master) 32947:S 12 Dec 2022 11:12:17.971 # Unexpected reply to PSYNC from master: -NOAUTH Authentication required.

3. 問題原因

  原因是master節點設定了密碼,而在從節點的配置中,沒有配置masterauth引數導致的。

   當進行主從配置的時候,如果master節點開啟了安全機制並設定了密碼的話,就需要在從節點配置檔案中配置masterauth引數,該引數就是master節點的密碼(即master節點中requirepass引數的值),否則的話,master節點會拒絕同步請求。redis一直拋異常,檔案不斷增大,直至磁碟空間佔滿。

4. 解決辦法

   三個從節點的masterauth引數均配置密碼後,重啟redis叢集,問題解決。