Skip to content

Puppet module for configuring PostgreSQL streaming replication based on replication slots.

Notifications You must be signed in to change notification settings

peske/puppet-pg_streaming_replication

Repository files navigation

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.

About

Puppet module for configuring PostgreSQL streaming replication based on replication slots.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published