Reputation: 1
How Redis Cluster connection using redis plus plus ensures connection consistency in case the corresponding node shuts down ?
The documentation in https://github.com/sewenew/redis-plus-plus#redis-cluster states that "You only need to set one master node's host & port in ConnectionOptions, and RedisCluster will get other nodes' info automatically (with the CLUSTER SLOTS command)"
If the IP and port used to create the connection somehow goes down after establishing the connection, and the corresponding slave is automatically upgraded to master by Redis, does redis-plus-plus takes care of this? Or we may expect an error ?
Upvotes: 0
Views: 426
Reputation: 22936
Yes, redis-plus-plus will take care of this.
Once RedisCluster
is successfully constructed, it will get all nodes' IP and port with the CLUSTER SLOTS
command. Also if the cluster topology changes, e.g. master down, new master elected, redis-plus-plus automatically updates the info.
However, there's a time window between old master is down, and new master is elected. In this case, if your command is sent to the broken master, you'll get exception. Everything will remove to normal, once the new master is elected.
Upvotes: 0