Hello, I will tell you about restore and restore delta on pgbackrest.
The normal restore command returns to the data path you specified. Restore –delta, on the other hand, restores the data path you gave from scratch on a different home.
All operations must be done with the postgres user.
cat /etc/pgbackrest.conf pgbackrest info pgbackrest archive-get --stanza=testdb
After doing the pre-run checks, we should get the –stanza name from pgbackrest.conf.
In addition, before the backup-restore we made, the existing DB can be backed up as dumpall.
pg_dump testdb -f backup.sql pg_dumpall -f backup_all.sql
It can be used for post-restore control by creating a table.
Even if the DATA folder cannot be completely backed up, files such as postgres.conf and pg_hba MUST be backed up.
mv /postgres/data /postgres/data_old mkdir /postgres/data pg_ctl stop -D /postgres/data pgbackrest --stanza=testdb-int --log-level-console=info --type=time "--target=2021-07-07 08:00:00.024378+01" --db-path=/postgres/data2/ restore
The pg_hba.conf content is updated after restoration.
mv /postgres/data/pg_hba.conf /postgres/data/pg_hba_07072021.conf cp /postgres/data_07072021/pg_hba.conf /postgres/data/pg_hba.conf pg_ctl start -D /postgres/data pg_ctl reload -D /postgres/data Test..
We are returning the database on a different path
pgbackrest --stanza=testdb --log-level-console=info --type=time "--target=2021-07-07 08:00:00.024378+01" --db-path=/postgres/data2 restore --delta
We are changing the port via postgresql.conf. We output dumps on a table basis via the new instance.
pg_dump -d testdb -p 5432 -n public test -f backup_all.sql
Let’s not forget to delete the database we created later.