Closed akshaypatidar1999 closed 1 month ago
Hi @akshaypatidar1999 thanks for your issue. This is indeed a highly requested feature. We can break the task into 2 areas:
The same, similar logic should also apply to sentinel mode.
This also means that the static factories createClient() : Redis
should become asynchronous too, as we may need to perform discovery for cluster/sentinel
.
So, we either deprecate the old blocking API or leave it with a warning on the javadoc that that mode will only work for single node or replication mode.
Is there any plan to pick this feature? I am willing to contribute to this feature.
Are there any plans for implementing this ? We are facing similar issue in quarkus when the bitnami redis running in sentinel mode switches the master node.
I assume the root cause is the same as described here
@pmlopes @vietj I will happy to contribute to this feature. We have internally created a wrapper over vertx redis client in which we periodically fetch the cluster state using CLUSTER SLOTS
and CLUSTER INFO
command and store the state in memory. Whenever we detect any change in the state we create new connections to the redis cluster and close existing connections gracefully. Similar approach can be used here. What do you gus think?
@akshaypatidar1999 If you have any ideas - I guess you can fork the repo and create a PR
Describe the feature
Refresh connections to redis cluster whenever there is a change in cluster
Current redis client implementation creates connections to redis cluster and uses them to send requests to redis cluster. However if redis cluster is changed (new shards/replicas are added/deleted) then it does not automatically refreshes the connection, due to which we see errors like
MOVED 7652 10.0.4.210:6379
and we have to redeploy our service.If we could somehow detect changes in the cluster and refresh connections then we can get rid of deploying whenver we scale/downscale redis cluster
One simple solution I can think of is to save the cluster information when connecting to cluster for the first time using
CLUSTER INFO/CLUSTER SLOTS
command. Then periodically run this command and if there is any change in the cluster we can refresh the connections.Use cases
Contribution
I am willing to contribute to this feature.