Operations · Engineering

A backup strategy that survives a restore drill

Online backups, instance-wide copies, sidecars, encryption keys, and the only test that matters: restoring on a clean host.

A backup is not a file that exists. It is a file that has been restored, verified, and queried on a machine that is not the original.

NonoDB’s backup command makes that test practical: it writes a compacted, consistent copy of one database and a manifest with a SHA-256. Restoring is a separate command.

What a backup contains

A per-database backup:

data.mdb consistent, compacted LMDB environment
manifest.json source, timestamp, size, SHA-256

An instance backup (backup-all) contains one directory per database plus an instance manifest.

The copy includes documents, secondary indexes, vector index entries, history, TTL metadata, collection profiles, and database slots. Text/fuzzy postings and vector ANN data live in derived sidecar files; native CLI and scheduled backups copy them by default.

It does not include:

  • lock.mdb (recreated);
  • auth.json (instance-wide, outside LMDB);
  • the audit log;
  • vault tenant keys.

That list matters. A restored database can still be inaccessible if you lost the auth registry or a vault key.

Online backup

Terminal window
TS=$(date -u +%Y%m%dT%H%M%SZ)
nonodb-cli --db app1 backup /var/lib/nonodb "/var/backups/nonodb/$TS/app1"

The command opens the database read-only and writes a compacted copy. It is safe while the daemon is running. The copied file is synced before the command exits, then the manifest is written.

For all databases:

Terminal window
nonodb-cli backup-all /var/lib/nonodb "/var/backups/nonodb/$TS"

backup-all copies databases sequentially. Each copy is internally consistent, but it is not an atomic snapshot across databases. If the application needs a cross-database recovery point, quiesce writes during the copy.

Sidecars

Search and vector sidecars are content-addressed and immutable. Copying them means a restore can use them directly instead of rebuilding large indexes.

Use --without-search-sidecars only when you accept that cost. The manifest covers data.mdb; sidecars are derived data and are not independently checksummed. A restore copies sidecars when present and replaces any existing sidecar tree.

Verify before storing

Terminal window
nonodb-cli inspect BACKUP
nonodb-cli verify-backup BACKUP
nonodb-cli --db app1 verify /var/lib/nonodb

inspect and verify-backup check the backup. verify deep-checks the live database directory. None of them replaces a restore test.

Restore

Stop the daemon:

Terminal window
systemctl stop nonodb
nonodb-cli --db app1 restore BACKUP /var/lib/nonodb --force --verify
systemctl start nonodb

restore removes lock.mdb and replaces the database. --verify checks the restored database, not just the source.

For a non-default path, restore into a new root first, verify, then move it into place during a maintenance window. Restore-in-place is available online through the API and GUI, but it is not the default and has boundaries; read the guide before using it on a primary.

The restore drill

A useful drill is boring and repeatable:

  1. Take a backup from the running system.
  2. Copy it to a clean host or directory.
  3. Restore with --verify.
  4. Start a daemon on a different socket and port.
  5. Run counts, indexed reads, a search query, and a vector query.
  6. Restore the auth registry and a vault key if those are in scope.
  7. Compare a sample of documents and index definitions.
  8. Record the time and the commands.

If step 4 fails because of a missing sidecar, a wrong path, or a missing key, the backup was not ready.

Encryption and keys

Native age backups need the identity file to restore. Keep it out of the backup destination and out of the database volume. A lost identity makes the backup unrecoverable.

Restic needs its repository password. Vault collections need the tenant key. Volume encryption needs the volume key. These are separate scopes; do not store all of them on the same disk.

Test key recovery during the drill, not after an incident.

Retention and off-host copies

  • Keep more than one backup generation.
  • Keep at least one copy off the host.
  • Use object storage or a separate failure domain.
  • Monitor job success and backup age.
  • Prune old copies only after a newer restore has been tested.
  • Keep the retention period aligned with the recovery window.

A local backup on the same disk protects against a bad write, not against losing the disk.

What backups do not solve

  • They are not replication. A replica keeps you available; a backup keeps history.
  • They do not capture writes after the copy.
  • They do not protect an unencrypted backup in object storage.
  • They do not include auth, audit, or vault keys.
  • They do not replace PITR for a precise timestamp.

The backup guide has the full command reference, Docker paths, S3/R2 examples, restic, and restore scenarios.

All engineering notes →Read the docs