Files
sa-charts/docker-swarm-review/redis-review-132/docker-compose.yml
2026-05-13 15:27:25 +08:00

97 lines
2.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

version: '3.8'
networks:
default:
name: ${NAMESPACE}
external: true
services:
# 132: 主同步节点,从生产 10.56 同步数据
# 使用 replica-announced no 对生产 Sentinel 隐藏
master:
image: 'bitnami/redis:7.0.11'
hostname: ${NAMESPACE}-redis-master
environment:
- TZ=Asia/Shanghai
- REDIS_REPLICATION_MODE=slave
- REDIS_MASTER_HOST=${REDIS_PROD_MASTER_HOST}
- REDIS_MASTER_PORT_NUMBER=${REDIS_PROD_MASTER_PORT}
- REDIS_MASTER_PASSWORD=${REDIS_PASSWORD}
- REDIS_PASSWORD=${REDIS_PASSWORD}
- REDIS_EXTRA_FLAGS=--replica-announced no --replica-priority 0
ports:
- mode: host
protocol: tcp
published: 6379
target: 6379
volumes:
- data_master:/bitnami
deploy:
update_config:
order: stop-first
placement:
constraints:
- node.hostname==ZD-BAK-APP2
# 133: 从 132 同步数据(级联复制)
# 不需要 replica-announced no因为 master 是 132生产 Sentinel 看不到
# 故障切换后需要被 Review Sentinel 发现
slave-1:
image: 'bitnami/redis:7.0.11'
hostname: ${NAMESPACE}-redis-slave-1
environment:
- TZ=Asia/Shanghai
- REDIS_REPLICATION_MODE=slave
- REDIS_MASTER_HOST=${REDIS_REVIEW_PRIMARY_HOST}
- REDIS_MASTER_PORT_NUMBER=6379
- REDIS_MASTER_PASSWORD=${REDIS_PASSWORD}
- REDIS_PASSWORD=${REDIS_PASSWORD}
ports:
- mode: host
protocol: tcp
published: 6379
target: 6379
volumes:
- data_slave_1:/bitnami
deploy:
update_config:
order: stop-first
placement:
constraints:
- node.hostname==zd-bak-app3
# 134: 从 132 同步数据(级联复制)
# 不需要 replica-announced no因为 master 是 132生产 Sentinel 看不到
# 故障切换后需要被 Review Sentinel 发现
slave-2:
image: 'bitnami/redis:7.0.11'
hostname: ${NAMESPACE}-redis-slave-2
environment:
- TZ=Asia/Shanghai
- REDIS_REPLICATION_MODE=slave
- REDIS_MASTER_HOST=${REDIS_REVIEW_PRIMARY_HOST}
- REDIS_MASTER_PORT_NUMBER=6379
- REDIS_MASTER_PASSWORD=${REDIS_PASSWORD}
- REDIS_PASSWORD=${REDIS_PASSWORD}
ports:
- mode: host
protocol: tcp
published: 6379
target: 6379
volumes:
- data_slave_2:/bitnami
deploy:
update_config:
order: stop-first
placement:
constraints:
- node.hostname==ZD-BAK-APP1
volumes:
data_master:
driver: local
data_slave_1:
driver: local
data_slave_2:
driver: local