There's more...

Starting with PostgreSQL 9.5, pg_receivexlog is also fully compatible with synchronous replication. If we wanted to enable this capability, we could modify the final launch command to look something like this:

  pg_receivexlog -h 192.168.56.10 -U rep_user \
    -D /db/pg_archived -v --synchronous \ 
    &> /db/pg_archived/wal_archive.log & 

Normally pg_receivexlog only flushes to disk periodically. With the --synchronous parameter enabled, it will flush all transactions upon receipt, as well as send an acknowledgement to the upstream primary. Now we don't necessarily need a full copy of our database everywhere. Perhaps we could leverage this feature on a server that simply accumulates transaction logs in a secure location.

Being available ...

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.