dragonfly icon indicating copy to clipboard operation
dragonfly copied to clipboard

support cluster mode emulation

Open romange opened this issue 3 years ago • 2 comments

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:

  1. add support for flag cluster_mode. The flag should only accept "emulate" or empty value.
  2. Add support for "CLUSTER" super command. Specifically, it should return an error if cluster_mode is empty. if cluster_mode is emulate it should support sub-commands HELP and SLOTS. HELP should explain how all other commands works, see DEBUG super command for example.
  3. 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-ip is specified. In that case, the value of that flag should be returned. (the flag is useful for NAT environments like containers, k8s etc).
  4. 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 avatar Sep 27 '22 11:09 romange

@romange, I'll work on this.

Could you clarify the following questions, please?

  1. cluster_mode and cluster-announce-ip are flags specified on the dragonfly start-up? Like dragonfly --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 the cluster-announce-ip is configured on a .conf file.

  2. 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.

lsvmello avatar Nov 11 '22 21:11 lsvmello

Hi Leo, thanks for working on this.

  1. You are right - everything should be with underscores since this is what absl flags support.
  2. 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.

romange avatar Nov 11 '22 21:11 romange