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,--datadirDIR β use DIR as the data directory for the restored cluster. Default comes fromcreatecluster.conf, and by default that's/var/lib/postgresql/version/cluster. π-p,--portN β 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 setsrestore_commandto retrieve WAL files frombackup/../wal. π¦--pitrTIMESTAMP--recovery-target-timeTIMESTAMP β on top of settingrestore_command, this setsrecovery_target_timeto TIMESTAMP for point-in-time recovery. It also setsrecovery_target_action='promote'. β°β¨--wal-archiveDIR β for archive recovery, read the WAL from archive DIR. Default isbackup/../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
- ubuntu stonking: postgresql-common 293ubuntu1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms