Re: restore_command ignored in recovery.conf on standby

Поиск
Список
Период
Сортировка
От Rene Romero Benavides
Тема Re: restore_command ignored in recovery.conf on standby
Дата
Msg-id CANaGW08-HszMdJuv5K-yn7MbDA8GoeH5dw5Mz7A4LMBV1GqJHg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: restore_command ignored in recovery.conf on standby  (Stephen Frost <sfrost@snowman.net>)
Ответы Re: restore_command ignored in recovery.conf on standby  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-general
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


My best regards to Stephen Frost.


2014-04-13 21:58 GMT-05:00 Stephen Frost <sfrost@snowman.net>:
* Rene Romero Benavides (rene.romero.b@gmail.com) wrote:
> Yep, I checked:
>
> [postgres@uxmal standby_node]$ /bin/tar -xzf
> /db/wal_archives/00000001000001ED000000FB.tar.gz -C
> /db/standby_node/pg_xlog/
> [postgres@uxmal standby_node]$ echo $?
> 0

Err, sure, but that isn't actually what is being passed via %p.  %p will
be something like 'pg_xlog/RECOVERY_WAL', as I said, which *won't* work
for your tar command, eg:

sfrost@tamriel:/home/sfrost> tar -xzf zz.tar.gz -C zz/zz
tar: zz/zz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
sfrost@tamriel:/home/sfrost> echo $?
2

> [postgres@uxmal standby_node]$ ls /db/standby_node/pg_xlog/ | grep
> 00000001000001ED000000FB
> 00000001000001ED000000FB

Noooo, PG tells you via %p the *specific* filename to use, do not just
overwrite files in pg_xlog willy-nilly with a tar command.

        Thanks,

                Stephen



--
El genio es 1% inspiración y 99% transpiración.
Thomas Alva Edison
http://pglearn.blogspot.mx/

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

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