I updated my postgres from 10 to 14 few weeks ago. The recovery used to work before (restoring the backup on a different postgres server):

  1. Put the barman backup into the folder
ssh -i ./do.pem [email protected] "docker exec barman_1 barman recover --target-time=$(date --iso-8601=seconds) db latest /var/lib/barman/recovered"
  1. Copying to the second server
rsync -e "ssh -i ./do.pem" -r [email protected]:/mnt/volume_fra1_01/barman/recovered .
  1. Overriding the settings
rm -r postgres
mkdir -p postgres/14/data
mv recovered/* postgres/14/data
rm postgres/14/data/postgresql.auto.conf
echo "max_connections = '2000'" > postgres/14/data/postgresql.auto.conf
  1. Docker-compose up
docker-compose up db
  1. So it used to work (postgres 10 started to copy WAL from barman files) and I had to turn off the recovery mode executing sql command on the db. However with Postgres 14 it doesn't work. Db logs
db_1  |
db_1  | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_1  |
db_1  | 2022-01-08 10:01:08.610 UTC [1] LOG:  starting PostgreSQL 14.1 (Debian 14.1-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
db_1  | 2022-01-08 10:01:08.610 UTC [1] LOG:  listening on IPv4 address "", port 5432
db_1  | 2022-01-08 10:01:08.610 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1  | 2022-01-08 10:01:08.613 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1  | 2022-01-08 10:01:08.620 UTC [27] LOG:  database system was interrupted; last known up at 2022-01-07 16:44:21 UTC
db_1  | 2022-01-08 10:01:08.785 UTC [27] FATAL:  must specify restore_command when standby mode is not enabled
db_1  | 2022-01-08 10:01:08.787 UTC [1] LOG:  startup process (PID 27) exited with exit code 1
db_1  | 2022-01-08 10:01:08.787 UTC [1] LOG:  aborting startup due to startup process failure
db_1  | 2022-01-08 10:01:08.806 UTC [1] LOG:  database system is shut down

There is a recovery.signal file in the postgres/14/data folder.

root@dev:~/targ-app/postgres/14/data# ls -a
.           backup_label     base          pg_dynshmem    pg_logical    pg_replslot   pg_stat      pg_tblspc    pg_xact                      postgresql.conf         recovery.signal
..          backup_manifest  global        pg_hba.conf    pg_multixact  pg_serial     pg_stat_tmp  pg_twophase  postgresql.auto.conf         postgresql.conf.origin
PG_VERSION  barman_wal       pg_commit_ts  pg_ident.conf  pg_notify     pg_snapshots  pg_subtrans  pg_wal       postgresql.auto.conf.origin  postmaster.opts

1 Answer 1


The answer

restore_command = 'cp barman_wal/%f %p'
recovery_end_command = 'rm -fr barman_wal'
recovery_target_time = '2022-01-08T17:07:14+00:00'
  • 4
    Please add details about what the effect of this code is, and how it answers the question.
    – Hannah Vernon
    Commented Jan 8, 2022 at 18:15
  • I'm pretty sure barman wrote the required configuration in postgresql.auto.conf. But you deleted it. Before postgresql 12, the pitr configuration was written to a different file recovery.conf.
    – Melkij
    Commented Dec 21, 2023 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.