How about a JOINSHARD primitive? I think it makes more sense to expose a high level construct around shards, as opposed to letting admins manipulate the shard-id directly. Specifically, I propose the below:

A node N can explicitly join a shard S as identified by its <shard-id> via CLUSTER JOINSHARD <shard-id> * If shard S is not empty, N will try locating its primary P and initiate replication, as long as it sees one live node in S * otherwise, if all nodes in S are permanently down, N should attempt a manual failover * otherwise, there is no node in S and this means that the cluster is not aware of this shard at all. I'd propose we fail the JOINSHARD request.

For completeness, the following two have been implemented in this PR: 1. A new node N always starts out in its own shard with an auto-generated shard-id 2. A node N implicitly joins an existing shard via CLUSTER REPLICATE <primary-node-id>

Originally posted by @PingXie in https://github.com/redis/redis/pull/10536#discussion_r902085169