Skip to content

How to Set Up Redis Cluster

Key idea:

Redis Cluster — native horizontal scaling for Redis. Minimum: 3 masters + 3 replicas = 6 nodes (distributed across 16384 slots). Automated failover, client-side sharding, transparent to app (smart clients). Not for small data (<5GB) — plain Redis master+replica is enough. Alternative: managed Redis (AWS ElastiCache, Redis Cloud, Yandex Managed Redis).

Below: step-by-step, working examples, common pitfalls, FAQ.

Check your site →

Step-by-Step Setup

  1. Install Redis 7+ on 6 servers (or 6 containers)
  2. Config: cluster-enabled yes, cluster-node-timeout 5000, appendonly yes
  3. Start all 6 instances on different ports (7000-7005)
  4. Create cluster: redis-cli --cluster create ip1:7000 ip2:7001 ... --cluster-replicas 1
  5. Verify: redis-cli -p 7000 cluster infocluster_state:ok
  6. Client setup: use cluster-aware clients (ioredis, lettuce, go-redis) — handle MOVED redirects
  7. Monitoring: redis-exporter + Prometheus dashboard

Working Examples

ScenarioConfig
redis.conf (per node)port 7000 cluster-enabled yes cluster-config-file nodes.conf cluster-node-timeout 5000 appendonly yes protected-mode no # for intra-cluster (use firewall + requirepass) requirepass strongpass
Create cluster CLIredis-cli --cluster create \ 10.0.0.1:7000 10.0.0.2:7001 10.0.0.3:7002 \ 10.0.0.4:7003 10.0.0.5:7004 10.0.0.6:7005 \ --cluster-replicas 1 -a strongpass
ioredis cluster client (Node.js)const Redis = require('ioredis'); const cluster = new Redis.Cluster([ { host: '10.0.0.1', port: 7000 }, { host: '10.0.0.2', port: 7001 }, // only need a few — rest discovered ], { redisOptions: { password: 'strongpass' } }); await cluster.set('key', 'value');
Add new master + resharding# Add new node to cluster redis-cli --cluster add-node new:7006 existing:7000 # Reshard slots to new master redis-cli --cluster reshard existing:7000
Hash tags (keep keys in one slot)# Without hash tags — random distribution SET user:1:name alice SET user:1:email a@e.com # With hash tag — both on same shard (enabling transactions) SET {user:1}:name alice SET {user:1}:email a@e.com

Common Pitfalls

  • Cluster-unaware client → MOVED errors on every request. Use ioredis-cluster, go-redis, lettuce
  • Multi-key transactions (MULTI) only work for keys in same hash slot (use {tags})
  • Minimum 3 masters — 1-2 masters have no quorum for leader election
  • AOF + RDB backups mandatory — cluster is not a panacea for data durability
  • cross-DC latency — cluster assumes <5ms between nodes. For multi-region — separate clusters + replication

TL;DR: Setting Up a Redis Cluster in 2026

To set up a Redis Cluster in 2026, begin by ensuring you have Redis 6.0 or later installed on your servers. Use the command redis-server --cluster create followed by the IP addresses and ports of your Redis instances. For a basic setup, configure at least three master nodes and three replicas for high availability. Use --cluster-replicas 1 to designate one replica per master. Ensure your network allows for communication on the configured ports.

Prerequisites for Redis Cluster Setup

Before diving into the setup, ensure you meet the following prerequisites:

  • Redis Version: Install Redis 6.0 or later on all nodes. Use redis-server --version to check the version.
  • Network Configuration: Ensure all nodes can communicate over the network. This includes allowing traffic on ports 6379 (default Redis port) and 16379 (for cluster bus).
  • System Requirements: Each node should have at least 2GB of RAM and a multicore CPU for optimal performance.
  • Data Persistence: Configure your Redis instances with persistence settings (RDB or AOF) to prevent data loss.

Once you’ve confirmed these prerequisites, you can begin the cluster setup process.

Step-by-Step Guide to Setting Up a Redis Cluster

Follow these steps to configure a Redis Cluster:

  1. Install Redis: Download and install Redis on each server. On Ubuntu, use:
sudo apt update && sudo apt install redis-server
  1. Configure Redis for Clustering: Edit the redis.conf file on each instance. Set cluster-enabled yes and cluster-config-file nodes.conf.
  2. Start Redis Instances: Launch each Redis instance using the following command:
redis-server /path/to/your/redis.conf
  1. Create the Cluster: Use the Redis CLI to create the cluster. For example, if you have three nodes on 192.168.1.1, 192.168.1.2, and 192.168.1.3 each running on port 6379, run:
redis-cli --cluster create 192.168.1.1:6379 192.168.1.2:6379 192.168.1.3:6379 --cluster-replicas 1
  1. Verify Cluster Setup: Check the cluster status using:
redis-cli -c -h 192.168.1.1 -p 6379 cluster info

This command will provide details about the cluster, including the number of nodes and their states. Ensure all nodes are in 'ok' status.

By following these steps, you can successfully set up a Redis Cluster to handle high availability and partitioning of data efficiently. For production environments, consider additional configurations such as setting up Sentinel for monitoring and failover capabilities.

Learn more

Frequently Asked Questions

When is Redis Cluster needed?

Data >5 GB or >100k ops/sec. Less — single master + replica + Sentinel is enough.

Cluster vs Sentinel?

Sentinel — HA (1 master + replicas, automatic failover). Cluster — scaling (sharded across masters). Different jobs.

Managed alternatives?

AWS ElastiCache (Cluster mode), Redis Cloud (Redis Labs), Yandex Managed Redis. Usually $50-500/mo vs $0 self-host but 20+ hours/month maintenance.

Migrate from single Redis?

Write dual (old + new), read from single → migrate reads batch → cut write. Or use Redis-shake for bulk copy.

Try the live tool that powered this guide

Free plan — 10 monitors, checks every 5 min, no card required. Upgrade for 1-minute interval and multi-region monitoring.