Backups and point-in-time recovery

Protect Hangar databases with point-in-time recovery to any second, scheduled dumps to your own S3 bucket, and restores that never overwrite your data.

Updated

Hangar gives you three ways to get data back, and you can use them together:

  • Point-in-time recovery for PostgreSQL, MySQL and MariaDB.
  • Scheduled backups of PostgreSQL, MySQL, MariaDB, MongoDB and libSQL to an S3-compatible bucket of yours.
  • Volume backups for files your apps keep on a volume.

All of them are in the service's Backups section.

Point-in-time recovery

Point-in-time recovery archives every change to the database as it happens. Changes reach the backup within a minute, so you can recover the database as it was at any second of its history, not just at last night's backup.

Turn it on from the database's backups. The database restarts once to start archiving, then takes its first base backup; recovery is possible as soon as that finishes. How far back you can go depends on your plan.

To recover, choose a moment, or the most recent one backed up. The database as it was then goes into a new database in the same environment, which deploys on its own once the data is in. The original is never overwritten, so you can compare the two, copy back only what you lost, or point your app at the recovered one.

Turning point-in-time recovery off restarts the database and deletes its history. Scheduled backups are not affected.

Point-in-time recovery is available for PostgreSQL, MySQL and MariaDB where your plan includes it.

Scheduled backups

PostgreSQL, MySQL, MariaDB, MongoDB and libSQL databases can also be dumped on a schedule to an S3-compatible bucket you own, such as Amazon S3, Cloudflare R2, Wasabi or DigitalOcean Spaces. Because the files land in your own account, they also give you a copy outside Hangar.

  1. Add the bucket in Settings → Backup storage.
  2. In the database's backups, create a backup with that destination, a cron schedule and how many of the latest backups to keep.

You can run a backup at any time and restore a database from any of the files.

Volume backups

Files on a volume are backed up with daily, weekly or monthly snapshots, or continuously every 15 minutes, and restored into a new volume. Volumes explains how.

What you pay for

Point-in-time recovery history and volume backups are stored by Hangar and billed as backup storage, by the space they take. Scheduled backups to your own bucket are stored, and billed, by your storage provider. See Pricing.

Frequently asked questions

Can I restore a Postgres database on Hangar to a specific second?
Yes, with point-in-time recovery, available for PostgreSQL, MySQL and MariaDB where your plan includes it. Every change is archived as it happens, and you can recover the database as it was at any moment of its history into a new database.
Does a restore overwrite my database?
No. Point-in-time recovery and volume restores always create a new database or volume, and the original is left untouched until you decide what to do with it.

Deploy your app on Hangar

Connect a repository and it is live in minutes.

Start deploying