PostgreSQL continuous backup and point-in-time recovery
Restore PostgreSQL to a moment before a bad migration or deletion, rather than losing the writes since a daily backup.
Updated
At 16:10 on a Friday, a migration drops the wrong column. The last daily copy of your database dates from the night before, a day of orders ago. PostgreSQL Continuous backup lets you recover more recent data. It saves backups and database changes to your storage bucket, so you can restore to a moment just before the migration.
Scene 1 of 8: A backup each day
This database has backups enabled. Each day in this example, Tenkai sends a full, encrypted copy to your storage bucket. Writes after that copy are not in it.
Restore to a chosen moment
PostgreSQL rebuilds the database from a physical backup and replays its write-ahead log, or WAL, up to your moment. A Restore to a moment stops the database, fills a new volume and replays the logs there. It keeps the connection settings, so your applications find the database where it was. The changes made after that moment are gone from the running database.
To keep the source running, create a New database from the moment instead. It gets its own credentials and can live on another of your team's clusters with the same CPU architecture. Your applications use it once you bind them to it.
The period you can return to
Tenkai takes a full backup each week and saves the changes between backups. Your daily encrypted backups carry on too. With successful scheduled backups, you get roughly 7 to 14 days of history. Tenkai shows the available periods so you can choose how far back to restore.
The history begins once the first physical backup ends and its logs have reached the bucket. The latest moment you can choose trails the live database by a few minutes. A lost log or a failed archive leaves a gap. Once the bucket answers again, a new physical backup starts another period. Choose a moment inside one of those periods.
A restore keeps the earlier history until it expires, so you can still return to a moment that the restore undid, or create a new database from it.
What stays in your bucket
Continuous backup stores its physical backups and WAL as your bucket provider stores them. Your team's backup key encrypts the daily dumps rather than this history, so guard access to the bucket and choose its storage encryption with that in mind. The bucket keys stay on the PostgreSQL node while it archives. They need permission to list the bucket.
When you turn continuous backup on, the database restarts. When you turn it off, Tenkai deletes the continuous history once the database stops archiving. Deleting the database removes that history as well. While continuous backup is on, a restore to a moment replaces the source's data. To read a daily dump, create a new database from that backup.
Recover after an outage
PostgreSQL keeps sending WAL to the bucket while Tenkai is unavailable. When Tenkai returns, it queues the backups that fell due and refreshes the available history.
If the database's disk is lost, create a new database from an available moment and reconnect your applications. Keep the old project until you have checked the restored data, because deleting it removes its continuous history.
Measure a restore before you rely on it. Compare the latest available moment and the time a restore takes with the data you can afford to lose and the downtime you can accept.