With 3 computers (10.5.10.1, 10.5.10.2, 10.5.10.3). My example is Rocky Linux/ Centos
Step 1: Install Redis on computer
Step 2: Edit /etc/redis.conf:
- bind 0.0.0.0
- port 7001
- appendonly yes
- cluster-node-timeout 5000
- cluster-config-file nodes.conf
- cluster-enabled yes
Step 3: Open Firewall on 7001 & 17001 (7001+10000):
firewall-cmd --add-port={7001/tcp,17001/tcp} --permanent
firewall-cmd --reload
Step 4: Run Redis Server with command:
redis-server /etc/redis.conf --port 7001 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000
Repeat all steps above on other computer with other port (7002, 7003)
Step 5: Create cluster
Open other terminal on any computer:
redis-cli --cluster create 10.5.10.1:7001 10.5.10.2:7002 10.5.10.3:7003 --cluster-replicas 0
Now, you just connect to “any” Redis Server in cluster as a single Redis Server