SSUBSCRIBE
Syntax
SSUBSCRIBE shardchannel [shardchannel ...]
- Available since:
- 7.0.0
- Time complexity:
- O(N) where N is the number of shard channels to subscribe to.
- ACL categories:
-
@pubsub
,@slow
,
订阅客户端到指定的分片频道。
在Redis集群中,分片通道通过用于将键分配到槽的相同算法分配到槽。
客户端可以订阅覆盖某个槽的节点(主节点/副本节点)以接收发布的消息。
所有指定的分片通道需要属于单个槽,以便在给定的SSUBSCRIBE
调用中订阅,
客户端可以通过单独的SSUBSCRIBE
调用订阅跨不同槽的通道。
有关分片发布/订阅的更多信息,请参阅Sharded Pub/Sub。
示例
> ssubscribe orders
Reading messages... (press Ctrl-C to quit)
1) "ssubscribe"
2) "orders"
3) (integer) 1
1) "smessage"
2) "orders"
3) "hello"
RESP2 回复
When successful, this command doesn't return anything. Instead, for each shard channel, one message with the first element being the stringssubscribe
is pushed as a confirmation that the command succeeded. Note that this command can also return a -MOVED redirect.