2

I am using rsync and pg_basebackup to copy wal file and base. My rsync runs every minute and copy WAL files from pg_xlog and every end of the day i run pg_basebackup to get the base folder.

Now i need to know how to restore the postgres back to normal using base backup and wal files.

1
  • This seems unconventional. WAL files usually get archived up on demand via archive_command, or by streaming. Could you give the defails of this, as well as of the pg_basebackup. Commented Jul 26, 2022 at 14:26

1 Answer 1

2

You need to shutdown the cluster , restore(unzip and copy) the files & folders from Basebackup to data directory. Remove old files present in pg_wal directory in the file system backup.

If there are any unarchived WAL segment files recovered from crashed cluster, copy them to pg_wal directory.

Set the restore_command (This command is used to retrieve archive segment of the WAL Files) and recovery_target based on the PG version you are on.

Temporarily modify pg_hba.conf to prevent ordinary users from connecting. Stop / block all the connections.

Make the recovery.signal ( if version >12) and start the cluster.

Modify pg_hba.conf to allow users to connect to the database.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.