redis 使用問題

背景:redis.conf設置密碼後,代碼裏面應該也要設置密碼

問題:redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication required.

操作:趕緊去看JedisPool,發現構造函數裏面剛好有個password 字段,毫不猶豫把密碼填進去。啓動,測試發現就報了上面的問題。
JedisPool

查了許久,終於在stackoverflow上找到了(點擊跳轉
)
Try setting your Redis password after using pool. I was having some problem with AUTH as well and then saw someone having similar problem with Lettuce by setting redis password before using pool. Change the order, once you set your factory to use pool, then set the password. The solution worked fine for me.

解決:jedisConnectionFactory.setPassword(password)

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