无法使用绝地连接redis sentinel
我正试图使用绝地武士池连接到redis sentinel无法使用绝地连接redis sentinel,redis,redis-sentinel,Redis,Redis Sentinel,我正试图使用绝地武士池连接到redis sentinel private static final JedisSentinelPool pool = new JedisSentinelPool("mymaster", getSentinels()); private static Set<String> getSentinels(){ Set<String> mysentinels = new HashSet<>(); mysentinel
private static final JedisSentinelPool pool = new JedisSentinelPool("mymaster", getSentinels());
private static Set<String> getSentinels(){
Set<String> mysentinels = new HashSet<>();
mysentinels.add(new HostAndPort("localhost", 26379).toString());
return mysentinels;
}
我得到了以下错误:
无法连接到Redis-1:26379处的Redis:nodename或servname,或者未知
这里有什么问题?确保
sentinel.conf
文件中的保护模式
设置为否
。这解决了我的问题。使用localhost而不是127.0.0.1对我来说很有效
默认情况下,无法从不同于的接口访问Sentinel
localhost,或者使用“bind”指令绑定到网络
接口,或使用“保护模式编号”禁用保护模式
将其添加到此配置文件
我面临着类似的问题。提供了sentinel路径,我已从redis cli检查sentinel是否正在运行。但我还是得到了同样的例外。
./redis-cli -h redis-1 -p 26379