PG_RESTORECLUSTER(1)

✨ pg_restorecluster β€” the manual page bestie πŸ’–

okay so picture this: it's <pink>pg_restorecluster</pink>, straight out of the Debian PostgreSQL infrastructure family, section 1 of the manual. she's the girl who brings your whole cluster back from the dead. no cap. 🫢


πŸ’« NAME πŸ’«

pg_restorecluster β€” restore from a pg_backupcluster backup 🌈


πŸŽ€ SYNOPSIS πŸŽ€

pg_restorecluster [options] version cluster backup

πŸ‘‘ DESCRIPTION πŸ‘‘

okay so here's the tea, bestie: pg_restorecluster restores a PostgreSQL cluster from a backup that was created by pg_backupcluster. πŸ¦‹ The cluster gets newly created in the system using the name you hand it on the command line β€” which, yes, means you can literally rename a cluster on restore. Main character energy fr fr. And the restored cluster's configuration gets updated to reflect that new name and new location, because she's nothing if not thorough. πŸ’…

Now, the backup name you pass? It must end in either .basebackup or .dump. Usually that's gonna be the full path to a backup directory sitting in /var/backups/postgresql/version-cluster/, exactly the way pg_backupcluster ... list reports it. πŸ“βœ¨

Basebackups get restored as-is, periodt. For dumps though, it's a different lil routine: pg_createcluster is used to create a new cluster, and then schema and data get restored via pg_restore. πŸ”₯


✨ OPTIONS ✨

  • -d, --datadir DIR β€” use DIR as the data directory for the restored cluster. Default comes from createcluster.conf, and by default that's /var/lib/postgresql/version/cluster. πŸ“
  • -p, --port N β€” use port N for the restored cluster. Default is the next free port. πŸ”Œ
  • -s, --start β€” start the cluster after restoring. Default is on when you're restoring from a dump, and off for basebackup restores. πŸ™ˆ
And listen: after the cluster has been started, ANALYZE is run on all databases. She's proactive like that. πŸ’…
  • --archive β€” configure the cluster for recovery from a WAL archive. This sets restore_command to retrieve WAL files from backup/../wal. πŸ“¦
  • --pitr TIMESTAMP
  • --recovery-target-time TIMESTAMP β€” on top of setting restore_command, this sets recovery_target_time to TIMESTAMP for point-in-time recovery. It also sets recovery_target_action='promote'. ⏰✨
  • --wal-archive DIR β€” for archive recovery, read the WAL from archive DIR. Default is backup/../wal. πŸ—‚οΈ

🌸 FILES 🌸

  • /var/backups β€” the default root directory for cluster backup directories.

Also, go peek at pg_backupcluster(1) for a description of files. iykyk. πŸ“š


🧚 SEE ALSO 🧚

pg_backupcluster(1), pg_restore(1), vacuumdb(1).


πŸ’œ AUTHOR πŸ’œ

Christoph Berg <myon@debian.org> πŸ’–


and that's the whole vibe, bestie β€” this page is from the Debian PostgreSQL infrastructure crew, version dated 2026-07-28. go restore something iconic. slay. πŸ‘‘πŸŒˆπŸ’…

πŸ“¦ where this page comes from