We have daily backups of a postgres db and it is in the form of a tarred (gz) base backup. I need to restore this into another db of the same version. However, I am confused with the article that I am reading about doing this. The version of the postgres DB is 8.2.4. These are the main steps given :
rm -rf /var/lib/postgresql/10/main/*
cp -r /basebackup/* /var/lib/postgresql/10/main/
rm -rf /var/lib/postgresql/10/main/pg_wal/*
So in my case, the postgresql data directory is /usr/local/pgsql824/data. I believe this must be /var/lib/postgresql/main in the command above. I have untarred the tar.gz base backup into /usr/local/temp. So I suppose that this path is /basebackup in the command above. Please correct me if I am wrong.
Now, there comes the part of the "recovery.conf" file. These are the contents of the file as given by the article :
vim /var/lib/postgresql/10/main/recovery.conf
restore_command = 'cp /wal_archive/%f "%p"'
recovery_target_lsn = '3/72658818'
What is the purpose of the "/wal_archive" if I have already untarred contents of the base backup into /usr/local/temp ? This is what I am not sure about.
This is the link to the full article :
https://severalnines.com/database-blog/point-time-postgresql-database-restoration
I just need a clear explanation on how to restore the base backup to the new database data directory.