Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] PITR - base backup question

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Michael Nolan" <htfoot(at)gmail(dot)com>
Cc: "Richard Broersma" <richard(dot)broersma(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, pgsql-admin(at)postgresql(dot)org
Subject: Re: [GENERAL] PITR - base backup question
Date: 2008-08-27 13:32:56
Message-ID: b42b73150808270632t4823d522i42576a2e8022383c@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-adminpgsql-general
On Wed, Aug 27, 2008 at 9:18 AM, Michael Nolan <htfoot(at)gmail(dot)com> wrote:
> I have what I have sometimes called a 'tepid spare' backup.  Once a week I
> copy the physical files over to another system (actually to two of them) and
> every few hours I make sure the archived WAL log files are in sync (using
> rsync.)


I have a couple of comments...see below:

> 3.  Shut down the Postgresql server running on the backup server, if any
>          pg_ctl stop
>     (Use 'ps ax' to make sure the server is stopped.)

probably pg_ctl -m fast stop or -m immediate...since we are overwriting it.

> 5.  Delete the entire contents of the /disk1/postgres/data directory tree.
>     MAKE ABSOLUTELY SURE YOU ARE IN THE /disk1/postgres/data directory!
>
>      cd /disk1/postgres/data
>      pwd
>      rm -rf *

why not just rm -rf /disk1/postgres/data?

> 6.  Restore the tar file for the low-level backup from the live server
>
>     tar xvf /usr/local/pgsql/tardir/pg_part1.tar
>
>     (This restore may take 2-3 hours)
>
> 7.  Remove the PostgreSQL log file and the WAL files that were restored
>     from the tar archive

I prefer to exclude WAL files from the original tar, and recreate the
folders here (being careful to chown them to postgres account).  Every
little bit helps.


> 12. Go to the directory where the WAL files have been archived on
>     the server and remove all files older than the file matching the
>     last .backup file.  The fastest way to do this is as follows:
>
>     cd /usr/local/pgsql/archivedir
>     ls -1 > files

This is a nice touch.  With a little bash-fu you could do a find |
xargs rm and list/kill the files in one pass.  In the standby setups
I've done I usually script the whole process, a prep on the main and a
startup on the standby.

merlin

In response to

Responses

pgsql-admin by date

Next:From: Phoenix KiulaDate: 2008-08-27 13:36:35
Subject: Re: Dumping/Restoring with constraints?
Previous:From: Terry Lee TuckerDate: 2008-08-27 13:29:41
Subject: Re: Dumping/Restoring with constraints?

pgsql-general by date

Next:From: Phoenix KiulaDate: 2008-08-27 13:36:35
Subject: Re: Dumping/Restoring with constraints?
Previous:From: Terry Lee TuckerDate: 2008-08-27 13:29:41
Subject: Re: Dumping/Restoring with constraints?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group