The first thing we need to do is secure the WAL stream. Follow these steps to build a semi-permanent copy of archived WAL data in the /db/wal_archive directory:
- On the primary node, modify the postgresql.conf file to include the following setting:
archive_command = 'cp -an %p > /db/wal_archive/%f'
- Create the /db/wal_archive directory as a root-capable user using the following commands:
sudo mkdir -p -m 0700 /db/wal_archive sudo chown -R postgres /db/wal_archive
- Reload the PostgreSQL service using the following command:
pg_ctl -D /path/to/database reload
- As a root-capable user, create a script named del_archives in the /etc/cron.daily directory and fill it with this content as a single line:
find /db/wal_archive ...