Redis Cluster is a way to run Redis across multiple servers to share data and handle more requests. It splits data into parts called slots and spreads them across different nodes.
Click to reveal answer
beginner
How does Redis Cluster distribute data?
Redis Cluster divides data into 16,384 slots. Each key is assigned to one slot, and slots are distributed among nodes. This helps balance data and load.
Click to reveal answer
intermediate
What is the role of master and replica nodes in Redis Cluster?
Master nodes hold the main data and handle writes. Replica nodes copy data from masters to provide backup and help if a master fails.
Click to reveal answer
intermediate
How does Redis Cluster handle node failures?
If a master node fails, Redis Cluster promotes a replica to master automatically. This keeps the cluster working without losing data.
Click to reveal answer
beginner
Why is Redis Cluster considered scalable?
Redis Cluster allows adding more nodes to spread data and requests. This means it can grow easily to handle more users or data.
Click to reveal answer
How many hash slots does Redis Cluster use to distribute data?
A512
B16,384
C65,536
D1,024
✗ Incorrect
Redis Cluster divides data into 16,384 hash slots to distribute keys evenly.
What happens when a master node fails in Redis Cluster?
AA replica node is promoted to master
BData is lost permanently
CThe cluster stops working
DAll nodes restart automatically
✗ Incorrect
Redis Cluster promotes a replica to master to keep the cluster running without data loss.
Which node type in Redis Cluster handles write operations?
AProxy nodes
BReplica nodes
CClient nodes
DMaster nodes
✗ Incorrect
Master nodes hold the main data and handle write requests.
Why does Redis Cluster use multiple nodes?
ATo make the system slower
BTo increase data security only
CTo distribute data and load for scalability
DTo store backups offline
✗ Incorrect
Multiple nodes help spread data and requests, making Redis Cluster scalable.
What is a hash slot in Redis Cluster?
AA storage unit for keys
BA type of node
CA client connection
DA backup file
✗ Incorrect
A hash slot is a unit that holds keys and helps distribute data across nodes.
Explain how Redis Cluster distributes data and manages node roles.
Think about how data is split and which nodes do what.
You got /4 concepts.
Describe how Redis Cluster ensures availability when a node fails.
Focus on what happens behind the scenes when a master node stops working.
You got /4 concepts.
Practice
(1/5)
1.
What is the main purpose of Redis Cluster architecture?
easy
A. To backup data to external storage every minute
B. To store data only on a single server for simplicity
C. To encrypt data automatically on all nodes
D. To split data across multiple servers for better performance and fault tolerance
Solution
Step 1: Understand Redis Cluster design
Redis Cluster splits data across multiple servers using hash slots to distribute load.
Step 2: Identify the main benefit
This splitting improves speed, storage capacity, and fault tolerance by avoiding a single point of failure.
Final Answer:
To split data across multiple servers for better performance and fault tolerance -> Option D
Quick Check:
Redis Cluster = Data distribution + fault tolerance [OK]
Hint: Redis Cluster splits data for speed and safety [OK]
Common Mistakes:
Thinking Redis Cluster stores data on one server
Confusing cluster with encryption feature
Assuming cluster only handles backups
2.
Which command line option is required to start a Redis node with cluster enabled?
redis-server --port 7000 --cluster-enabled ???
easy
A. yes
B. true
C. on
D. enable
Solution
Step 1: Recall Redis cluster start syntax
To enable cluster mode, the option is --cluster-enabled yes.
Step 2: Confirm correct boolean value
Redis expects 'yes' or 'no' for this flag, not 'true', 'on', or 'enable'.
Final Answer:
yes -> Option A
Quick Check:
Cluster enabled flag = yes [OK]
Hint: Use 'yes' to enable cluster mode in Redis [OK]
Common Mistakes:
Using 'true' or 'on' instead of 'yes'
Typing 'enable' which is invalid
Omitting the cluster-enabled option
3.
Given a Redis Cluster with 3 nodes, each handling 5461 hash slots, what happens if one node fails?
Choose the correct behavior:
medium
A. All data on the failed node is lost permanently
B. The cluster stops working until the failed node is back
C. The cluster continues working if replicas exist for the failed node's slots
D. The cluster automatically merges all slots to remaining nodes
Solution
Step 1: Understand Redis Cluster fault tolerance
Redis Cluster uses replicas to provide fault tolerance. If a node fails, replicas can take over its hash slots.
Step 2: Analyze failure impact
If replicas exist, the cluster continues working by promoting replicas. Without replicas, cluster availability is affected.
Final Answer:
The cluster continues working if replicas exist for the failed node's slots -> Option C
Quick Check:
Node failure + replicas = cluster stays up [OK]
Hint: Replicas keep cluster alive if a node fails [OK]
Common Mistakes:
Assuming cluster stops immediately on node failure
Thinking data is lost without replicas
Believing cluster merges slots automatically
4.
Identify the error in this Redis cluster node start command:
A. The command has conflicting cluster-enabled flags
B. The port number is invalid
C. The cluster-config-file name is incorrect
D. The cluster-node-timeout value is too low
Solution
Step 1: Review cluster-enabled flags
The command has two --cluster-enabled flags: one set to 'yes' and another to 'no'. This is conflicting.
Step 2: Understand impact of conflicting flags
Redis will use the last flag, disabling cluster mode, which contradicts other cluster options.
Final Answer:
The command has conflicting cluster-enabled flags -> Option A
Quick Check:
Conflicting flags cause cluster mode error [OK]
Hint: Avoid multiple cluster-enabled flags in one command [OK]
Common Mistakes:
Ignoring repeated flags causing conflicts
Assuming port 7001 is invalid
Thinking config file name causes error
5.
You want to create a Redis Cluster with 6 nodes: 3 masters and 3 replicas. Which of the following is the correct approach to assign hash slots and replicas?
hard
A. Assign all hash slots to replicas only; masters hold no slots
B. Assign all 16384 hash slots evenly to 3 masters; assign each replica to a different master node
C. Assign hash slots randomly to all 6 nodes without replicas
D. Assign hash slots only to one master; others act as replicas
Solution
Step 1: Understand hash slot distribution
Redis Cluster has 16384 hash slots. These should be evenly split among master nodes for balanced load.
Step 2: Assign replicas properly
Each replica should be linked to a different master to provide fault tolerance and avoid single points of failure.
Final Answer:
Assign all 16384 hash slots evenly to 3 masters; assign each replica to a different master node -> Option B