Обсуждение: warm standby issues
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
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
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 This is my configuration in the primary D.B
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