External Publication
Visit Post

Redis Cluster

Sahil Kapoor's Playbook May 12, 2026
Source

Redis Cluster is Redis's native sharding mode. A cluster of Redis nodes partitions the keyspace into 16,384 hash slots ; each node owns a contiguous range of slots; clients learn which node owns which slot and route commands directly. Redis Cluster combines sharding with replication for horizontal scale and availability.

Key concepts

  • Hash slots. Each key is hashed (CRC16 mod 16,384) to one of 16,384 slots. Each master node owns a slot range.
  • Masters and replicas. Every master typically has one or more replicas; replicas can be promoted on master failure.
  • Cluster bus. Inter-node gossip protocol on a separate port for topology, failure detection, and slot migration.
  • Hash tags. Curly braces in a key like user:{42}:cart force keys with the same tag onto the same slot, enabling multi-key operations.

What changes versus single-node Redis

  • Multi-key commands. Restricted to keys on the same slot; use hash tags when needed.
  • Transactions. MULTI/EXEC only operate on a single slot.
  • Scripting. Lua scripts must access only keys on one slot per invocation.
  • Resharding. Slots can be migrated online between nodes; clients see brief redirections during migration.

๐Ÿ”—

Related Terms Redis, Sharding, Replication, Valkey, In-memory Database

๐Ÿ“–

Further Reading Redis as Infrastructure: Caching, Coordination, and Scale

Discussion in the ATmosphere

Loading comments...