Copying WAL files more easily

If we have a version of PostgreSQL of 9.2 or above, there is a new command that, much like pg_basebackup, utilizes the replication mechanism for a new purpose. Assuming PostgreSQL is configured as described in the Configuration - getting it right the first time recipe, there should be five available replication streams. As we're smart and have a dual-node cluster, we are already using at least one to create a copy of the database.

The next step would be to have a copy of the WAL files alone, as they are critical to PITR, which helps isolate the database. Instead of using rsync to copy these between nodes, we can simply pull them directly from the primary node. With 192.168.1.30 as the virtual database IP address ...

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.