redis 설치 CentOS 8.3 Master1-Slave2 (3대의 서버에 나누어 설치)
yum install epel-release
yum install redissystemctl start redis
systemctl enable redisredis-cli ping
===확인====
netstat -npat | grep redis
===컨피그==================
vim /etc/redis.conf
bind 0.0.0.0 (접속이 필요한 아이피들 0.0.0.0은 전부다 접속)
port 포트번호 (포트변경할때 사용)
requirepass 비밀번호 (비밀번호 적용할때 redis-cli에서는 auth 비번)
masterauth 비밀번호 (slave에 설정해서 master랑 연결됨)
#appenonly yes
#save 900 1
#save 300 10
#save 60 1000
====================
==============Master 1, Slave 2 설치============
Master Node 192.168.56.201 : 6379
Slave Node - 1 192.168.56.202 : 6379
Slave Node - 2 192.168.56.203 : 6379
Master 서버에서
/etc/redis.conf
bind 0.0.0.0
port 6379
requirepass 비밀번호
daemonize yes
Slave 1번 서버에서
/etc/redis-slave1.conf
bind 0.0.0.0
port 6379
slaveof 192.168.56.201 6379
masterauth 비밀번호
daemonize yes
Slave 2번 서버에서
/etc/redis.conf
bind 0.0.0.0
port 6379
slaveof 192.168.56.201 6379
masterauth 비밀번호
daemonize yes
=====재시작 및 확인=====
systemctl stop firewalld
systemctl restart redis
redis-cli
auth 비밀번호
info replication (리플리케이션 정보확인)
set test 123
get test
댓글
댓글 쓰기