Skip to content

Instantly share code, notes, and snippets.

@nickadam
Last active March 25, 2019 10:18
Show Gist options
  • Select an option

  • Save nickadam/aebc1a3290d42df529fa2c4afc6aab4f to your computer and use it in GitHub Desktop.

Select an option

Save nickadam/aebc1a3290d42df529fa2c4afc6aab4f to your computer and use it in GitHub Desktop.
Active-Passive Redis Cluster
version: '3.5'
services:
master:
image: redis:5
command: ["redis-server", "--appendonly", "yes"]
volumes:
- db:/data
ports:
- target: 6379
published: 6379
mode: host
deploy:
mode: global
placement:
constraints: [node.labels.redis == master]
slave:
image: redis:5
command: ["redis-server", "--slaveof", "master", "6379", "--appendonly", "yes"]
volumes:
- db:/data
ports:
- target: 6379
published: 6379
mode: host
depends_on:
- master
deploy:
mode: global
placement:
constraints: [node.labels.redis == slave]
volumes:
db: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment