마스터 1대, 슬레이브 2대가 연결돼있다.
센티널에서 sentinel masters 명령어를 입력해보자
127.0.0.1:26379> sentinel masters
1) 1) "name"
2) "master-name"
3) "ip"
4) "192.168.96.2"
5) "port"
6) "6379"
7) "runid"
8) "eab71173e1c5849f48cbdf65d1a35cdaab3e761f"
9) "flags"
10) "master"
11) "link-pending-commands"
12) "0"
13) "link-refcount"
14) "1"
15) "last-ping-sent"
16) "0"
17) "last-ok-ping-reply"
18) "567"
19) "last-ping-reply"
20) "567"
21) "down-after-milliseconds"
22) "3000"
23) "info-refresh"
24) "4472"
25) "role-reported"
26) "master"
27) "role-reported-time"
28) "968083"
29) "config-epoch"
30) "0"
31) "num-slaves"
32) "2"
33) "num-other-sentinels"
34) "0"
35) "quorum"
36) "2"
37) "failover-timeout"
38) "180000"
39) "parallel-syncs"
40) "1"
위의 명령어에 사용한 도커컴포즈는 다음과 같다.
docker-compose.yml
version: '2'
services:
# master : bitnami/redis:6.2.6
redis-master:
hostname: redis-master
container_name: redis-master
image: bitnami/redis:6.2.6
environment:
- REDIS_REPLICATION_MODE=master
- ALLOW_EMPTY_PASSWORD=yes
ports:
- 6379:6379
# slave1 : bitnami/redis:6.2.6
redis-slave-1:
hostname: redis-slave-1
container_name: redis-slave-1
image: bitnami/redis:6.2.6
environment:
- REDIS_REPLICATION_MODE=slave
- REDIS_MASTER_HOST=redis-master
- ALLOW_EMPTY_PASSWORD=yes
ports:
- 6480:6379
depends_on:
- redis-master
# slave2 : bitnami/redis:6.2.6
redis-slave-2:
hostname: redis-slave-2
container_name: redis-slave-2
image: bitnami/redis:6.2.6
environment:
- REDIS_REPLICATION_MODE=slave
- REDIS_MASTER_HOST=redis-master
- ALLOW_EMPTY_PASSWORD=yes
ports:
- 6481:6379
depends_on:
- redis-master
- redis-slave-1
# sentinel : bitnami/redis-sentinel:6.2.6
redis-sentinel:
hostname: redis-sentinel
container_name: redis-sentinel
image: bitnami/redis-sentinel:6.2.6
environment:
- REDIS_SENTINEL_DOWN_AFTER_MILLISECONDS=3000
- REDIS_MASTER_HOST=redis-master
- REDIS_MASTER_PORT_NUMBER=6379
- REDIS_MASTER_SET=master-name
- REDIS_SENTINEL_QUORUM=2
depends_on:
- redis-master
- redis-slave-1
- redis-slave-2
ports:
- 26379-26381:26379
'Database > Redis' 카테고리의 다른 글
[redis] sentinel get-master-addr-by-name master-name 살펴보기 (0) | 2021.12.27 |
---|---|
[redis] sentinel master master-name 내용 살펴보기 (0) | 2021.12.27 |
[redis] 레디스 센티널의 info 내용 살펴보기 (0) | 2021.12.27 |
[redis] 도커컴포즈로 레디스 마스터1 슬레이브2 구성 만들어보기 (2) | 2021.12.27 |
[redis] 마스터와 슬레이브의 info replication 내용 살펴보기 (0) | 2021.12.27 |