postgres-repmgr
PostgreSQL Docker image with repmgrd for automatic failover
This is heavily based on 2ndQuadrant's blog post on the topic), but:
- several environment variables have been added
- this image doesn't use passwordless replication. Make sure to set
REPMGR_PASSWORD
- I've taken the liberty to add my own pg_recall PostgreSQL extension, because I need it on all my production clusters.
It's a source-only extension, so unless you callCREATE EXTENSION recall
, it's entirely inactive. - a few other minor changes
Environment:
This docker image uses the following environment variables (with their defaults if applicable):
REPMGR_USER=repmgr
REPMGR_DB=repmgr
REPMGR_PASSWORD
(required)
Use something likepwgen -n 24 1
to generate a random one (and make sure you use the same one on all your nodesNODE_HOST=
If set, this is used in theconninfo
string (used by other nodes to connect to this one.
If empty,hostname -f
is used Make sure you use a hostname the others can resolve (or an IP address)WITNESS=
If non-empty, this node is set up as witness node (i.e. won't hold actual data but still has a vote in leader election).