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

Better support for standalone mode #69

Open
3 tasks
zuiderkwast opened this issue Nov 22, 2021 · 3 comments
Open
3 tasks

Better support for standalone mode #69

zuiderkwast opened this issue Nov 22, 2021 · 3 comments

Comments

@zuiderkwast
Copy link
Collaborator

Although hiredis-cluster is mainly for Redis Cluster, it is useful to also support Redis standalone instances. The benefit is that the same client and application code can be used regardless of the Redis configuration.

  • When connecting, we send a CLUSTER SLOTS command to figure out the slot mapping. If Redis replies with an error indicating that it's not in cluster mode, we can handle this implicitly and return a success code to the caller.
  • When updating the slot mapping, if we know that we're in standalone mode, there is no point sending the CLUSTER SLOTS command to Redis. It also does no harm doing so, but it's an extra call to Redis, so this bullet point is not of the highest priority.
  • We could allow a standalone option when connecting to the cluster, which is just an indication meaning that we guess that we're not in cluster mode. CLUSTER SLOTS is not sent when connecting, but if we later receive a MOVED redirect, the slot mapping is fetched and we switch to cluster mode. The default should be cluster mode though, since this is primarily a cluster client.
@andreasgerstmayr
Copy link
Contributor

Sounds great!

@psykro
Copy link

psykro commented Mar 25, 2022

Would love to have this ;)

Is it implemented yet ?

@zuiderkwast
Copy link
Collaborator Author

Would love to have this ;)

Is it implemented yet ?

Nope. Feel free to contribute! :)

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

No branches or pull requests

3 participants