| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- services:
- redis-slave-2:
- image: registry.cn-chengdu.aliyuncs.com/reghao/redis:6.0.16-bullseye
- container_name: redis-slave-2
- restart: always
- ports:
- - "6379:6379"
- volumes:
- - /etc/localtime:/etc/localtime:ro
- - /opt/docker/redis/redis.conf:/etc/redis/redis.conf
- - /opt/docker/redis/data:/data
- # 🚨 容器日志限制
- logging:
- driver: "json-file"
- options:
- max-size: "50m"
- max-file: "3"
- # 🚨 从节点资源限制(与主节点保持完全一致,以便故障转移后能完美顶上)
- deploy:
- resources:
- limits:
- cpus: '1.0'
- memory: 2G
- reservations:
- cpus: '0.5'
- memory: 512M
- command: redis-server /etc/redis/redis.conf --replicaof 192.168.0.211 6379 --appendonly yes
- healthcheck:
- test: [ "CMD", "redis-cli", "ping" ]
- interval: 5s
- timeout: 3s
- retries: 5
- start_period: 10s
- sentinel-3:
- image: registry.cn-chengdu.aliyuncs.com/reghao/redis:6.0.16-bullseye
- container_name: sentinel-3
- restart: always
- ports:
- - "26379:26379"
- command: redis-sentinel /etc/redis/sentinel.conf
- volumes:
- - /etc/localtime:/etc/localtime:ro
- - /opt/docker/redis/sentinel/sentinel.conf:/etc/redis/sentinel.conf
- logging:
- driver: "json-file"
- options:
- max-size: "20m"
- max-file: "3"
- deploy:
- resources:
- limits:
- cpus: '0.5'
- memory: 512M
- reservations:
- cpus: '0.2'
- memory: 256M
- healthcheck:
- test: [ "CMD", "redis-cli", "-p", "26379", "ping" ]
- interval: 5s
- timeout: 3s
- retries: 5
|