PostgreSQL PITR backup restoration » History » Version 6
« Previous -
Version 6/52
(diff) -
Next » -
Current version
Amit Belani, 08/21/2015 11:32 PM
PostgreSQL PITR backup restoration¶
- Table of contents
- PostgreSQL PITR backup restoration
Restore a base backup¶
Identify¶
Identify the most recent base backup for the database cluster.
If the RAID on the host serving the database is available, identify the recent base backups on it.
[enstore@dmsen03 ~]$ enstore config --show drivestat_server PITR_area /srv3/enstore/pg_pitr [enstore@dmsen03 ~]$ ls -lh $(enstore config --show drivestat_server PITR_area)/pg_base_backup/drivestat | tail -2 -rw-r--r-- 1 enstore enstore 2.4M Aug 20 04:30 2015-08-20_04-30-02.tar.xz -rw-r--r-- 1 enstore enstore 2.4M Aug 21 04:30 2015-08-21_04-30-03.tar.xz
As an alternative, if the RAID on the remote backup host is available, identify the recent base backups on it.
[enstore@dmsen03 ~]$ enstore config --show crons backup_dir /srv3/enstore/backups [enstore@dmsen03 ~]$ ls -lh $(enstore config --show crons backup_dir)/pg_base_backup/drivestat | tail -2 -rw-r--r-- 1 enstore enstore 2.4M Aug 20 04:30 2015-08-20_04-30-02.tar.xz -rw-r--r-- 1 enstore enstore 2.4M Aug 21 04:30 2015-08-21_04-30-03.tar.xz
As a final alternative, if base backups are available only from tape storage, copy the most recent base backup to disk.
Extract¶
Extract the identified base backup into an appropriate empty directory where the database is to be hosted.
[enstore@dmsen03 tmp]$ mkdir /tmp/pitr_restore_test1 [enstore@dmsen03 tmp]$ cd /tmp/pitr_restore_test1/ [enstore@dmsen03 pitr_restore_test1]$ ls backup_label global pg_hba.conf.old pg_log pg_serial pg_stat_tmp pg_twophase postgresql.conf base pg_clog pg_hba.conf.original pg_multixact pg_snapshots pg_subtrans PG_VERSION postgresql.conf.old conf.d pg_hba.conf pg_ident.conf pg_notify pg_stat pg_tblspc pg_xlog