Sign inSign up

dosemeau/pgcluster-postgres

By dosemeau

Updated almost 10 years ago

A PostgreSQL server image for master or slave mode. Based on paunin/postgresql-cluster-pgpool

Image
0

129

dosemeau/pgcluster-postgres 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

108.6 MB

Last updated

almost 10 years ago

docker pull dosemeau/pgcluster-postgres:9.5