我正在为我的应用程序配置Redis,并且我能够成功连接为单个主设置,但是当我尝试使用哨兵时,出现了错误:可以连接到哨兵,但可以是master-1;似乎没有受到监视...
已经检查了redis前哨配置,该配置在其中触发命令get-master-addr-by-name来获取所有主服务器的ip和端口,但是无法这样做
能够通过redis-cli获取按名称获取get-master-addr-by的结果,其中返回了实际的主IP和端口。
10.144.108.149:27568> SENTINEL get-master-addr-by-name master-1 1)“ 10.144.108.146” 2)“ 7568”
在启动Spring Boot时获取以下stacktrace
Caused by: redis.clients.jedis.exceptions.JedisException: Can connect to sentinel, but master-1; seems to be not monitored...
at redis.clients.jedis.JedisSentinelPool.initSentinels(JedisSentinelPool.java:177) ~[jedis-2.9.0.jar:na]
at redis.clients.jedis.JedisSentinelPool.<init>(JedisSentinelPool.java:95) ~[jedis-2.9.0.jar:na]
at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.createRedisSentinelPool(JedisConnectionFactory.java:368) ~[spring-data-redis-2.1.8.RELEASE.jar:2.1.8.RELEASE]
at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.createPool(JedisConnectionFactory.java:352) ~[spring-data-redis-2.1.8.RELEASE.jar:2.1.8.RELEASE]
at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.afterPropertiesSet(JedisConnectionFactory.java:341) ~[spring-data-redis-2.1.8.RELEASE.jar:2.1.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1837) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
... 16 common frames omitted