All,
I am trying to perform a PITR restore using barman using recover command. The problem is that the server remains in the read-only state once the barman recover is done. Is there a way by which the destination server comes up as a read-write server on its own once the PITR is done? Based on barman documentation, I was hoping –target-action 'promote' might work but that didn't help.
I using barman 2.10 on postgres version 10.12.
Following is the command that I am using to perform PITR:
barman@abc-barman01:~ $ barman recover --target-time '05/13/2020 14:00:00' --target-action 'promote' --remote-ssh-command "ssh postgres@abc-pg03" abc-pg01 20200512T203002 /var/lib/pgsql/10/data
Starting remote restore for server abc-pg01 using backup 20200512T203002
Destination directory: /var/lib/pgsql/10/data
Remote command: ssh postgres@abc-pg03
Doing PITR. Recovery target time: '2020-05-13 14:00:00-04:00'
Using safe horizon time for smart rsync copy: 2020-04-04 09:27:29.180929-04:00
Copying the base backup.
Copying required WAL segments.
Generating recovery configuration
Identify dangerous settings in destination directory.
IMPORTANT
These settings have been modified to prevent data losses
postgresql.conf line 219: archive_command = false
WARNING
You are required to review the following options as potentially dangerous
postgresql.conf line 83: ssl_cert_file = 'server.crt'
postgresql.conf line 84: ssl_key_file = 'server.key'
Recovery completed (start time: 2020-05-19 15:38:23.157146, elapsed time: 24 minutes, 21 seconds)
Your PostgreSQL server has been successfully prepared for recovery!
You have mail in /var/spool/mail/barman
Currently, I run pg_wal_replay_resume() manually once the recovery is done to bring the server to read-write mode. I would really appreciate if someone can look into this.
Best Answer
Since barman 2.4, there are two option for after recovery behavior. They are --target-action option, accepting the following values:
Barman 2.4 also adds the --standby-mode option for the recover command which, if specified, properly configures the recovered instance as a standby by creating a standby.signal
Good luck.
If you like the answer, pls vote it up. WY