Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow subscribeRetryWaitTimeMillis to be passed as argument to the JedisSentinelPool #1537

Closed
aosti opened this issue Jun 27, 2017 · 0 comments · Fixed by #2028
Closed

Allow subscribeRetryWaitTimeMillis to be passed as argument to the JedisSentinelPool #1537

aosti opened this issue Jun 27, 2017 · 0 comments · Fixed by #2028

Comments

@aosti
Copy link

aosti commented Jun 27, 2017

Hello, we are using your library with 1 master, 3 slaves and 4 sentinels in total. The code looks like:
`

    JedisSentinelPool pool = null;  
    Jedis jedis = null;
    String[] s = { ip1:port, ip2:port, ip3:port, ip4:port };
    Set<String> sentinels = new HashSet<String>();
    for (String sentinel : s) { sentinels.add(sentinel); }

    JedisPoolConfig poolConfig = new JedisPoolConfig();
    poolConfig.setMaxTotal(1);   // test configuration
    pool = new JedisSentinelPool("redis-cs-cluster", sentinels, poolConfig);
    jedis = pool.getResource();

    // Test operations
    int i = 0;
    while(true) {
        try {
            jedis.set("test", "a" + i);
            i++;
            Thread.sleep(2000);
        } catch (Exception e) {
            System.out.println(e.getMessage());
            if(jedis != null) {
            	jedis.close();
            }	
            jedis = pool.getResource();
	}
    }

`

After getting the Jedis instance and executing some jedis.set operations, the redis master instance died (killed by us to execute this test), and sentinel executed the failover. However, even after the failover, the MasterListener inside Jedis keeps throwing
Lost connection to Sentinel at 10.210.43.97:16380. Sleeping 5000ms and retrying.: redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused (Connection refused)
[Server:cluster-cs] at redis.clients.jedis.Connection.connect(Connection.java:207)
[Server:cluster-cs] at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:93)
[Server:cluster-cs] at redis.clients.jedis.Connection.setTimeoutInfinite(Connection.java:94)
[Server:cluster-cs] at redis.clients.jedis.Jedis.subscribe(Jedis.java:2678)
[Server:cluster-cs] at redis.clients.jedis.JedisSentinelPool$MasterListener.run(JedisSentinelPool.java:291)
after every 5s.
We know from our application, that we won't be able to reactivate that particular instance in less than 1 hour, causing too many messages to be added to the log file.

Is it possible to add subscribeRetryWaitTimeMillis as argument to some constructor of JedisSentinelPool?

We are using Java 8, Jedis 2.9.0 and Redis 3.2.8.

Thank you for your attention!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant