Backup on PITR slave? - Mailing list pgsql-general

From hubert depesz lubaczewski
Subject Backup on PITR slave?
Date
Msg-id 20091101142108.GA16348@depesz.com
Whole thread Raw
List pgsql-general
Hi,
I'm wondering what steps should I do to make *working* backup on PITR
slave.

General rationale is: to reduce amount of work master has to do.

Let's assume we have master server, slave server, and shared
/wal_archive directory.

Postrges on both servers is in the same version, with datadir being
/data.

My current idea is:
(everything on slave).

1. pg_controldata /data > /tmp/control.before
2. copy /data to /tmp/data
3. pg_controldata /data > /tmp/control.after.cp
4. Wait, periodically checking pg_controldata /data - wait till "Latest checkpoint location" will be different than ne
fromstep #3, then write it as /tmp/control.after.change 
5. Create /tmp/data/backup.label with:
START WAL LOCATION: 0/( "Latest checkpoint's REDO location" from /tmp/control.before)
STOP WAL LOCATION: 0/("Latest checkpoint location" from /tmp/control.after.change)
CHECKPOINT LOCATION: 0/("Prior checkpoint location" from /tmp/control.after.change)
START TIME: Timestamp of step #1
LABEL: q
STOP TIME: Timestamp of step #4
6. copy all xlog files from /wal_archive, that are from "START WAL LOCATION:" to the newest - to /tmp/data/pg_xlog
7. rm /tmp/data/postmaster.pid
8. rm /tmp/data/recovery.conf
9. tar/gz/transfer /tmp/data.

Will it work? Any edge cases that will make it useless? Any other way I
should do to make the backup on slave?

depesz

--
Linkedin: http://www.linkedin.com/in/depesz  /  blog: http://www.depesz.com/
jid/gtalk: depesz@depesz.com / aim:depeszhdl / skype:depesz_hdl / gg:6749007

pgsql-general by date:

Previous
From: Andre Lopes
Date:
Subject: Store images on database ou in external files?
Next
From: Thomas Kellerer
Date:
Subject: Re: Store images on database ou in external files?