Re: PITR as Online Backup Solution

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: "Thomas F(dot) O'Connell" <tfo(at)sitening(dot)com>
Cc: PGSQL Admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: PITR as Online Backup Solution
Date: 2006-03-03 17:54:52
Message-ID: 1141408492.27729.505.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, 2006-03-02 at 16:38 -0600, Thomas F. O'Connell wrote:
> I'm administering a database that is not immediately a good candidate
> for replication via Slony. As an interim solution, I'd like to give
> PITR a shot. The primary goal is to have a failover scenario that
> allows for recovery within a window that's much smaller than it would
> be if the only option were the output of the previous night's
> pg_dump, and the need has arisen jointly with the fact that pg_dump
> has become an unwieldy process on this database.
>
> Here's the main question: Is it possible to replay logs continuously
> against a database that has already been recovered? The documentation
> only covers the scenario of full recovery from scratch, and I'm
> wondering if this is because this is the only scenario possible with
> the current level of PITR functionality.

> Ideally, I'd be able to take a base backup of a production system,
> copy it to a remote system, which is also the repository for segment
> files generated by archive_command, and complete the recovery process
> outlined in the docs. From that point, it would make sense to me that
> I should be able to continuously replay WAL files against the new
> database (possibly as soon as archive_command generates a new one)
> without having to purge my data directory. Is that a reasonable
> assumption?

Yes, it was designed to be able to do this.

> If so, then I need to know more about which steps to use from the
> recovery scenario presented in the docs and how to identify the state
> in which a given segment file exists.

> For instance, it's not
> immediately clear from the docs what happens to the segment files
> after recovery_command runs during the recovery scenario. It says
> those segments are copied from the archive directory, but then what?
> Are they recycled as in a basic postgres installation?

They overwrite each other, thus avoiding a build up of logs. It is
designed to support "infinite" recovery.

> Also, if this system eventually works as I expect it might be able
> to, would there ever be a reason to redo it from scratch (i.e., is
> one base backup sufficient ad infinitum)?

As long as you've read the documented caveats there are no design
limitations...but I would restart from a base backup weekly, to be sure.
It's all about certainty after all.

Best Regards, Simon Riggs

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Simon Riggs 2006-03-03 18:00:30 Re: PITR as Online Backup Solution
Previous Message Tom Lane 2006-03-03 17:17:51 Re: checkpoint_segments