Bird
Raised Fist0
Redisquery~20 mins

Cluster architecture in Redis - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Redis Cluster Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate
2:00remaining
What is the output of the command CLUSTER INFO in Redis Cluster?
You run the Redis command CLUSTER INFO on a node in a Redis Cluster. What kind of information does this command return?
AIt returns the cluster state, number of slots assigned, number of known nodes, and cluster size.
BIt returns the list of all keys stored in the cluster.
CIt returns the memory usage of the Redis server.
DIt returns the current connected clients and their IP addresses.
Attempts:
2 left
💡 Hint
Think about what general cluster status information you might want to check.
🧠 Conceptual
intermediate
2:00remaining
How does Redis Cluster handle key distribution?
In Redis Cluster, how are keys distributed across different nodes?
AKeys are stored on all nodes simultaneously for redundancy.
BKeys are assigned randomly to any node without hashing.
CKeys are assigned to nodes based on hashing the key into one of 16384 slots, which are distributed among nodes.
DKeys are stored only on the master node and replicas do not hold keys.
Attempts:
2 left
💡 Hint
Think about how consistent hashing or slot assignment works in distributed systems.
📝 Syntax
advanced
2:00remaining
Which command correctly adds a new node to an existing Redis Cluster?
You want to add a new node to your Redis Cluster. Which command syntax is correct for this operation?
Aredis-cli --cluster create <new_node_ip>:<port>
Bredis-cli --cluster add-node <new_node_ip>:<port> <existing_node_ip>:<port>
Credis-cli --cluster join <new_node_ip>:<port> <existing_node_ip>:<port>
Dredis-cli --cluster insert <new_node_ip>:<port> <existing_node_ip>:<port>
Attempts:
2 left
💡 Hint
Look for the official command to add a node to a cluster.
❓ optimization
advanced
2:00remaining
How can you optimize Redis Cluster to handle failover smoothly?
Which configuration or setup helps Redis Cluster handle failover smoothly without data loss?
AManually restart nodes when a failure occurs.
BDisable replicas to reduce network traffic.
CUse a single master node with no replicas for simplicity.
DAssign replicas to each master node so replicas can take over if a master fails.
Attempts:
2 left
💡 Hint
Think about how redundancy helps in failover scenarios.
🔧 Debug
expert
2:00remaining
What error occurs if you try to run a multi-key command on keys located in different Redis Cluster slots?
You run the command MGET key1 key2 where key1 and key2 hash to different slots in a Redis Cluster. What error will Redis return?
ACROSSSLOT Keys in request don't hash to the same slot
BWRONGTYPE Operation against a key holding the wrong kind of value
COOM command not allowed when used memory > 'maxmemory'.
DNOSCRIPT No matching script. Please use EVAL.
Attempts:
2 left
💡 Hint
Think about Redis Cluster's slot-based key distribution and multi-key command restrictions.

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

  1. Step 1: Understand Redis Cluster design

    Redis Cluster splits data across multiple servers using hash slots to distribute load.
  2. Step 2: Identify the main benefit

    This splitting improves speed, storage capacity, and fault tolerance by avoiding a single point of failure.
  3. Final Answer:

    To split data across multiple servers for better performance and fault tolerance -> Option D
  4. 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

  1. Step 1: Recall Redis cluster start syntax

    To enable cluster mode, the option is --cluster-enabled yes.
  2. Step 2: Confirm correct boolean value

    Redis expects 'yes' or 'no' for this flag, not 'true', 'on', or 'enable'.
  3. Final Answer:

    yes -> Option A
  4. 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

  1. 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.
  2. Step 2: Analyze failure impact

    If replicas exist, the cluster continues working by promoting replicas. Without replicas, cluster availability is affected.
  3. Final Answer:

    The cluster continues working if replicas exist for the failed node's slots -> Option C
  4. 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:

redis-server --port 7001 --cluster-enabled yes --cluster-config-file nodes-7001.conf --cluster-node-timeout 5000 --cluster-announce-ip 192.168.1.10 --cluster-announce-port 7001 --cluster-announce-bus-port 17001 --cluster-enabled no
medium
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

  1. Step 1: Review cluster-enabled flags

    The command has two --cluster-enabled flags: one set to 'yes' and another to 'no'. This is conflicting.
  2. Step 2: Understand impact of conflicting flags

    Redis will use the last flag, disabling cluster mode, which contradicts other cluster options.
  3. Final Answer:

    The command has conflicting cluster-enabled flags -> Option A
  4. 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

  1. Step 1: Understand hash slot distribution

    Redis Cluster has 16384 hash slots. These should be evenly split among master nodes for balanced load.
  2. Step 2: Assign replicas properly

    Each replica should be linked to a different master to provide fault tolerance and avoid single points of failure.
  3. Final Answer:

    Assign all 16384 hash slots evenly to 3 masters; assign each replica to a different master node -> Option B
  4. Quick Check:

    Slots evenly on masters + replicas assigned = correct cluster setup [OK]
Hint: Distribute slots evenly on masters; assign replicas per master [OK]
Common Mistakes:
  • Assigning slots to replicas instead of masters
  • Not linking replicas to masters
  • Putting all slots on one master only
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard