Logo
Logo

Backup and Restore

Consistent logical backups and restore into an empty store.

Backup

bash
curl localhost:8080/api/v2/admin/backup \
  -H "Authorization: Bearer $GENESISDB_AUTH_TOKEN" \
  -o genesisdb-backup.json

A backup is a consistent snapshot of events, reference data, system events and schemas. Without reference data or schemas it is a plain JSON array of events, otherwise the extended form:

json
{ "events": [], "refs": [], "system": [], "schemas": {} }

Backups are collected in memory and hold the writer lock: commits wait until the backup is complete, reads continue. Schedule backups in low-traffic windows, or take them from a filesystem snapshot of a stopped instance for large stores. If the connection breaks during the download, discard the file.

Restore

bash
curl localhost:8080/api/v2/admin/restore \
  -H "Authorization: Bearer $GENESISDB_AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  --data-binary @genesisdb-backup.json

Restore requires a completely empty store, otherwise it answers 409. Both backup forms are accepted, including backups written by GenesisDB 1.x. Event IDs and times are preserved, hash chains are recomputed, indexes are rebuilt. An interrupted restore leaves a maintenance marker, so a partially restored store is never served silently.

The VS Code extension restores a backup file with "Load file" as well.

Backup and restore need the administrator token. Restore takes the history as given: an administrator can create any history whose chain passes the audit, so keep backups and their checksums under separate control.

Practice

Test restoration regularly, protect backup confidentiality, and apply the same retention and erasure policies to backups as to the store.