Expanding a Redis Cluster: Adding a Fourth Master and Slave Node
This tutorial explains step‑by‑step how to expand a Redis cluster from three masters and three slaves to four masters and four slaves by preparing a new configuration, starting the new instance, and using redis‑cli to add the node and verify slot distribution.
In this guide we demonstrate how to expand an existing Redis cluster from three masters and three slaves to four masters and four slaves by adding a new master node.
2.1 Add master node
2.1.1 Prepare the node – create a copy of an existing configuration file and modify it for the new instance.
# cd /usr/local/redis/cluster/conf
pwd
cp redis-6385.conf redis-6386.conf
more redis-6386.confKey parameters in redis-6386.conf include:
bind 0.0.0.0
port 6386
daemonize yes
logfile "/usr/local/redis/cluster/log/redis-6386.log"
dbfilename dump-6386.rdb
appendonly yes
appendfilename "appendonly-6386.aof"
dir /usr/local/redis/cluster/data
requirepass 123456
masterauth 123456
cluster-enabled yes
cluster-config-file nodes-6386.conf
cluster-node-timeout 15000
cluster-announce-ip 192.168.240.8
cluster-announce-port 6386
cluster-announce-bus-port 163862.1.2 Start the new node
# ll
# ps -ef | grep redis(Image showing process list omitted for brevity.)
2.1.3 Add the node to the cluster
# redis-cli -a 123456 --cluster add-node 192.168.240.8:6386 192.168.240.8:6384 --cluster-master-id 6c987380787ed9677a66a1f1ba70c750634a8e4eThe command outputs status messages confirming the addition, slot allocation, and replica assignments, ending with:
[OK] All nodes agree about slots configuration.
[OK] All 16384 slots covered.
[OK] New node added correctly.After the operation the cluster now has four master nodes, each with its replica, and the slot distribution is balanced.
Conclusion
The master node has been successfully added; further monitoring of the Redis cluster configuration is recommended.
For more Redis tutorials, see the linked articles below:
1. Redis cluster three masters three slaves
2. Sentinel working principle
3. Detailed Redis Sentinel guide
4. Detailed Redis one master two slaves
5. Understanding Redis RDB persistence
Practical DevOps Architecture
Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.