After teaching PostgreSQL to archive those WAL files, it is time to create a first backup. The idea is to have a backup and to replay WAL files based on that backup to reach any point in time.
To create an initial backup, you can turn to pg_basebackup, which is a command-line tool used to perform backups. Let us call pg_basebackup and see how it works:
pg_basebackup -D /some_target_dir -h localhost --checkpoint=fast --xlog-method=stream
As you can see, I am using four parameters here:
- -D: Where do you want the base backup to live? PostgreSQL requires an empty directory. At the end of the backup you will see a copy of the server's data directory there (destination).
- -h: Indicates the IP address or the name of the ...