cd redis/redis-cluster
docker-compose up
docker ps
3개의 main 와 3개의 replica가 보인다.
cluster nodes
5e0b0fc797d3cbf654c8de35314f18d9ca84dd1c 192.168.32.3:6379@16379 master - 0 1708477039000 8 connected 0-5460
1480e613ca301c2eee26470e6caf001e962e0b56 192.168.32.6:6379@16379 myself,slave 5e0b0fc797d3cbf654c8de35314f18d9ca84dd1c 0 1708477040000 8 connected
f969db351780ed8d55264cf3e98ed69d483249a7 :0@0 master,noaddr - 1708476939299 1708476939094 7 disconnected 5461-10922
5519f783a2c2fb1a048ec322b929d1dc70a4b14e 192.168.32.5:6379@16379 slave f969db351780ed8d55264cf3e98ed69d483249a7 0 1708477040000 7 connected
8a760bd47d3872e2860696eb5eb2a162a65b655e 192.168.32.4:6379@16379 master - 0 1708477041563 3 connected 10923-16383
8b03c9af607ed50511dfee31902e6bf8694fa93d 192.168.32.2:6379@16379 slave 8a760bd47d3872e2860696eb5eb2a162a65b655e 0 1708477040558 3 connected
main 하나를 죽여보자.
docker가 삭제 되었고 main 하나가 더 생겼다.
데이터도 잘 나온다.
- REDIS_CLUSTER_REPLICAS=2