Обсуждение: PITR WAL Restore and configuration

Поиск
Список
Период
Сортировка

PITR WAL Restore and configuration

От
Techie
Дата:
Hi All,

We are moving to a new backup solution where we will backup direct to the backup server using a Daily Base backup with pg_start_backup and WAL Log backups every 4 hours.
In regards to retention we are planning on this.

WAL Logs
Daily 4 to 6 times: 60 days retention.

Base Backup
Daily: Mon-Thursday 7 Day Retention
Weekly: Friday 31 Day Retention
Monthly: Last Day of month: 365 Day Retention

So what I am looking for is some clarification on the Base Backups that are 6 months old for example.
Since my WAL Log backups have a 2 month retention I can do PITR from any Base Backup + WAL Logs any day from 2 months back.

However let's say for example I want to restore the Base Backup from 6 months ago, I only have the Base Backups.. Will I be able to recover to that point in time using that Base backup? I have read the PITR documentation however I still struggle to understand this part of it.

Thanks
Jimmy

Re: PITR WAL Restore and configuration

От
Kevin Grittner
Дата:
Techie <techchavez@gmail.com> wrote:

> let's say for example I want to restore the Base Backup from 6
> months ago, I only have the Base Backups.. Will I be able to
> recover to that point in time using that Base backup?

Not without all of the WAL files from the point pg_start_backup()
was run until the point pg_stop_backup() was run.  Earlier WAL
files won't matter.  You will be able to restore to any point in
time from when pg_stop_backup() onward as long as you have an
unbroken series of WAL files (and any .history files which were
generated).

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: PITR WAL Restore and configuration

От
Techie
Дата:
Thanks man, I think I understand  after re-reading the PITR WAL documentation a little better. I think that I need the WAL log or logs mentioned in the .backup file.

So for example when I run the pg_start_bkup and pg_stop_backup It outputs something like this into the .backup file

START WAL LOCATION: 111/CD000020 (file 0000000200000111000000CD)
STOP WAL LOCATION: 111/CD0000A8 (file 0000000200000111000000CD)
CHECKPOINT LOCATION: 111/CD000020
BACKUP METHOD: pg_start_backup
BACKUP FROM: master
START TIME: 2014-08-02 01:15:10 CDT
LABEL: master_backup
STOP TIME: 2014-08-02 01:16:34 CDT

This means that in ordrt to restore this base backup I need the contents of the base backup and this WAL log 0000000200000111000000CD, is that correct?

If so I can reference the latest .backup file in the pg_xlog directory for the base backup.. I think thi is how it works.


Thanks
Jimmy




On Sun, Aug 3, 2014 at 9:12 AM, Kevin Grittner <kgrittn@ymail.com> wrote:
Techie <techchavez@gmail.com> wrote:

> let's say for example I want to restore the Base Backup from 6
> months ago, I only have the Base Backups.. Will I be able to
> recover to that point in time using that Base backup?

Not without all of the WAL files from the point pg_start_backup()
was run until the point pg_stop_backup() was run.  Earlier WAL
files won't matter.  You will be able to restore to any point in
time from when pg_stop_backup() onward as long as you have an
unbroken series of WAL files (and any .history files which were
generated).

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: PITR WAL Restore and configuration

От
Albe Laurenz
Дата:
Techie wrote:
> Thanks man, I think I understand  after re-reading the PITR WAL documentation a little better. I think that I need
theWAL log or logs mentioned in the .backup file.
 
> So for example when I run the pg_start_bkup and pg_stop_backup It outputs something like this into the .backup file
>
> START WAL LOCATION: 111/CD000020 (file 0000000200000111000000CD)
> STOP WAL LOCATION: 111/CD0000A8 (file 0000000200000111000000CD)

[...]

> This means that in ordrt to restore this base backup I need the contents of the base backup and this WAL log
0000000200000111000000CD,is that correct?
 

Yes.

Yours,
Laurenz Albe