Redis 集群:查找特定的主控 key/slot

Redis Cluster: Find which master holds particular key/slot

我正在使用 Redis 集群,一些键有一个特殊的前缀 {foo},所以 redis 将它们放在一个槽中。

我这样做是因为我想 运行 一些针对这些键的 lua 脚本(如果我作为单个实例登录到主服务器,我可以这样做)。

在我的设置中,我有 3 个 master,但不确定如何找到与我的密钥 {foo} 保持插槽的 master。*

你知道有什么方法可以找到特定 key/slot 的大师吗?

我仍然需要阅读整个文档,但已经找到 this:

There are 16384 hash slots in Redis Cluster, and to compute what is the hash slot of a given key, we simply take the CRC16 of the key modulo 16384.

已经有该操作的命令:

http://redis.io/commands/cluster-keyslot

>CLUSTER KEYSLOT somekey
11058

并查找服务器中有哪些插槽:

http://redis.io/commands/cluster-slots