Pgpool2 for pgsql + pgpool2 cluster. Based on paunin/postgresql-cluster-pgpool/
242
This project includes dockerfiles for building a postgresql cluster and example of docker-compose file to start this cluster. It is based on https://github.com/paunin/postgres-docker-cluster.
It varies from the version by not adding users to pg_hba.conf, and not exposing ports automatically. It has been designed to be deployed into an environment where a load balancer or proxy will handle this for you.
Two docker images can be produced:
pgmaster (primary node1) --|
|- pgslave1 (node2) --|
| |- pgslave2 (node3) --|----pgpool (master_slave_mode stream)
|- pgslave3 (node4) --|
|- pgslave4 (node5) --|
Each postgres node (pgmaster, pgslaveX) is managed by repmgr/repmgrd. It allows to use automatic failover. Depending on the environment settings, they will either stream off pgmaster or another slave.
To start a cluster, run it as a normal docker-compose application docker-compose up
Please check comments for each ENV variable in docker-compose file to understand the related parameter of cluster's node
gosu postgres repmgr cluster showKill master container and in a few moments cluster will define new master node, and Pgpool will try to detect new primary node for write access automatically.
Content type
Image
Digest
Size
114.7 MB
Last updated
over 9 years ago
docker pull dosemeau/pgcluster-pgpool:9.5-1