pg_standby - Mailing list pgsql-patches

From Simon Riggs
Subject pg_standby
Date
Msg-id 1166097851.3733.74.camel@silverbirch.site
Whole thread Raw
Responses Re: pg_standby
List pgsql-patches
pg_standby and test framework, in separate .tar files

pg_standby
----------

  pg_standby is a production-ready program that can be used to
  create a Warm Standby server with PostgreSQL.

  The program is designed to be a wait-for restore_command,
  required to turn a normal archive recovery into a Warm Standby.
  Within the restore_command of the recovery.conf you could
  configure pg_standby in the following way:

    restore_command = 'pg_standby archiveDir %f %p'

$pg_standby
pg_standby allows Warm Standby servers to be configured
Usage:
  pg_standby [OPTION]... [ARCHIVELOCATION] [NEXTWALFILE] [XLOGFILEPATH]
                          note space between [ARCHIVELOCATION] and
[NEXTWALFILE]
with main intended use via restore_command in the recovery.conf
     restore_command = 'pg_standby [OPTION]... [ARCHIVELOCATION] %f %p'
e.g. restore_command = 'pg_standby -m /mnt/server/archiverdir %f %p'

Options:
  -d                      generate lots of debugging output (testing
only)
  -m                      moves file rather than copying from archive
  -t [TRIGGERFILE]        defines a trigger file to initiate failover
(no default)
  -s [SLEEPTIME]          number of seconds to wait between file checks
(default=5)
  -w [MAXWAITTIME]        max number of seconds to wait for a file (0
disables)(default=600)

pg_standby runs standalone and as a restore_command. Tested and working
successfully in both modes.

No signal handling - do we need some?
Works successfully with shutdown of standby server and via trigger file.

test_warm_standby
-----------------

bash script to run two PostgreSQL servers, one Primary, one Standby -
both running on same system. Servers use non-standard port numbers
deliberately, to avoid conflicts with other systems.

Designed to be executed from /usr/local/pgsql, nothing too fancy

File contents:

$ tar tf pg_standby.tar
contrib/pg_standby/
contrib/pg_standby/Makefile
contrib/pg_standby/pg_standby.c
contrib/pg_standby/README.pg_standby

allows make, make install, make distclean
intended for submission to core as a contrib module

$tar tf test_warm_standby.tar
test_warm_standby.primary.postgresql.conf
test_warm_standby.standby.postgresql.conf
test_warm_standby.standby.recovery.conf
test_warm_standby.start.sh
test_warm_standby.stop.sh

needs some discussion, code needs enhancement before commit
maybe implement config changes as edits rather than full scripts


All feedback welcome.


--
  Simon Riggs
  EnterpriseDB   http://www.enterprisedb.com


Attachment

pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: timing for \copy
Next
From: Tom Lane
Date:
Subject: Re: [PERFORM] 8.2rc1 (much) slower than 8.2dev?