關於Redis配置主從複製踩到的坑!!!

設置單機集羣的時候,兩臺從機都顯示連接到主機,但是主機顯示連接到的從機數量爲0:

主機信息:
在這裏插入圖片描述
從機80:

從機81:
在這裏插入圖片描述
查看從機log日誌文件發現錯誤信息:

MASTER aborted replication with an error: NOAUTH Authentication required.

主庫master要求密碼驗證!
因爲之前配置redis的密碼,在配置文件中將requirepass註釋掉即可!
重啓Redis,成功!!!
在這裏插入圖片描述
所以:

  • 對於Redis集羣,如果設置了requirepass,則一定要設置masterauth,否則從節點無法正常工作!!!

其實仔細閱讀redis.conf文件會發現:
redis說明了

# If the master is password protected (using the "requirepass" configuration
# directive below) it is possible to tell the replica to authenticate before
# starting the replication synchronization process, otherwise the master will
# refuse the replica request.
#
# masterauth <master-password>

翻譯:

如果主服務器是密碼保護的(使用“requirepass”配置)

可以告訴副本在之前進行身份驗證

啓動複製同步進程,否則主進程將執行此操作

拒絕複製請求。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章