How to Set Up Redis Cluster Mode
Redis Cluster distributes data across multiple nodes using hash slots, providing horizontal scalability and fault tolerance for your Breeze applications.
Prerequisites
- Minimum 6 Breeze instances (3 masters + 3 replicas) for production
- Redis 7.0+ installed on all nodes
- Ports 6379 and 16379 (cluster bus) open between all nodes
Node Configuration
On each node, edit redis.conf:
port 6379
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
bind 0.0.0.0
requirepass YourClusterPassword
masterauth YourClusterPassword
Start All Nodes
sudo systemctl start redis-server # on all 6 nodes
Create the Cluster
From any node, initialize the cluster with automatic replica assignment:
redis-cli --cluster create \
10.0.0.1:6379 10.0.0.2:6379 10.0.0.3:6379 \
10.0.0.4:6379 10.0.0.5:6379 10.0.0.6:6379 \
--cluster-replicas 1 -a YourClusterPassword
Verify Cluster Status
redis-cli -a YourClusterPassword cluster info
redis-cli -a YourClusterPassword cluster nodes
Application Connection
Use cluster-aware client libraries. Connect to any node and the client will follow redirections:
redis-cli -c -a YourClusterPassword -h 10.0.0.1
SET mykey "hello" # automatically routed to correct shard
Redis Cluster gives your Breeze applications seamless data sharding with built-in replication.