How to enable auto reconnect of redis connection in Jedis client

Viewed 6105

I have an application that stores and reads date in Redis. When Redis goes down and then comes back up, the Jedis connection is not being recreated.

Is there is a way to create a connection retry in Jedis?

2 Answers

You may use JedisPool. In case of broken connection JedisPool just invalidates broken connections.

Also you could use Redisson Redis Java client which has internal ConnectionWatchDog to avoid broken connections. Redisson exposes few settings to control Redis command retry logic: retryAttempts, retryInterval, timeout

Related