CLUSTER ADDSLOTS slot [slot ...]
This command is useful in order to modify a node's view of the cluster configuration. Specifically it assigns a set of hash slots to the node receiving the command. If the command is successful, the node will map the specified hash slots to itself, and will start broadcasting the new configuration.
However note that:
importing, this state gets cleared once the node assigns the (previously unbound) slot to itself.
For example the following command assigns slots 1 2 3 to the node receiving the command:
> CLUSTER ADDSLOTS 1 2 3 OK
However trying to execute it again results into an error since the slots are already assigned:
> CLUSTER ADDSLOTS 1 2 3 ERR Slot 1 is already busy
This command only works in cluster mode and is useful in the following Redis Cluster operations:
Note that once a node assigns a set of slots to itself, it will start propagating this information in heartbeat packet headers. However the other nodes will accept the information only if they have the slot as not already bound with another node, or if the configuration epoch of the node advertising the new hash slot, is greater than the node currently listed in the table.
This means that this command should be used with care only by applications orchestrating Redis Cluster, like
redis-trib, and the command if used out of the right context can leave the cluster in a wrong state or cause data loss.
Simple string reply:
OK if the command was successful. Otherwise an error is returned.
© 2009–2020 Salvatore Sanfilippo
Licensed under the Creative Commons Attribution-ShareAlike License 4.0.