Skip to content

Instantly share code, notes, and snippets.

@mayorova
Last active February 21, 2024 15:40
Show Gist options
  • Save mayorova/e76f78d85626b08b3476bfc5285733ac to your computer and use it in GitHub Desktop.
Save mayorova/e76f78d85626b08b3476bfc5285733ac to your computer and use it in GitHub Desktop.
Redis sentinels
CONFIG_QUEUES_MASTER_NAME=redis://mymaster
CONFIG_QUEUES_SENTINEL_HOSTS=redis://localhost:9000,redis://localhost:9001,redis://localhost:9002
CONFIG_REDIS_PROXY=redis://mymaster
CONFIG_REDIS_SENTINEL_HOSTS=redis://localhost:9000,redis://localhost:9001,redis://localhost:9002
version: '3'
services:
redis-master:
container_name: "redis-master"
image: redis
ports:
- "6379:6379"
redis-sentinel1:
container_name: "redis-sentinel1"
image: redis
ports:
- "9000:9000"
command: "/data/sentinel1.conf --port 9000 --sentinel"
volumes:
- "./data/sentinel1:/data:Z"
redis-sentinel2:
container_name: "redis-sentinel2"
image: redis
ports:
- "9001:9001"
command: "/data/sentinel2.conf --port 9001 --sentinel"
volumes:
- "./data/sentinel2:/data:Z"
redis-sentinel3:
container_name: "redis-sentinel3"
image: redis
ports:
- "9002:9002"
command: "/data/sentinel3.conf --port 9002 --sentinel"
volumes:
- "./data/sentinel3:/data:Z"

The file tree must be as follows:

.
├── data
│   ├── sentinel1
│   │   └── sentinel1.conf
│   ├── sentinel2
│   │   └── sentinel2.conf
│   └── sentinel3
│       └── sentinel3.conf
└── podman-compose.yml
port 9000
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 60000
port 9001
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 60000
port 9002
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 60000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment