Files
sa-charts/docker-swarm/redis/docker-compose copy.yml
marsal b2eb2928d8 swarm
2024-10-21 13:29:47 +08:00

89 lines
2.1 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:
master:
image: 'bitnami/redis:7.0.11'
environment:
- TZ=Asia/Shanghai
- REDIS_MASTER_HOST=192.168.1.207
- REDIS_REPLICATION_MODE=master
- REDIS_MASTER_PASSWORD=${REDIS_PASSWORD}
- REDIS_PASSWORD=${REDIS_PASSWORD}
- REDIS_REPLICA_IP=192.168.1.207
ports:
- mode: host
protocol: tcp
published: 6379
target: 6379
volumes:
- data_master:/bitnami
deploy:
update_config:
order: stop-first
placement:
constraints:
- node.hostname==okd7
slave:
image: 'bitnami/redis:7.0.11'
environment:
- TZ=Asia/Shanghai
- REDIS_REPLICATION_MODE=slave
- REDIS_MASTER_HOST=192.168.1.207
- REDIS_MASTER_PASSWORD=${REDIS_PASSWORD}
- REDIS_PASSWORD=${REDIS_PASSWORD}
- REDIS_REPLICA_IP=192.168.1.208
ports:
- mode: host
protocol: tcp
published: 6379
target: 6379
depends_on:
- master
volumes:
- data_slave:/bitnami
deploy:
update_config:
order: stop-first
placement:
constraints:
- node.hostname==zd-dev-208
redis-sentinel:
image: 'bitnami/redis-sentinel:7.0.11'
environment:
- TZ=Asia/Shanghai
- REDIS_MASTER_HOST=192.168.1.207
- REDIS_MASTER_PASSWORD=${REDIS_PASSWORD}
- REDIS_SENTINEL_ANNOUNCE_IP=192.168.1.209
- REDIS_PASSWORD=${REDIS_PASSWORD}
- REDIS_SENTINEL_PASSWORD=${REDIS_SENTINEL_PASSWORD}
depends_on:
- master
- slave
ports:
- mode: host
protocol: tcp
published: 26379
target: 26379
deploy:
update_config:
order: stop-first
mode: replicated
replicas: 1 # replicas模式 副本数目为1
placement:
constraints:
- node.hostname==zd-dev-209
volumes:
- data_sentinel_1:/bitnami
volumes:
data_sentinel_1:
driver: local
data_sentinel_2:
driver: local
data_master:
driver: local
data_slave:
driver: local