集群删除槽范围
Syntax
CLUSTER DELSLOTSRANGE start-slot end-slot [start-slot end-slot ...]
- Available since:
- 7.0.0
- Time complexity:
- O(N) where N is the total number of the slots between the start slot and end slot arguments.
- ACL categories:
-
@admin
,@slow
,@dangerous
,
CLUSTER DELSLOTSRANGE
命令与 CLUSTER DELSLOTS
命令类似,它们都从节点中移除哈希槽。
区别在于 CLUSTER DELSLOTS
接受一个哈希槽列表来从节点中移除,而 CLUSTER DELSLOTSRANGE
接受一个槽范围列表(由起始和结束槽指定)来从节点中移除。
Example
要从节点中移除槽位1 2 3 4 5,CLUSTER DELSLOTS
命令是:
> CLUSTER DELSLOTS 1 2 3 4 5
OK
相同的操作可以通过以下CLUSTER DELSLOTSRANGE
命令完成:
> CLUSTER DELSLOTSRANGE 1 5
OK
然而,请注意:
- 该命令仅在所有指定的槽位已经与节点关联时才有效。
- 如果多次指定相同的插槽,命令将失败。
- 作为命令执行的副作用,节点可能会进入down状态,因为并非所有哈希槽都被覆盖。
在Redis集群中的使用
此命令仅在集群模式下有效,可能对调试和在新集群创建时手动编排集群配置有用。目前redis-cli
未使用此命令,主要存在是为了API的完整性。
RESP2/RESP3 回复
Simple string reply:OK
if the command was successful. Otherwise an error is returned.