Mohammad Safyar
Mohammad Safyar

Reputation: 35

PostgreSQL Not Starting After Restoring from Backup

I am facing an issue with PostgreSQL not starting after I restored a backup. The problem occurred after I changed the server's system time and then restored the backup. The backup was created with UTC time, and now when I attempt to start PostgreSQL after restoration, it does not start, and I see errors related to the recovery.signal file.

Here's what I have done so far:

I changed the system time of the server, which I suspect caused the issue. I restored the backup from pgBackRest. I found that the recovery.signal file is present in the data directory. When I try to start PostgreSQL, it doesn't start, and I get errors related to recovery.signal.

Output of pgbackrest --stanza=red8 info:

stanza: red8
    status: ok
    cipher: none
    db (current)
        full backup: 20241129-041935F
        timestamp start/stop: 2024-11-29 07:49:35+03:30 / 2024-11-29 07:49:39+03:30

/var/lib/postgresql/17/main:

backup_label  pg_commit_ts  pg_multixact  pg_serial     pg_stat_tmp  pg_twophase  pg_xact               recovery.signal
base          pg_dynshmem   pg_notify     pg_snapshots  pg_subtrans  PG_VERSION   postgresql.auto.conf
global        pg_logical    pg_replslot   pg_stat       pg_tblspc    pg_wal       postmaster.opts

output postgresql log

2024-11-29 08:37:18.161 UTC [5088] LOG:  restored log file "0000000E.history" from archive
2024-11-29 08:37:19.547 UTC [5088] LOG:  invalid checkpoint record
2024-11-29 08:37:19.547 UTC [5088] FATAL:  could not locate required checkpoint record at 0/37000080
2024-11-29 08:37:19.547 UTC [5088] HINT:  If you are restoring from a backup, touch "/var/lib/postgresql/17/main/recovery.signal" or "/var/lib/postgresql/17/main/standby.signal" and add required recovery options.
        If you are not restoring from a backup, try removing the file "/var/lib/postgresql/17/main/backup_label".
        Be careful: removing "/var/lib/postgresql/17/main/backup_label" will result in a corrupt cluster if restoring from a backup.
2024-11-29 08:37:19.550 UTC [5085] LOG:  startup process (PID 5088) exited with exit code 1
2024-11-29 08:37:19.550 UTC [5085] LOG:  aborting startup due to startup process failure
2024-11-29 08:37:19.550 UTC [5085] LOG:  database system is shut down
pg_ctl: could not start server
Examine the log output.
2024-11-29 08:39:09.115 UTC [5324] LOG:  starting PostgreSQL 17.2 (Ubuntu 17.2-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0, 64-bit
2024-11-29 08:39:09.115 UTC [5324] LOG:  listening on IPv4 address "127.0.0.1", port 5432
2024-11-29 08:39:09.118 UTC [5324] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-11-29 08:39:09.133 UTC [5327] LOG:  database system was interrupted; last known up at 2024-11-29 04:35:00 UTC
2024-11-29 08:39:09.143 UTC [5327] LOG:  starting backup recovery with redo LSN 0/37000028, checkpoint LSN 0/37000080, on timeline ID 12
2024-11-29 08:39:09.143 UTC [5327] LOG:  invalid checkpoint record
2024-11-29 08:39:09.143 UTC [5327] FATAL:  could not locate required checkpoint record at 0/37000080
2024-11-29 08:39:09.143 UTC [5327] HINT:  If you are restoring from a backup, touch "/var/lib/postgresql/17/main/recovery.signal" or "/var/lib/postgresql/17/main/standby.signal" and add required recovery options.
        If you are not restoring from a backup, try removing the file "/var/lib/postgresql/17/main/backup_label".
        Be careful: removing "/var/lib/postgresql/17/main/backup_label" will result in a corrupt cluster if restoring from a backup.
2024-11-29 08:39:09.151 UTC [5324] LOG:  startup process (PID 5327) exited with exit code 1
2024-11-29 08:39:09.151 UTC [5324] LOG:  aborting startup due to startup process failure
2024-11-29 08:39:09.151 UTC [5324] LOG:  database system is shut down

Upvotes: 0

Views: 75

Answers (0)

Related Questions