【開發心得】Springboot 使用 redis 哨兵

在項目落地實施的過程中,因爲不仔細導致踩了個不是坑的小坑,配置中心用的是Apollo,配置都很正常,但是 redis的配置寫的有點問題,特此記錄。

問題1:
Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: READONLY You can't write against a read only slave.

解決方案:

  檢查redis集羣中的所有的節點配置,是否存在 只讀

問題2:

NOAUTH Authentication required.

排查:

1)首先確保密碼設置是否正確

2)如果是springboot項目,並且是yaml配置文件,檢查下是不是縮進問題.

#-------------------------------------#
  #----------- redis Settings ----------#
  #-------------------------------------#

  redis:
    password: HMA2020
    sentinel:
      master: mymaster
      nodes: xxxx.xxxx.xxxx.xxxx:26379,xxxx.xxxx.xxxx.xxxx:26379,xxxx.xxxx.xxxx.xxxx:26379

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