0

I am encountering an error in one of the replication clusters on my Ubuntu machine with PostgreSQL version 13 database. The error message is as follows:

FATAL: could not restore file "00000004.history" from archive: command not found.

I looked at the log files of the cluster and extracted the latest log file. The details of the log file are as follows:

[email protected] - PostgreSQL Cluster 13-mydb
     Loaded: loaded (/lib/systemd/system/[email protected]; enabled-runtime; vendor preset: enabled)
     Active: failed (Result: protocol) since Thu 2023-11-09 17:01:44 +03; 1min 32s ago
    Process: 767207 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 13-mydb start (code=exited, status=1/FAILURE)

Nov 09 17:01:44 master postgresql@13-mydb[767207]: sh: 1: pgbackrest: not found
Nov 09 17:01:44 master postgresql@13-mydb[767207]: 2023-11-09 17:01:44.700 +03 [767228] FATAL:  could not restore file "00000004.history" from archive: command not found
Nov 09 17:01:44 master postgresql@13-mydb[767207]: 2023-11-09 17:01:44.703 +03 [767227] LOG:  startup process (PID 767228) exited with exit code 1
Nov 09 17:01:44 master postgresql@13-mydb[767207]: 2023-11-09 17:01:44.703 +03 [767227] LOG:  aborting startup due to startup process failure
Nov 09 17:01:44 master postgresql@13-mydb[767207]: 2023-11-09 17:01:44.745 +03 [767227] LOG:  database system is shut down
Nov 09 17:01:44 master postgresql@13-mydb[767207]: pg_ctl: could not start server
Nov 09 17:01:44 master postgresql@13-mydb[767207]: Examine the log output.
Nov 09 17:01:44 master systemd[1]: [email protected]: Can't open PID file /run/postgresql/13-mydb.pid (yet?) after start: Operation not permitted
Nov 09 17:01:44 master systemd[1]: [email protected]: Failed with result 'protocol'.
Nov 09 17:01:44 master systemd[1]: Failed to start PostgreSQL Cluster 13-mydb.

I couldn't figure out what I need to do in this regard.

The restore_command may stem from a previous archive recovery on the primary server.

0

1 Answer 1

0

The immediate cause is that you gave a restore_command configured in postgresql.conf or postgresql.auto.conf that contains pgbackrest, but either pgBackRest is not installed or the command cannot be found, because you didn't use the absolute path to a non-standard location, like

restore_command = '/path/to/pgbackrest/installation/bin/pgbackrest ...'

Perhaps that restore_command is left behind from a previous restore on the primary server. In that case, you can simply remove it. You should also remove all other recovery parameters like recovery_target_*.

However, it is a good thing to have restore_command set on a standby server, so that the standby can catch up using WAL from the archive if it falls behind. For that, you'd have to install pgBackRest on the standby server.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.