Warm standby

From: Johann Spies <jspies(at)sun(dot)ac(dot)za>
To: pgsql-admin(at)postgresql(dot)org
Subject: Warm standby
Date: 2007-02-27 08:34:37
Message-ID: 20070227083437.GA14003@sun.ac.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I want to setup a form of replication for postgresql using the warm
standby option
(http://www.postgresql.org/docs/8.2/static/warm-standby.html)

I have had success to let server A to copy the WAL logs to server B (the
standby server). But I have had no success on the recovery side of
things. I might just be overlooking something. You help will be
appreciated.

I have the following in the /etc/postgresql/8.2/main/recovery.conf on
server B:

restore_command = '/var/lib/postgresql/8.2/main/restore.sh /var/lib/postgresql/8.2/main/wal/%f "%p"'

and /var/lib/postgresql/8.2/main/restore.sh looks like this:

#!/bin/bash

RESTORE_FROM=$1
RESTORE_TO=$2
DELAY=100000
TRIGGERED=0
TRIGGER_FILE="/var/lib/postgresql/8.2/main/trigger"

copyfunc() {
if [ "$TRIGGERED" -eq "0" ]; then
cp -v -i $RESTORE_FROM $RESTORE_TO
fi
}

k=`expr $1 : '.*\(history\)'`

if [ "$k" == "history" ]; then
copyfunc;
exit $?;
fi

while [ ! -f "$RESTORE_FROM" -a "$TRIGGERED" -eq "0" ]; do
usleep $DELAY;
if [ -e $TRIGGER_FILE ]; then
TRIGGERED=1;
fi
done

copyfunc;

This was adapted from a howto at
http://www.postgresql.org/docs/8.2/static/warm-standby.html

The content of /var/lib/postgresql/8.2/main/wal/ looks like this:

$ ls wal
000000010000000000000000 00000001000000000000000E 00000001000000000000001C
000000010000000000000001 00000001000000000000000F 00000001000000000000001D
000000010000000000000002 000000010000000000000010 00000001000000000000001E
000000010000000000000003 000000010000000000000011 00000001000000000000001F
000000010000000000000004 000000010000000000000012 000000010000000000000020
000000010000000000000005 000000010000000000000013 000000010000000000000021
000000010000000000000006 000000010000000000000014 000000010000000000000022
000000010000000000000007 000000010000000000000015 000000010000000000000023
000000010000000000000008 000000010000000000000016 000000010000000000000024
000000010000000000000009 000000010000000000000017 000000010000000000000025
00000001000000000000000A 000000010000000000000018 000000010000000000000026
00000001000000000000000B 000000010000000000000019 000000010000000000000027
00000001000000000000000C 00000001000000000000001A 000000010000000000000028
00000001000000000000000D 00000001000000000000001B

And the postgresql-log shows:

2007-02-26 15:58:54 SAST LOG: database system was shut down at 2007-02-26 15:58:53 SAST
2007-02-26 15:58:54 SAST LOG: checkpoint record is at 0/42C9BC
2007-02-26 15:58:54 SAST LOG: redo record is at 0/42C9BC; undo record is at 0/0; shutdown TRUE
2007-02-26 15:58:54 SAST LOG: next transaction ID: 0/1098; next OID: 16385
2007-02-26 15:58:54 SAST LOG: next MultiXactId: 1; next MultiXactOffset: 0
2007-02-26 15:58:54 SAST LOG: database system is ready
2007-02-26 15:58:55 SAST LOG: incomplete startup packet

It does not seem to do anything about the WAL logs from the other
server.

What am I missing?

Regards
Johann
--
Johann Spies Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch

"If we confess our sins, he is faithful and just to
forgive us our sins, and to cleanse us from all
unrighteousness." I John 1:9

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message pedro noticioso 2007-02-27 17:46:58 Re: WAL files backup
Previous Message Achilleas Mantzios 2007-02-27 08:15:34 Re: host name?