Recall & Review
beginner
What is a key limitation of multi-key operations in a Redis cluster?
Multi-key operations can only be performed on keys that are in the same hash slot. Keys in different slots cannot be used together in a single multi-key command.
Click to reveal answer
beginner
How does Redis cluster determine which keys belong to the same hash slot?
Redis cluster uses a hash function on the key name or a part of it (called a hash tag) to assign keys to one of 16384 hash slots. Keys with the same hash slot number are stored on the same node.
Click to reveal answer
intermediate
What is a hash tag in Redis cluster multi-key operations?
A hash tag is a substring enclosed in curly braces {} within a key name. It forces Redis to use only that substring for hashing, allowing multiple keys with the same hash tag to be in the same slot.
Click to reveal answer
intermediate
Why can't you run a command like MGET on keys in different hash slots in Redis cluster?
Because Redis cluster distributes keys across nodes by hash slots, multi-key commands require all keys to be on the same node. Different slots mean keys are on different nodes, so the command would fail.
Click to reveal answer
intermediate
How can you design keys to enable multi-key operations in Redis cluster?
Use hash tags by including the same substring in curly braces in all related keys. This ensures they hash to the same slot and can be used together in multi-key commands.
Click to reveal answer
In Redis cluster, what must be true for keys used in a multi-key command like MGET?
✗ Incorrect
Multi-key commands require all keys to be in the same hash slot so they reside on the same node.
What is the purpose of a hash tag in Redis cluster keys?
✗ Incorrect
Hash tags force Redis to hash only the substring inside curly braces, placing keys with the same tag in the same slot.
How many hash slots does a Redis cluster have?
✗ Incorrect
Redis cluster uses 16384 hash slots to distribute keys across nodes.
What happens if you try to run a multi-key command on keys in different hash slots in Redis cluster?
✗ Incorrect
Redis cluster returns a CROSSSLOT error because multi-key commands require keys in the same slot.
Which of these keys will be in the same hash slot in Redis cluster?
✗ Incorrect
Keys with the same hash tag inside curly braces hash to the same slot.
Explain why multi-key operations in Redis cluster require keys to be in the same hash slot and how hash tags help achieve this.
Think about how Redis cluster splits data and how hash tags control key placement.
You got /5 concepts.
Describe how you would design keys to support multi-key commands like MGET in a Redis cluster environment.
Focus on key naming patterns that control hash slot assignment.
You got /5 concepts.