Backing up the whole cluster

suggest change
$ pg_dumpall -f backup.sql

This works behind the scenes by making multiple connections to the server once for each database and executing pg_dump on it.

Sometimes, you might be tempted to set this up as a cron job, so you want to see the date the backup was taken as part of the filename:

$ postgres-backup-$(date +%Y-%m-%d).sql

However, please note that this could produce large files on a daily basis. Postgresql has a much better mechanism for regular backups - WAL archives

The output from pg_dumpall is sufficient to restore to an identically-configured Postgres instance, but the configuration files in $PGDATA (pg_hba.conf and postgresql.conf) are not part of the backup, so you’ll have to back them up separately.

postgres=# SELECT pg_start_backup('my-backup');
postgres=# SELECT pg_stop_backup();

To take a filesystem backup, you must use these functions to help ensure that Postgres is in a consistent state while the backup is prepared.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents