support cluster mode emulation
Dragonfly currently does not support cluster mode. However, being a single node, it can support clients that are configured to work with cluster-mode redis.
Suggested feature:
- add support for flag
cluster_mode. The flag should only accept "emulate" or empty value. - Add support for "CLUSTER" super command. Specifically, it should return an error if
cluster_modeis empty. ifcluster_modeisemulateit should support sub-commands HELP and SLOTS. HELP should explain how all other commands works, seeDEBUGsuper command for example. - For SLOTS, it should return itself as the master for all slots according to redis format. It should return the bind IP unless an override flag
cluster-announce-ipis specified. In that case, the value of that flag should be returned. (the flag is useful for NAT environments like containers, k8s etc). - A py-test should be added that confirms that a cluster redis client works well with dragonfly. See here, https://aws.amazon.com/blogs/opensource/new-cluster-mode-support-in-redis-py/ for example.
@romange, I'll work on this.
Could you clarify the following questions, please?
-
cluster_modeandcluster-announce-ipare flags specified on the dragonfly start-up? Likedragonfly --cluster_mode=emulate --cluster-announce-ip=127.0.0.1? I ask because one has underscore and the other hífen, shouldn't they be on the same format? I think in Redis thecluster-announce-ipis configured on a .conf file. -
So far the CLUSTER HELP command should only display information about SLOTS and HELP right? CLUSTER SLOTS is deprecated on Redis 7. If I got the time I'll try to implement CLUSTER SHARDS also.
Hi Leo, thanks for working on this.
- You are right - everything should be with underscores since this is what absl flags support.
- Most clients do not yet support redis 7.0 api and they query for shards via "cluster slots" command. I suggest that we implement this first.