We are migrating from old redis to redis-cluster. Due to history reasons, we have to remove the "cross slot" check. So I want to know, why don't support cross slot keys?What's the concern?

Thanks

Comment From: itamarhaber

Hello @xstackeye

The cluster does not support multi-key operations across slots as different slots may reside on different shards. The cluster doesn't support distributed operations, that is across more than one server, hence the limitation.

Keep in mind that this issue tracker should be used for reporting bugs or proposing improvements to the Redis server. Questions should be directed to the community:

Comment From: mgravell

Just to expand on what @itamarhaber said:

If you're doing a cross-slot operation, you are doing something very wrong; now, it could be that as it happens those 2 slots resolve to the same shard today by pure chance, but the entire point of the cluster topology is to create an abstraction over the slot/shard map - allowing that to change at any point as needed. Ultimately, a cross-slot operation is always wrong; if the server didn't complain, it would allow you to overlook that you've failed to consider sharding when choosing your keys. More importantly, it kicks a major problem down the road, ready to explode when some well-meaning sysadmin reshards the cluster to balance load - something that is meant to be safe. The server actively prevents you from getting into that situation.

If you need multi-key operations on cluster, you should be either:

  • using "hash tags", i.e. "{foo}/something" and "{foo}/somethingelse" will always be on the same slot, as the slot is calculated on the "foo", not the full key name
  • performing 2 separate operations and combining/coordinating them at the client

Comment From: itamarhaber

Closing - feel free to reopen or create a new issue if required.