I'm using Redis Cluster, and some keys have a special prefix {foo}, so redis puts them in one slot.
I do this because i want to run some lua scripts against these keys (i can do this if i login to the master as a single instance).
In my setup i have 3 masters, but not sure how to find master which holds slot with my keys {foo}.*
Do you know any way to find master which holds particular key/slot?
I still have to read the entire docs, but already found 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.
There is a command for that op already:
http://redis.io/commands/cluster-keyslot
>CLUSTER KEYSLOT somekey
11058
And to find which slots are there in a server:
http://redis.io/commands/cluster-slots
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With