pg_standby

From: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
To: <pgsql-patches(at)postgresql(dot)org>
Subject: pg_standby
Date: 2006-12-14 12:04:10
Message-ID: 1166097851.3733.74.camel@silverbirch.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers 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 Content-Type Size
pg_standby.tar application/x-tar 20.0 KB
test_warm_standby.tar application/x-tar 40.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2006-12-14 12:19:10 Re: pg_standby and build farm
Previous Message Zeugswetter Andreas ADI SD 2006-12-14 11:28:41 Re: Operator class group proposal

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-12-14 21:10:03 Re: [PERFORM] 8.2rc1 (much) slower than 8.2dev?
Previous Message Jim C. Nasby 2006-12-13 19:34:07 Re: Load distributed checkpoint