How it works...

In many ways, creating a witness node is very similar to starting a new repmgr cluster. Since the witness only needs to act as a voting member and observe the primary node, it does not need a full copy of our operational data. In fact, it only needs a very small PostgreSQL installation to track the repmgr cluster metadata.

To that end, we can use initdb, pg_createcluster, or whatever tool is provided by our Linux distribution to start with an empty database. The important thing is that we make the same modifications that we made when we initialized the primary node.

Principally, this means adding the repmgr shared library to shared_preload_libraries in postgresql.conf and modifying pg_hba.conf to allow connections; however, ...

Get PostgreSQL 12 High Availability 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.