pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
warm standby issues
3+ messages / 3 participants
[nested] [flat]

* warm standby issues
@ 2008-04-27 21:34  kevin kempter <kevin@kevinkempterllc.com>
  0 siblings, 1 reply; 3+ messages in thread

From: kevin kempter @ 2008-04-27 21:34 UTC (permalink / raw)
  To: pgsql-admin

Hi List;

I'm setting up a warm standby server on version 8.1.9

I setup a recovery.sh script to keep the standby cluster in recovery  
mode waiting for the next  WAL segment. everything works fine as long  
as the standby server is in recovery mode.  I see the recovery taking  
place in the postgres log of the standby server. I've set it up to  
exit the recovery.sh script if it see's a trigger file (to bring the  
standby online).

when I create the trigger file I see this:

copy /home/postgres/healthCareCoding/WAL/000000010000000000000004  
pg_xlog/RECOVERYXLOG
`/home/postgres/healthCareCoding/WAL/000000010000000000000004' ->  
`pg_xlog/RECOVERYXLOG'
LOG:  restored log file "000000010000000000000004" from archive
LOG:  could not open file "pg_xlog/000000010000000000000005" (log file  
0, segment 5): No such file or directory
LOG:  redo done at 0/4FFFE90
PANIC:  could not open file "pg_xlog/000000010000000000000004" (log  
file 0, segment 4): No such file or directory
LOG:  startup process (PID 9348) was terminated by signal 6
LOG:  aborting startup due to startup process failure
LOG:  logger shutting down


I see that the log 000000010000000000000004 was restored, but then  
when it tags the redo as done it complains that it cannot find the  
same log.

If I re-start the standby cluster and select count(*) from my test  
table (the table I'm inserting data into to fill the logs) I get this:

postgres=# select count(*) from t1 ;
ERROR:  xlog flush request 0/113730C is not satisfied --- flushed only  
to 0/1135018
CONTEXT:  writing block 1500 of relation 1663/10819/16384
postgres=#



My recovery.sh code is below, thanks in advance for any help...

/Kevin




#!/bin/bash

#DELAY=400000
DELAY=100
SEG_SIZE=16777216
TRIGGERED=0
TRIGGER_FILE="/home/postgres/healthCareCoding/trigger"
WAL_PATH="/home/postgres/healthCareCoding/WAL"
COPY_FLAG=0
RESTORE_FROM="${WAL_PATH}/$2"
RESTORE_TO=$1


echo "$1" | grep -i history
if [ $? -eq 0 ]
then
     if [ -f "$RESTORE_FROM" ]
     then
         echo "copy $RESTORE_FROM $RESTORE_TO"
         cp -v -i $RESTORE_FROM $RESTORE_TO
     fi
     exit
fi

while [ ! -f "$TRIGGER_FILE"  -a  $COPY_FLAG -eq 0 ]
do
     usleep $DELAY;
     if [ -f "$RESTORE_FROM" ]
     then
         fs=`ls -l $RESTORE_FROM`
         set - $fs
         echo "size= [$5]"
         if [ "$5" == "$SEG_SIZE" ]
         then
             COPY_FLAG=1
         fi
     fi
done

if [ -f "$TRIGGER_FILE" ]
then
     exit
fi

if [ ! -f "$TRIGGER_FILE" ]
then
     echo "copy $RESTORE_FROM $RESTORE_TO"
     cp -v -i $RESTORE_FROM $RESTORE_TO
     exit
fi





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: warm standby issues
@ 2008-04-27 23:58  Charles Duffy <charles.duffy@gmail.com>
  parent: kevin kempter <kevin@kevinkempterllc.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Charles Duffy @ 2008-04-27 23:58 UTC (permalink / raw)
  To: kevin kempter <kevin@kevinkempterllc.com>; +Cc: pgsql-admin

Hi Kevin,

On Mon, Apr 28, 2008 at 7:34 AM, kevin kempter
<kevin@kevinkempterllc.com> wrote:
> Hi List;
>
>  I'm setting up a warm standby server on version 8.1.9
>

I didn't think 8.1 supported warm-standby...

>  I setup a recovery.sh script to keep the standby cluster in recovery mode
> waiting for the next  WAL segment. everything works fine as long as the
> standby server is in recovery mode.  I see the recovery taking place in the
> postgres log of the standby server. I've set it up to exit the recovery.sh
> script if it see's a trigger file (to bring the standby online).
>
>  when I create the trigger file I see this:
>
>  copy /home/postgres/healthCareCoding/WAL/000000010000000000000004
> pg_xlog/RECOVERYXLOG

Try with 8.2 or above, and see if that makes your problem go away. Use
pg_standby instead of shell scripts.

Thanks,

Charles Duffy



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: warm standby issues
@ 2008-04-28 14:36  Julio Leyva <jcleyva@hotmail.com>
  parent: Charles Duffy <charles.duffy@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Julio Leyva @ 2008-04-28 14:36 UTC (permalink / raw)
  To: Charles Duffy <charles.duffy@gmail.com>; kevin kempter <kevin@kevinkempterllc.com>; +Cc: pgsql-admin

I have setup this feature using postgresql  8.3.1 on a suse linux version    and pg_standby as a recovery script, works very good and I use rsync as a script to ship logs

This is my configuration in the primary D.B


archive_mode = on 
archive_command = 'rsync -atz %p backup:/data01/wal_files/%f'
archive_timeout = 60  

This is the recovery.conf in the backup server
restore_command = 'pg_standby -l /data01/wal_files %f %p %r -t /tmp/pgsql.trigger.5432 2>>/tmp/standby.log'


Hope this help you 

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2008-04-28 14:36 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-04-27 21:34 warm standby issues kevin kempter <kevin@kevinkempterllc.com>
2008-04-27 23:58 ` Charles Duffy <charles.duffy@gmail.com>
2008-04-28 14:36   ` Julio Leyva <jcleyva@hotmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox