In the previous recipe, we saw how pgBackRest can be used to perform a backup of a PostgreSQL cluster either locally or remotely. In this recipe, we shall see the steps involved in restoring a backup taken using pgBackRest.
Getting ready
In order to perform the restore of a backup taken using pgBackRest, we must have pgBackRest installed on the target server where the backup is being restored to. We should have a new or an empty directory available for the database backup to be restored. Additionally, we need to make sure to enable trusted SSH authentication using public keys between the target server and the backup server.
How to do it
The following are the steps involved in performing the restore of a backup taken using pgBackRest:
- Create the new data directory on the target server where the backup is being restored:
$ sudo mkdir /var/lib/pgsql/13/data/
$ sudo chmod 0700 /var/lib/pgsql/13/data
- Create the pgBackRest configuration file...