Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法使用绝地连接redis sentinel_Redis_Redis Sentinel - Fatal编程技术网

无法使用绝地连接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

我正试图使用绝地武士池连接到redis sentinel

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