Dynamic Topology refresh in Jedis

Viewed 346

I have a multi-master redis cluster configuration hosted in Kubernetes cluster. We connect to the redis via hostname of load balancer using Jedis Library. hostname is prod-redis-cluster.xyz.com. T When there is a patching to redis nodes, IP address of the load balancer does not change whereas the IP address of the actual Redis nodes behind the load balancer changes. However, application loses connectivity to the cluster and it re-establishes only when we restart the application.

We use JEDIS Client library. The sample code is present here.

Spring - Redis Cluster Configuration for Redis Hosted in K8s environment

Lettuce client of Jedis provides an option to refresh the topology dynamically at specific intervals. Please refer the below link.

https://lettuce.io/core/release/api/io/lettuce/core/cluster/ClusterTopologyRefreshOptions.html

redis:
cluster:
 nodes:
lettuce:
  cluster:
    refresh:
      adaptive: true
      period: 5m
timeout: 150

and 

 
`RefreshOptions R = ClusterTopologyRefreshOptions.builder()          
  .dynamicRefreshSources(false).enablePeriodicRefresh(true).build()

The above mentioned code helps in resolving the issue in Lettuce. How to achieve the same in Jedis?

0 Answers
Related