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:
- Red Hat-based systems should use this command as a root-capable user:
sudo yum install repmgr
- 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:
- As the postgres user, generate ...