2

I am trying to connect to redis sentinel using JedisSentinelPool

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;
}

This gives me following error :

Caused by: redis.clients.jedis.exceptions.JedisConnectionException: All sentinels down, cannot determine where is mymaster master is running...

However, I can see that my sentinel is running. So referring to this post: https://github.com/luin/ioredis/issues/64 I tried the below command on my redis master server

./redis-cli -h redis-1 -p 26379

I got following error:

Could not connect to Redis at redis-1:26379: nodename nor servname provided, or not known

What is the issue here?

Shubham
  • 2,847
  • 4
  • 24
  • 37
Manas Saxena
  • 2,171
  • 6
  • 39
  • 58
  • I am facing a similar issue. Provided the sentinel path and I've checked from the `redis-cli` that my sentinel is running. Still I am getting the same exception. – Shubham Nov 22 '18 at 08:11

2 Answers2

5

Use localhost instead of 127.0.0.1 works for me.

By default Sentinel will not be reachable from interfaces different than localhost, either use the 'bind' directive to bind to a list of network interfaces, or disable protected mode with "protected-mode no" by adding it to this configuration file.

softwarevamp
  • 827
  • 10
  • 14
1

Make sure that protected-mode is set to no in sentinel.conf file. This solved issue for me.

Shubham
  • 2,847
  • 4
  • 24
  • 37