Search Postgresql Archives

Re: Replaying xlogs from beginning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux