How to do it...

For the purposes of this recipe, we will need two servers. The primary PostgreSQL node will be named pg-primary, and the replica will be pg-clone. Both servers exist on the 192.168.56.0 subnet. As always, the /db/pgdata path will be our default data directory. Be sure to have the password for the postgres system user ready.

Follow these steps to install repmgr on both servers:

  1. Red Hat-based systems should use this command as a root-capable user:
        sudo yum install repmgr
  1. Debian-based systems should use this command instead:
        sudo apt-get install repmgr postgresql-9.6-repmgr

Next, follow these steps on pg-primary to set it up as a master node. We'll consider pg-clone in the next section:

  1. As the postgres user, generate ...

Get PostgreSQL High Availability Cookbook - Second Edition 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.