Search Postgresql Archives

Backup on PITR slave?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 from step #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@xxxxxxxxxx / aim:depeszhdl / skype:depesz_hdl / gg:6749007

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux