Using repmgr to create replica

As mentioned earlier in this chapter, repmgr is a management suite to manage replication setups and also to create replicas and add them to the existing PostgreSQL clusters. In this recipe, we are going to create a new clone of the primary server.

This recipe builds on from the previous recipe. Here we are going to create a replica of the primary server pg-primary and as we said we need two machines participating in this configuration. Our replica server will be titled pg-clone and the /data location will be our data directory.

How to do it...

All the following commands in this recipe are carried out in the replica server pg-clone. Here are the complete steps:

  1. First log in as the Postgres user and generate a RSA key-pair ...

Get PostgreSQL High Performance Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.