pg-replication/docker-compose.yaml

42 lines
1006 B
YAML
Raw Permalink Normal View History

2024-11-09 18:18:50 +03:00
networks:
pg-replication:
driver: bridge
services:
pg-1:
image: 'bitnami/postgresql:14'
container_name: pg-repl-master
environment:
POSTGRESQL_USER: pguser
POSTGRESQL_PASSWORD: 1234
POSTGRESQL_REPLICATION_MODE: master
POSTGRESQL_REPLICATION_USER: repuser
POSTGRESQL_REPLICATION_PASSWORD: repuserpass
POSTGRESQL_WAL_LEVEL: replica
volumes:
- ./pg-1:/bitnami/postgresql:Z
networks:
- pg-replication
ports:
- "15432:5432"
pg-2:
image: 'bitnami/postgresql:14'
container_name: pg-repl-slave
environment:
POSTGRESQL_USER: pguser
POSTGRESQL_PASSWORD: 1234
POSTGRESQL_MASTER_HOST: pg-repl-master
POSTGRESQL_REPLICATION_MODE: slave
POSTGRESQL_REPLICATION_USER: repuser
POSTGRESQL_REPLICATION_PASSWORD: repuserpass
POSTGRESQL_WAL_LEVEL: replica
volumes:
- ./pg-2:/bitnami/postgresql:Z
networks:
- pg-replication
ports:
- "25432:5432"