Re: restore_command ignored in recovery.conf on standby

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема Re: restore_command ignored in recovery.conf on standby
Дата
Msg-id 20140414032247.GU2556@tamriel.snowman.net
обсуждение исходный текст
Ответ на Re: restore_command ignored in recovery.conf on standby  (Rene Romero Benavides <rene.romero.b@gmail.com>)
Список pgsql-general
Rene,

* Rene Romero Benavides (rene.romero.b@gmail.com) wrote:
> What I did (I bet there's a better way) is this:
> restore_command='/db/standby_node/scripts/wal_restore.sh %f %p'
>
> # wal_restore.sh
> #!/bin/bash
> /bin/tar -xzf /db/wal_archives/$1.tar.gz -C /tmp
> cp /tmp/$1 $2
> rm /tmp/$1

You'll probably want to be more careful here- this script could exit
with 'success' (meaning zero) even if some of the above commands fail.
When writing reliable shell scripts, you really need to check the exit
status of each command.  Note that you can return a high-value (>128,
iirc) from your shell script to indicate 'permanent' failure while
trying to do WAL recovery and PG will give up and stop trying.

Is there any particular reason you're tar'ing up the WAL files in the
first place..?  It'd surely be easier if you simply gzip'd them and then
used something like 'zcat /path/to/wal/archive/%f.gz > %p'.

The other option, if you really want to keep them tar'd, would be to use
tar's -O option, eg:

tar -O -zxf /db/wal_archives/%f.tar.gz %f > %p

There is also a --transform option that you could pass to tar to change
the filenames.

> My best regards to Stephen Frost.

Thanks!

    Stephen

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Rene Romero Benavides
Дата:
Сообщение: Re: restore_command ignored in recovery.conf on standby
Следующее
От: Jeff Janes
Дата:
Сообщение: Re: restore_command ignored in recovery.conf on standby