Backup "Best Practices" - Mailing list pgsql-general

From Israel Brewster
Subject Backup "Best Practices"
Date
Msg-id BBC8E909-699C-4BE6-BBC8-313A6A442D0F@ravnalaska.net
Whole thread Raw
Responses Re: Backup "Best Practices"  (John R Pierce <pierce@hogranch.com>)
Re: Backup "Best Practices"  (Vick Khera <vivek@khera.org>)
Re: Backup "Best Practices"  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-general
I was wondering if someone could inform me about, or point me to an online article about best practices for backing up a postgresql database cluster? At the moment, I have two servers running with streaming replication for failover purposes, and then I do nightly database dumps for recovery/backup purposes. However, I feel this approach is lacking in a couple areas I can think of:

- If a total failure occurs towards the end of the day, we could potentially loose a whole days worth of data. Similar argument for user error - there is no way to "undo" a catastrophic user data error without going all the way back to the previous day
- Less-than-ideal recovery under some scenarios. Since each database in the cluster is dumped individually, this is good should only *one* database need to be restored, but could get tedious should the entire cluster need to be restored.

To mitigate these issues, I am thinking of supplementing the individual dumps with a full base backup and WAL archiving to a NFS share. This should enable (relatively) quick/easy recovery from backup, plus the ability to do PIT Recovery. I do have a few questions with this approach, however:

- How do I figure out how often I should take a full base backup? I know this will depend on the amount of traffic my database is doing, and how long I am willing to wait for WAL files to be replayed - the more WAL files needing replayed, the longer recovery will take - but is there some rule of thumb that I can use to calculate how often I need a new base backup? Perhaps based on the number of WAL files?
- What is the "best" (or just a good) method of keeping the WAL archives under control? Obviously when I do a new basebackup I can "cleanup" any old files that said backup doesn't need, but how do I know what those are?
- Should I be looking at any other backup methods in addition to/instead of the basebackup/WAL archive scheme?

Thanks for any information!
-----------------------------------------------
Israel Brewster
Systems Analyst II
Ravn Alaska
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7293
-----------------------------------------------



Attachment

pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: Partial update on an postgres upsert violates constraint
Next
From: John R Pierce
Date:
Subject: Re: Backup "Best Practices"