T
T
TemaKam2021-08-01 14:11:52
PostgreSQL
TemaKam, 2021-08-01 14:11:52

Why can't I restore a PostgreSQL cluster from a WAL backup?

astra linux 1.6, postgresql 9.6

for the sake of testing, I want to check how the recovery via WAL works;
initially there is a copy of the entire cluster, it is restored normally,
then I make some changes to the database
, I copy the only WAL file (let it be called 0001) from the /var/lib/ directory postgresql/9.6/main/pg_xlog with the usual cp command with the -p flag, so that postgres remains the owner, into the new /main/wal directory,

then I restore the entire cluster from the files, so there are no changes made,
now, just in case, I delete the WAL file from pg_xlog
after I create recovery.conf file in main with the command:
restore_command = 'cp -f /var/lib/postgresql/9.6/main/wal/0001%p'
and turn on the server accordingly

it seems like the recovery is going on:
aegVAxs.jpg
but then the following records begin:

spoiler
qpE9qMl.jpg
fzkDWOZ.jpg
sGkQ3zL.jpg

and in the end everything is interrupted
qDdZdK0.jpg
, what am I doing wrong in the end? in theory, you can just copy the WAL file for recovery?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TemaKam, 2021-08-01
@TemaKam

In general, I did so far as in the documentation
https://postgrespro.ru/docs/postgresql/9.6/continu...
through normal archiving . It
worked
, but the question remains open. You
can’t manually copy the WAL files yourself and then recover through them?
it's just strange that it works with cluster files, but doesn't want to with WAL

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question