Clustering Interview Questions
Clustering interview questions for Redis — fundamentals through advanced scenarios.
- 20Questions with answers
- 3Difficulty levels
Questions (20)
Browse beginner, intermediate, and advanced questions with answers — hide them when you want to self-test.
What is a hash slot, and why does a client see MOVED?
Cluster hash slots are 16384; a key hashes to one slot and that slot lives on one master. MOVED redirects the client when the slot moved. Clients must be cluster-aware or they will keep hitting the wrong node.
Why put hash tags like {userId} in Redis keys?
Hash tags {userId} in the key force several keys into the same slot so MULTI or Lua can touch them. Overusing one tag such as just {user} creates a hot slot. Tags are for related keys, not a global namespace.
What does a CROSSSLOT error mean, and what is the real fix?
Cross-slot errors happen when a transaction or Lua script touches keys that hash to different slots. The fix is a hash tag, not a retry loop. MGET of random keys is also cross-slot unless they share a tag.
How is ASK different from MOVED during a reshard?
ASK redirect is temporary during slot migration: the client should ASK the destination for that one command, then resume. Treating ASK like MOVED forever is wrong. Resharding is when you see ASK.
How does replica failover work in Cluster versus a standalone replica?
Replica failover in Cluster elects a replica of a down master and moves those slots to it. Clients see MOVED. replica-priority and replica hang detection matter. Sentinel is a different HA story for standalone Redis.
When would you choose Redis Cluster instead of Sentinel?
Cluster vs Sentinel: Sentinel watches a primary-replica set and failovers a single keyspace. Cluster shards 16384 slots across masters. Do not run Sentinel in front of Cluster nodes as if they were standalone.
How do you reshard slots without writing a custom migrator?
Resharding moves hash slots between masters with redis-cli --cluster reshard or Cluster Manager. Keys in those slots stream to the new master. Watch ASK and MOVED rates and avoid heavy KEYS during the move.
How do replica reads work in Cluster, and how stale can they be?
READONLY lets a client read from a replica in Cluster; data can be stale by replication lag. READWRITE returns you to the master. Serving GET from replicas without READONLY fails.
What does cluster-require-full-coverage do when masters disappear?
cluster_state fail plus cluster-require-full-coverage means if too many masters are unreachable the cluster refuses writes. That is safer than serving a split brain. Setting coverage to no is a conscious availability trade.
What steps actually add a new node to a live Cluster?
Adding a node starts with CLUSTER MEET, then assign slots or CLUSTER REPLICATE to make it a replica. Empty masters with no slots still participate in gossip. Forgetting CLUSTER MEET is why a node stays isolated.
Why can more hardware not fix a hot hash slot?
Hot slots: one slot getting most writes, often a celebrity hash tag or low-cardinality key, cannot be split below one slot. The fix is a better key design, not more hardware. Empty neighboring slots are normal; hotness is about key distribution.
Which extra port must be open for Cluster gossip, and what fails if it is not?
Cluster bus port is the Redis port plus 10000 by default and must be open for gossip. Opening only 6379 and then wondering why failover never happens is a classic ops miss. TLS on the bus is a separate setting.
Can MULTI/EXEC span two keys that live on different Cluster masters?
MULTI/EXEC in Cluster is still single-slot. There is no distributed transaction across slots. If you need cross-entity atomicity, you tagged those keys together or you use an external workflow.
What breaks in the application when you migrate from Sentinel to Cluster?
Migrating from Sentinel to Cluster is a reshard of a previously unsharded dataset: dump and reload with hash tags planned. Applications must switch to cluster clients that handle MOVED. Dual-running both modes on one port does not work.
Why is a master without a replica a Cluster availability hole?
Failure of a replica is cheap; failure of a master with no replica is slot downtime. Every master should have at least one replica. replica-validity-factor stops stale replicas from winning failover.
Is a burst of MOVED after reshard a healthy signal or an outage?
CLUSTER SLOTS versus CLUSTER NODES: clients cache slot maps from SLOTS. Stale maps cause extra MOVED. After reshard, expect a burst of redirects; that is health, not an outage, unless they never converge.
How must Lua KEYS be designed so EVAL works on Cluster?
Cross-slot Lua: even EVAL must list keys that map to one slot. Passing extra keys in ARGV to sneak around KEYS is unsupported and breaks under Cluster. Hash-tag the keys the script needs.
What should clients do if they land on a minority side of a Cluster partition?
Network partition: Cluster uses a majority of masters to elect. A minority side stops taking writes if it cannot reach quorum. Clients on the minority must fail, not silently write. That is the CAP answer for Redis Cluster.
Why do Docker or NAT deployments gossip addresses the app cannot reach?
replica-announce-ip and cluster-announce-ip exist because Docker hosts often gossip unreachable addresses. Failover then looks fine in CLUSTER NODES and dead from apps. Cluster is unforgiving of wrong advertised IPs.
What stalls a slot migration, and how do you unblock it?
Slot migration stuck: a key that keeps being written during migrate, or a huge key, can stall a slot. UNLINK big keys first. CLUSTER GETKEYSINSLOT helps you see what is in the way.
Practice with AI mock interviews
Run Redis mock interviews with AI follow-ups, instant feedback, and analytics on AiLx.
Free to start · No credit card required