Backups
Every piece of cluster state—users, projects, threads, machines, the workspace catalog, and stored secrets—lives in Postgres. Anastro backs up Postgres using WAL-G: continuous WAL archiving plus scheduled base backups encrypted on the node before upload. Workspace files already live in your workspaces store and aren’t duplicated here.
Enable backups
Section titled “Enable backups”Add [backup] to anastro.toml, pointing at a dedicated [storage.backups] bucket:
[backup]enabled = truestore = "backups"
[backup.policy]base_backup = "daily 03:15" # UTC, or "weekly sun 03:15"retain_full = 7 # number of full base backups to keeppitr_window = "7d" # must be <= filesystem.gc.delete_afterencryption_key = "secret:backup/encryption_key"
[backup.verify]enabled = trueschedule = "weekly sun 05:00" # UTCGenerate the 32-byte hex encryption key, unseal, test the bucket, apply, and take your first base backup:
openssl rand -hex 32 | anastroctl cluster bundle set backup/encryption_keyanastroctl cluster unsealanastroctl cluster storage test backupsanastroctl cluster applyanastroctl cluster backup nowbackup.* and storage.* apply live without restarts. Take an immediate base backup right after
enabling—point-in-time recovery only starts from the first base backup.
Clusters with backups disabled raise BackupsDisabled. On a single-node cluster, losing the disk
without backups means losing everything.
How backups run
Section titled “How backups run”- The Postgres primary archives WAL continuously and takes base backups on schedule; if Patroni fails over, the new primary takes over automatically.
- After each successful base backup, backups older than
retain_fullare pruned. - A node refuses to write base backups into a bucket that already belongs to a different database, protecting older cluster backups from accidental overwrite.
anastroctl cluster backup status # list base backups and primary WAL archiving statusanastroctl cluster backup now # trigger a base backup immediatelyAlerts: BaseBackupMissed (no backup yet, or overdue by an hour) and WalArchiveStalled (WAL
archiving failing for 5 minutes).
Automated verification
Section titled “Automated verification”When [backup.verify] enabled = true, a node (the first replica by name, or the primary on a
single-node cluster) periodically restores the latest base backup and WAL into a scratch Postgres
instance, runs amcheck on tables and indexes, checks that row counts match the live database
within 10% (or 100 rows), confirms the newest event is recent, and tears down the scratch instance.
Run a verification manually anytime:
anastroctl cluster backup verifyanastroctl cluster backup verify -n cp3Any failure raises BackupVerifyFailed until a subsequent verification succeeds.
Point-in-time restore
Section titled “Point-in-time restore”anastroctl cluster backup restore -n cp1 --target-time 2026-11-02T13:55:00Zanastroctl cluster backup restore -n cp1 # restore to the latest archived WALThis replaces the cluster’s database with the newest base backup prior to --target-time plus
WAL up to that moment. In HA clusters, other nodes pause while cp1 restores and then re-clone from
cp1. If the restore fails, every node rolls back to its previous database. Restoring opens a new
Postgres timeline so earlier and later restore points remain reachable, and targeting a time before
a Postgres major upgrade restores that older major version automatically.
Workspaces after a restore
Section titled “Workspaces after a restore”Rewinding Postgres does not delete objects uploaded to the workspaces store after --target-time.
After a restore, Anastro revokes active workspace leases so hosts re-acquire cleanly, pauses
garbage collection until a reindex scans objects uploaded after the target time, and marks newer
snapshots orphaned (kept and adoptable for orphan_retention):
anastroctl cluster fs statusanastroctl cluster fs reindex --since 2026-11-02T13:55:00ZDisaster recovery into a new cluster
Section titled “Disaster recovery into a new cluster”If you lose every node, install replacement nodes from the same config repo (with [backup] enabled = true) and restore during bootstrap:
anastroctl cluster bootstrap --restore-from backupsanastroctl cluster bootstrap --restore-from backups --target-time 2026-11-02T13:55:00Z -n cp2See Lose every node for the full runbook.