티스토리 뷰
docker-compose.yml 파일
bitnami/redis 이용
services:
my-redis-a:
hostname: redis-master
container_name: redis-master
image: "bitnami/redis"
environment:
- REDIS_REPLICATION_MODE=master
- ALLOW_EMPTY_PASSWORD=yes
ports:
- 5000:6379
my-redis-b:
hostname: redis-replicas-1
container_name: redis-replicas-1
image: "bitnami/redis"
environment:
- REDIS_REPLICATION_MODE=slave
- REDIS_MASTER_HOST=redis-master
- ALLOW_EMPTY_PASSWORD=yes
ports:
- 5001:6379
depends_on:
- my-redis-a
my-redis-c:
hostname: redis-replicas-2
container_name: redis-replicas-2
image: "bitnami/redis"
environment:
- REDIS_REPLICATION_MODE=slave
- REDIS_MASTER_HOST=redis-master
- ALLOW_EMPTY_PASSWORD=yes
ports:
- 5002:6379
depends_on:
- my-redis-a
redis-sentinel-1:
container_name: sentinel1
image: 'bitnami/redis-sentinel:latest'
environment:
- REDIS_SENTINEL_DOWN_AFTER_MILLISECONDS=3000
- REDIS_MASTER_HOST=redis-master
- REDIS_MASTER_PORT_NUMBER=6379
- REDIS_MASTER_SET=mymaster
- REDIS_SENTINEL_QUORUM=2
ports:
- 26379:26379
depends_on:
- my-redis-a
- my-redis-b
- my-redis-c
redis-sentinel-2:
container_name: sentinel2
image: 'bitnami/redis-sentinel:latest'
environment:
- REDIS_SENTINEL_DOWN_AFTER_MILLISECONDS=3000
- REDIS_MASTER_HOST=redis-master
- REDIS_MASTER_PORT_NUMBER=6379
- REDIS_MASTER_SET=mymaster
- REDIS_SENTINEL_QUORUM=2
ports:
- 26380:26379
depends_on:
- my-redis-a
- my-redis-b
- my-redis-c
redis-sentinel-3:
container_name: sentinel3
image: 'bitnami/redis-sentinel:latest'
environment:
- REDIS_SENTINEL_DOWN_AFTER_MILLISECONDS=3000
- REDIS_MASTER_HOST=redis-master
- REDIS_MASTER_PORT_NUMBER=6379
- REDIS_MASTER_SET=mymaster
- REDIS_SENTINEL_QUORUM=2
ports:
- 26381:26379
depends_on:
- my-redis-a
- my-redis-b
- my-redis-c
redis-cli 로 어떤 pod가 master 역할을 하는지 확인하는 명령어
redis-cli info | grep role
댓글
- Total
최근에 올라온 글