Challenge - 5 Problems
Hash Slots Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
Hash slot calculation for a given key
Given the Redis key
{user:1000}.data, what is the hash slot number assigned to this key in a Redis cluster?Attempts:
2 left
💡 Hint
Redis cluster uses the substring inside curly braces to compute the hash slot.
✗ Incorrect
Redis cluster uses the substring inside curly braces {} as the key for hash slot calculation. This allows grouping related keys in the same slot.
🧠 Conceptual
intermediate1:30remaining
Purpose of hash slots in Redis cluster
What is the main purpose of hash slots in a Redis cluster?
Attempts:
2 left
💡 Hint
Think about how Redis cluster manages data across nodes.
✗ Incorrect
Hash slots allow Redis cluster to split the keyspace into 16384 slots, distributing them across nodes to balance load and enable scaling.
📝 Syntax
advanced1:30remaining
Identify the correct command to view hash slot allocation
Which Redis CLI command correctly shows the hash slot allocation for cluster nodes?
Attempts:
2 left
💡 Hint
The command should show slot ranges assigned to nodes.
✗ Incorrect
The
CLUSTER SLOTS command returns the slot ranges and the nodes responsible for them.🔧 Debug
advanced2:00remaining
Troubleshooting key slot mismatch error
You get a
MOVED error when accessing a key in Redis cluster. What is the most likely cause?Attempts:
2 left
💡 Hint
MOVED errors indicate redirection to the correct node.
✗ Incorrect
A MOVED error means the client tried to access a key on a node that does not own the hash slot; the client should redirect to the correct node.
❓ optimization
expert2:30remaining
Optimizing multi-key operations with hash slots
You want to perform a multi-key operation (e.g., MGET) on keys
user:1, user:2, and user:3 in a Redis cluster. How should you design the keys to ensure the operation succeeds without errors?Attempts:
2 left
💡 Hint
Multi-key commands require keys to be in the same hash slot.
✗ Incorrect
Using the same hash tag inside curly braces forces all keys to hash to the same slot, allowing multi-key commands to work.