yoklainterview sim

Redis Database Interview Questions

450 verified Redis Database interview questions — solve with answers, learn from explanations, test yourself in a real simulation.

Try the real simulation →

Sample questions

Redis Cluster ShardingDifficulty 1
How many hash slots does Redis Cluster divide its keyspace into?
  • a1024
  • b16384
  • c65536
  • d256
Explanation:Redis Cluster splits the keyspace into 16384 hash slots; each master node owns a subset of these slots. 1024 (a), 65536 (c), and 256 (d) are not the actual slot count.
Redis Cluster ShardingDifficulty 1
Which hash function does Redis Cluster use to map a key to a hash slot?
  • aCRC16
  • bMD5
  • cSHA-1
  • dMurmurHash
Explanation:Redis Cluster computes CRC16(key) mod 16384 to determine the slot. MD5 (b), SHA-1 (c), and MurmurHash (d) are not used for this purpose in Redis Cluster.
Redis Cluster ShardingDifficulty 1
In Redis Cluster, what is a hash tag used for?
  • aTo encrypt keys before hashing
  • bTo mark a key as read-only across replicas
  • cTo force multiple keys into the same hash slot
  • dTo give a key a human-readable alias
Explanation:A hash tag (the part of a key inside {}) forces the whole key to hash based only on that substring, so related keys sharing the same tag land in the same slot — needed for multi-key operations. It has nothing to do with encryption (a), read-only marking (b), or aliasing (d).
Redis Cluster ShardingDifficulty 1
What error does Redis Cluster return when a multi-key command touches keys that map to different hash slots?
  • aNOSLOT
  • bWRONGTYPE
  • cCLUSTERDOWN
  • dCROSSSLOT
Explanation:CROSSSLOT is returned when a command like MSET or a multi-key operation references keys hashing to different slots, since such an operation can't be routed atomically to a single node. WRONGTYPE (b) is for type mismatches, CLUSTERDOWN (c) is for cluster-wide unavailability, and NOSLOT (a) is not a real Redis error.
Redis Cluster ShardingDifficulty 1
In Redis Cluster, how do nodes discover each other's state and topology changes?
  • aThrough a shared external ZooKeeper ensemble
  • bThrough a gossip protocol over a dedicated cluster bus port
  • cThrough periodic DNS re-resolution
  • dThrough a centralized configuration node
Explanation:Redis Cluster nodes exchange cluster state via a gossip protocol on the cluster bus port, with no external coordinator. By default, the cluster bus port is the client port plus 10000, but it can be set explicitly with the cluster-port configuration. Redis Cluster does not depend on ZooKeeper (a), DNS polling (c), or a single centralized config node (d) — it is fully decentralized.
Redis Cluster ShardingDifficulty 2
A client issues MSET user:1 alice user:2 bob against Redis Cluster and gets a CROSSSLOT error. What is the most likely cause?
  • auser:1 and user:2 hash to different slots
  • bMSET is not supported at all in cluster mode
  • cThe cluster is currently in a failover state
  • dThe keys already exist with a different data type
Explanation:Without a shared hash tag, user:1 and user:2 can hash to different slots (and thus different nodes), and MSET requires all keys in the same slot to execute atomically on one node — hence CROSSSLOT. MSET is supported in cluster mode when slots align (b), this isn't a failover-specific error (c), and type mismatches produce WRONGTYPE, not CROSSSLOT (d).

Test yourself against the 2475-question Database bank.

Start interview