This episode covers Redis Cluster for horizontal scalability: automatic sharding into 16,384 hash slots, a 6-node architecture with 3 masters and 3 replicas, when you need a cluster, and hash tags for related multi-key operations.

Sentinel in episode 12 keeps availability, but there's another limit: capacity. A single master can only store data that fits in one memory and handle writes limited to one process. Episode 13 covers Redis Cluster — Redis's answer to horizontal scalability.
Redis Cluster divides data across many nodes via sharding, still provides redundancy through replicas, and handles failover itself without a separate Sentinel. This is the architecture used when the dataset exceeds a single node or write throughput exceeds a single master's capacity. Let's dissect how it works.
A cluster is not the first decision — there are real operational costs and complexity. You need a cluster when one of these conditions occurs:
maxmemory is forced very high.If your needs are only read scaling and availability, Sentinel + replicas (episode 12) is simpler. A cluster is worth choosing when data or writes are the bottleneck.
Info
Always start from a single instance, then Sentinel, and move up to a Cluster only when truly forced. Cluster complexity isn't free — it demands discipline around multi-key operations, which we'll cover shortly.
The cluster divides the keyspace into 16,384 hash slots. Each key is mapped to a slot based on its hash:
slot = CRC16(key) mod 16384
cluster node 1: slot 0 - 5460
cluster node 2: slot 5461 - 10922
cluster node 3: slot 10923 - 16383Each master has one or more replicas for failover. If a master dies, the cluster automatically promotes its replica — without Sentinel, because the cluster has its own internal consensus.
When a client calls a key on the wrong node, the node replies with MOVED containing the slot and the address of the correct node. Cluster-aware clients follow this redirect transparently. Modern libraries (ioredis, redis-py, go-redis) support cluster mode natively.
Every node needs cluster-enabled yes:
port 7000
cluster-enabled yes
cluster-config-file nodes-7000.conf
cluster-node-timeout 5000
appendonly yescluster-enabled yes turns on cluster mode. Repeat this configuration for ports 7000-7005 (three masters and three replicas).
With redis-cli --cluster create, a single command assembles everything:
redis-cli --cluster create \
127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 \
127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 \
--cluster-replicas 1redis-cli --cluster create sets up the first three nodes (7000-7002) as masters and the next three (7003-7005) as replicas — the --cluster-replicas 1 flag means one replica per master. Slots are divided automatically and evenly.
redis-cli -p 7000 CLUSTER INFO
redis-cli -p 7000 CLUSTER NODESCLUSTER INFO shows the cluster_state:ok status and slot distribution. CLUSTER NODES lists all nodes with their role, address, and held slots. These are the first two diagnostic commands you should memorize for clusters.
In a cluster, multi-key operations (e.g. MSET a b, SINTER, or transactions across two keys) are only valid if all keys are in the same slot. Hash tags guarantee this: only the key part inside curly braces is used to compute the slot.
slot(CRC16("{user:1}:profile")) == slot(CRC16("{user:1}:orders"))The keys {user:1}:profile and {user:1}:orders map to the same slot because CRC16 is computed only over user:1. With that, operations involving both keys can run:
redis-cli MSET "{user:1}:profile" "Arman" "{user:1}:orders" "3"
redis-cli GET "{user:1}:profile"MSET "{user:1}:profile" "Arman" "{user:1}:orders" "3" writes two keys to the same slot — legal in a cluster because they're in one slot. Without hash tags, this command errors with CROSSSLOT Keys in request don't hash to the same slot.
Danger
Hash tags are a double-edged sword. Using the same hash tag (e.g. always {user:1}) for hundreds of keys concentrates data on one slot — killing the benefit of distribution. Use them sparingly for data that truly operates together.
A few things to keep in mind:
redis-cli --cluster reshard — possible without downtime.redis-cli --cluster rebalance levels out slots when new nodes join.CROSSSLOT — design keys with hash tags from the start.cluster-require-full-coverage (default: the cluster refuses queries if any slot has no owner).Episode 13 equipped you with Redis Cluster for horizontal scalability: dividing 16,384 hash slots across master nodes, a 6-node architecture with 3 masters + 3 replicas, when to move up to a cluster, and hash tags for multi-key operations.
Key takeaways:
CRC16(key) mod 16384.redis-cli --cluster create ... --cluster-replicas 1 assembles a 6-node cluster.CLUSTER INFO and CLUSTER NODES are the first diagnostics.{user:1}:... groups related keys into one slot.CROSSSLOT — design keys from the start.In the next episode, episode 14, we move on to Security: Authentication, ACL & Encryption — securing Redis from unauthorized access. You'll learn requirepass, granular user Access Control Lists, TLS in transit, and hardening with protected-mode and rename-command. Ready to lock down your server?