Securing the WAL stream
The primary mechanism that PostgreSQL uses to provide a data durability guarantee is through its Write Ahead Log (WAL). All transactional data is written to this location before ever being committed to database files. Once WAL files are no longer necessary for crash recovery, PostgreSQL will either delete or archive them. For the purposes of a highly available server, we recommend that you keep these important files as long as possible. There are several reasons for this; they are as follows:
Archived WAL files can be used for Point In Time Recovery (PITR)
If you are using streaming replication, interrupted streams can be re-established by applying WAL files until the replica has caught up
WAL files can be reused to service multiple server copies
In order to gain these benefits, we need to enable PostgreSQL WAL archiving and save these files until we no longer need them. This section will address our recommendations for long-term storage of WAL files.
Getting ready
In order...