Re: Replaying xlogs from beginning

Поиск
Список
Период
Сортировка
От otheus uibk
Тема Re: Replaying xlogs from beginning
Дата
Msg-id CALbQNd1ckhCBUaoyDTd=4tUJZtL90JgqRfONjNCZmCmO5e9pFA@mail.gmail.com
обсуждение исходный текст
Ответ на Replaying xlogs from beginning  (otheus uibk <otheus.uibk@gmail.com>)
Ответы Re: Replaying xlogs from beginning  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: Replaying xlogs from beginning  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
I came up with an answer to the _second_ question (how do I do this from a new instance?).

In the new instance directory:
1. Hack the system ID in the global/pg_control file to that of the original instance. 
   1a. Use pg_controlinfo to get the hex version of the control id:
     $ pg_controldata | perl -l -n -e 'if (/^Database system identifier:\s+(\d+)$/) { $sysid=sprintf("%x",$1);print join(" ",reverse $sysid=~m/../g); exit; }'
     fb fb 59 56 b9 31 58 53
   1b. Use a hex editor (vim with xxd / xxd -r will do) to replace the first bytes with these values.

2. The new control file will be unusable because its CRC won't match. Fix that with pg_resetlog.
    $ pg_resetlog -f 

3. Copy the very first pg_xlog file into place. The rest can be copied by hand or found using whatever you use for the "restore_command"

4. Create recovery.conf file.

Start instance.

Again, this worked for me. What I want to be sure of is: does this really work? And I still want to know: can I do this without creating a new instance?

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

Предыдущее
От: Alex Magnum
Дата:
Сообщение: Log Monitoring with PG Admin
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Replaying xlogs from beginning