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

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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: test_warm_standby.tar
Description: application/x-tar (40.0 KB)
Attachment: pg_standby.tar
Description: application/x-tar (20.0 KB)

Responses

pgsql-hackers by date

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

pgsql-patches by date

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

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