Forge Home

pg_streaming_replication

Configures PostgreSQL streaming replication based on replication slots.

7,933 downloads

6,011 latest version

4.6 quality score

Version information

  • 0.1.1 (latest)
  • 0.1.0
released Sep 1st 2017
This version is compatible with:
  • Ubuntu

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'fatdragon-pg_streaming_replication', '0.1.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add fatdragon-pg_streaming_replication
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install fatdragon-pg_streaming_replication --version 0.1.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

fatdragon/pg_streaming_replication — version 0.1.1 Sep 1st 2017

pg_streaming_replication

The module configures and initiates PostgreSQL streaming replication based on replication slots. It is based on tutorial PostgreSQL HA with pgpool-II (or to be more precise on the first three parts of the tutorial).

It is an open source module, published under Apache 2.0 license and managed at Github. Contributors are welcome!

The complete tutorial is available here.

Basic Usage

Assuming that the servers that will participate in replication are:

  • 192.168.1.1 (primary)
  • 192.168.1.2 (standby)

the primary server can be initialized with something like:

class { 'pg_streaming_replication': 
  id_rsa_source        => 'puppet:///files/my_postgres_ssh_id_rsa', 
  id_rsa_pub_source    => 'puppet:///files/my_postgres_ssh_id_rsa.pub', 
  nodes                => ['192.168.1.1', '192.168.1.2'],
  replication_password => 'BDE4CE17-98E5-4FDC-B03C-B94559FE03D8', 
  initiate_role        => 'primary', 
}

while the standby server can be initialized with:

class { 'pg_streaming_replication': 
  id_rsa_source        => 'puppet:///files/my_postgres_ssh_id_rsa', 
  id_rsa_pub_source    => 'puppet:///files/my_postgres_ssh_id_rsa.pub', 
  nodes                => ['192.168.1.1', '192.168.1.2'],
  replication_password => 'BDE4CE17-98E5-4FDC-B03C-B94559FE03D8', 
  initiate_role        => 'standby', 
  primary_server_ip    => '192.168.1.1', 
}

IMPORTANT NOTE: PostgreSQL replication is not a thing that you should configure by simply copying few lines of code. Although with the previous code you'll click-up replication - there's a lot more for you to learn and understand, so I strongly recommend going through the tutorials mentioned above. Even if you are experienced with replication you have to know what pg_streaming_replication module actually does.

Release History

v0.1.1

Date: September 1. 2017

Release Info:

  • Code cosmetics (thanks to puppet-lint).

v0.1.0

Date: Jun 7. 2016

Release Info:

  • Initial release.