Deploy PostgreSQL HA with Repmgr

Instant Postgres cluster for high availability and redundancy

Deploy PostgreSQL HA with Repmgr

Just deployed

/bitnami/postgresql

/bitnami/postgresql

/bitnami/postgresql

Deploy a PostgreSQL HA Cluster with replication manager by EDB, for a more highly available and redundant data layer.

How it works

This template deploys 4 services -

  • (3) PostgreSQL nodes
  • (1) Pgpool-II service

The PostgreSQL nodes are automatically configured with repmgr and joined to a cluster. Since Postgres doesn't include a native failover, repmgr is included.

Pgpool-II is a PostgreSQL proxy which can also handle failovers when they occur in the cluster.

Inter-node communication

All communication between nodes is done over the private network.

Configuration Tuning

The PostgreSQL nodes and Pgpool-II are deployed from bitnami images. As such, you can leverage the customizable environment variables available in both -

Connecting to the Cluster

Within the service variables for the Pgpool service, you will find connection strings named DATABASE_URL and DATABASE_PUBLIC_URL. These can be used for connecting to the cluster via the private or public network.

We strongly encourage you to use the private connection string defined in DATABASE_URL to avoid egress fees.

Deployment Regions

By default, each of the 3 Postgres nodes are deployed into US-West. You can move them to your preferred region(s) once deployed into your project, from the service settings.

From a disaster preparedness standpoint, it is common practice to deploy the nodes into different regions.

Service Source

PostgreSQL nodes- As of now, the PostgreSQL nodes deploy from a forked repository in the railwayapp-templates Github while we await a PR review by bitnami. Once our PR has been merged and the image published via Bitnami, we will update the source

Pgpool-II - Pgpool deploys directly from the bitnami/pgpool image in Docker Hub.

More Resources


Template Content

More templates in this category

View Template
Postgres Backup to Cloudflare R2
Auto back up PostgreSQL databases to Cloudflare R2 with optional encryption

View Template
ReadySet
A lightweight caching engine for Postgres

View Template
Simple S3
Deploy a S3-compatible storage service with a pre-named bucket.