Sign inSign up

dosemeau/pgcluster-pgpool

By dosemeau

Updated over 9 years ago

Pgpool2 for pgsql + pgpool2 cluster. Based on paunin/postgresql-cluster-pgpool/

Image
0

242

dosemeau/pgcluster-pgpool repository overview

Streaming replication cluster for pgsql + pgpool2

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:

Schema of cluster

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

Useful commands

  • Get map of current cluster(in any node): gosu postgres repmgr cluster show

Scenarios

Changing primary/master server on crash

Kill 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.

Known problems

FAQ

Documentation and manuals

Tag summary

Content type

Image

Digest

Size

114.7 MB

Last updated

over 9 years ago

docker pull dosemeau/pgcluster-pgpool:9.5-1