redis.clients.jedis.exceptions.JedisException: Can connect to sentinel, but seems to be not monitored.


在使用Redis的哨兵Sentinel配置時,報錯如下:

redis.clients.jedis.exceptions.JedisException: Can connect to sentinel, but myMaster seems to be not monitored.

報錯原因:

可能是因為哨兵配置sentinel.conf中的服務器名稱,和程序中哨兵連接池配置的服務器名稱不一致導致的。

解決方法:

查看哨兵配置 sentinel.conf,如下:

sentinel monitor mymaster 192.168.0.102  6379 2

其中的 哨兵配置中的服務器名稱為 mymaster。

接着再看java程序中的JedisSentinelPool配置的哨兵名稱:

  JedisSentinelPool sentinelPool=new JedisSentinelPool("myMaster",sentinelSet,jedisPoolConfig);

程序中的服務器名稱為myMaster。

可以看到,sentinel.conf中配置的服務器名稱和程序中的服務器名稱不一樣,因此報錯。。將程序中的服務器名稱改正就解決了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM