Created
August 14, 2020 13:47
-
-
Save michaljemala/cf74ccef74e5ae9ea41aaeba4bcc6a46 to your computer and use it in GitHub Desktop.
Postgres cluster with streaming replication and pgpool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.8' | |
services: | |
pgmaster: | |
image: bitnami/postgresql:latest | |
ports: | |
- 5432 | |
volumes: | |
- pgmaster_data:/bitnami/postgresql | |
environment: | |
- POSTGRESQL_REPLICATION_MODE=master | |
- POSTGRESQL_REPLICATION_USER=postgres | |
- POSTGRESQL_REPLICATION_PASSWORD=s3cret | |
- POSTGRESQL_PASSWORD=s3cret | |
- POSTGRESQL_DATABASE=platform | |
pgslave: | |
image: bitnami/postgresql:latest | |
ports: | |
- 5432 | |
depends_on: | |
- pgmaster | |
environment: | |
- POSTGRESQL_REPLICATION_MODE=slave | |
- POSTGRESQL_REPLICATION_USER=postgres | |
- POSTGRESQL_REPLICATION_PASSWORD=s3cret | |
- POSTGRESQL_MASTER_HOST=pgmaster | |
- POSTGRESQL_PASSWORD=s3cret | |
pgpool: | |
image: docker.io/bitnami/pgpool:latest | |
ports: | |
- 5432:5432 | |
depends_on: | |
- pgmaster | |
volumes: | |
- ./pgpool.conf:/config/pgpool.conf | |
environment: | |
- PGPOOL_USER_CONF_FILE=/config/pgpool.conf | |
- PGPOOL_BACKEND_NODES=0:pgmaster:5432:4:master:ALWAYS_MASTER,1:pgslave:5432:6:replica1 | |
- PGPOOL_SR_CHECK_USER=postgres | |
- PGPOOL_SR_CHECK_PASSWORD=s3cret | |
- PGPOOL_ENABLE_LDAP=no | |
- PGPOOL_POSTGRES_USERNAME=postgres | |
- PGPOOL_POSTGRES_PASSWORD=s3cret | |
- PGPOOL_ADMIN_USERNAME=admin | |
- PGPOOL_ADMIN_PASSWORD=s3cret | |
- PGPOOL_ENABLE_LOAD_BALANCING=yes | |
- PGPOOL_ENABLE_STATEMENT_LOAD_BALANCING=yes | |
- PGPOOL_NUM_INIT_CHILDREN=10 | |
- PGPOOL_MAX_POOL=1 | |
- PGPOOL_EXTRA_FLAGS=-d | |
volumes: | |
pgmaster_data: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment