CLOUD/IaC
[Redis] Master - Slave - Sentinel
alsruds
2023. 3. 28. 03:21
◎ 가상머신 7대 준비 ◎ CentOS 8
▷ Master : 200.200.200.156
▷ Slave : 200.200.200.157 / 200.200.200.158 / 200.200.200.159
▷ Sentinel : 200.200.200.160 / 200.200.200.161 / 200.200.200.162
[ Master ]
● Redis 설치
yum install -y redis
● /etc/redis.conf 파일 설정
bind 0.0.0.0
daemonize yes
min-replicas-to-write 1 # 최소 복제본 수
min-replicas-max-lag 10 # 복제 성공 시간
requirepass qwer1234 # 패스워드 설정
● 재시작
systemctl restart redis
● 확인
》 redis-cli
》 auth [password]
》 info Replication
[ Slave ]
● Redis 설치
yum install -y redis
● /etc/redis.conf 파일 설정
bind 0.0.0.0
daemonize yes
replicaof 마스터IP 포트번호
masterauth [비밀번호]
requirepass [비밀번호]
replica-read-only yes
● 재시작
systemctl restart redis
● 확인
》 redis-cli
》 auth [password]
》 info Replication
[ Sentinel ]
● Redis 설치
yum install -y redis
● /etc/redis-sentinel.conf 파일 설정
bind 0.0.0.0
daemonize yes
sentinel monitor mymaster [master ip] 6379 2
sentinel auth-pass mymaster [password]
sentinel down-after-milliseconds mymaster 30000
sentinel parallel-syncs mymaster 1
● 재시작
systemctl restart redis-sentinel
● 확인
》 redis-cli -p 26379
》 sentinel master mymaster
》 sentinel slaves mymaster