Перейти к содержимому

Backup and restore

Это содержимое пока не доступно на вашем языке.

Versioned local archive backups include a manifest, SHA-256 checksums, and offline restore.

While the server is running:

Terminal window
./bin/chronacta backup create -archive ./backups/node-$(date +%Y%m%d-%H%M%S).tar.gz

The server seals the active segment, syncs WAL/segments, and writes a .tar.gz archive containing:

  • manifest.json
  • sealed segments/*.log and segments/*.index
  • non-empty wal/*.log
  • schemas/schemas.json when present
  • subscriptions/subscriptions.json when present
  • projections/<name>/... definition and state files when present

Use -dry-run to validate the snapshot plan without writing the archive.

Terminal window
./bin/chronacta backup inspect -archive ./backups/node.tar.gz

Stop the server. Restore only into an empty target directory:

Terminal window
./bin/chronacta-admin restore \
--archive ./backups/node.tar.gz \
--target ./restored-data \
--confirm

Restore validates manifest checksums, extracts into a staging directory, runs read-only verification, then publishes the target atomically. Use --dry-run to validate without writing files.

Offline restore already runs storage verification before publishing the target. To re-check through the live API, start a server on the restored directory:

Terminal window
CHRONACTA_DATA_DIR=./restored-data ./bin/chronacta-server
./bin/chronacta verify
./bin/chronacta stream-info -stream <stream-id>

Compare stream contents with the source node if needed.

Configure the server with S3 settings (see cloud backup architecture):

Terminal window
export CHRONACTA_BACKUP_S3_BUCKET=my-dr-bucket
export CHRONACTA_BACKUP_S3_PREFIX=chronacta/prod
export CHRONACTA_BACKUP_S3_REGION=eu-central-1

Create a local backup, then upload:

Terminal window
./bin/chronacta backup create -archive ./backups/node-$(date +%Y%m%d-%H%M%S).tar.gz
./bin/chronacta backup upload -archive ./backups/node-20260101-120000.tar.gz
./bin/chronacta backup list-remote

Use -dry-run on upload to validate the archive without transferring bytes. For MinIO or other S3-compatible stores, set CHRONACTA_BACKUP_S3_ENDPOINT.

Disaster recovery from cloud: download the object locally, then run offline restore as above.

  1. Backup from leader — chronacta backup create on the current write leader (only leader accepts destructive admin ops in cluster mode).
  2. Simulate leader loss — stop leader process; confirm majority elects new leader (cluster status).
  3. Restore drill (staging) — restore backup into a fresh directory on a follower or staging host:
Terminal window
./bin/chronacta-admin restore --archive ./backups/leader.tar.gz --target ./drill-data --confirm
./bin/chronacta verify-db -data-dir ./drill-data
  1. RPO check — compare manifest.json high_water_global_position with last acknowledged client write.
  2. RTO check — time from leader stop to successful append on new leader (target < 30s lab default).

Do not point production followers at restored data without following membership change procedures in HA rolling upgrade.