Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Backup and restore

Back up and restore an AngaraBase instance — from a cold (offline) backup to an online FULL + LOG chain with point-in-time recovery (PITR).

Requires an initialized instance and the angara-cli binary. For online backups, a running server with WAL ([transaction_log] backend = file_bin, not noop).

Which method to use

ScenarioMethod
Move an instance to another host, downtime allowedHost migration — file copy, no backup
Basic offline snapshot in one filephase 1a: backup full*.angarabk
Online backup without stopping + PITR to any LSNphase 1b: full-online + log + restore-chain
Back up from a central node without SSH to the DBany of the above — via the Admin API (--addr)

For new deployments, default to phase 1b (online + PITR). Use phase 1a when a simple offline snapshot is enough. The legacy shell wrappers are kept for compatibility.

The config flag for angara-cli is --config / -c (the server uses --config-path); for remote execution via the Admin API, pass --addr <host:port> instead of --config.

Cold / offline backup

The original supported method. The server must be stopped (or will be stopped by the runner).

  1. Copy storage.data_directory and storage.transaction_log_directory.
  2. After restore, run the txlog-level oracle.
  3. The source must be a correctly initialized data directory.

Pinned commands (legacy shell)

Backup:

tools/backup_restore/run.sh backup \
 --data-dir /var/lib/angarabase/data \
 --txlog-dir /var/lib/angarabase/transaction_log \
 --out /tmp/angarabase-backup.tar.gz \
 --root artifacts/backup_restore/backup

Restore:

tools/backup_restore/run.sh restore \
 --archive /tmp/angarabase-backup.tar.gz \
 --dest /tmp/angarabase-restore \
 --force \
 --root artifacts/backup_restore/restore

Oracle (post-restore verification):

tools/backup_restore/oracle.sh --root artifacts/backup_restore_oracle/run_1

Remote Admin Backup Flow (Online Backup via Admin API)

AngaraBase supports triggering backups remotely via the Admin TCP endpoint. This is the recommended approach for production deployments, as it does not require direct file system access to the database node.

Requirements

  • angarabase-server must be running with the Admin API enabled ([ops] admin_addr in angarabase.conf or the ANGARABASE_ADMIN_ADDR environment variable; if no address is set, the admin listener does not start).
  • angara-cli is run with --addr <host:port> instead of --config.
  • Network access to the Admin API port is required (default: 9899).

How it works

When using --addr, angara-cli connects to the running server’s Admin API and issues a RUN backup_full command. The server coordinates the backup process internally (Fuzzy Copy, WAL Inclusion) and streams the resulting .angarabk file back to the client over the network.

This allows operators to take backups from a central management node without SSH access to the database servers.

Storage layout note

User tables use the page-based .adb path. Legacy heap_store/*.bin is migrated to .adb on first access.

For backup/restore and triage:

  • Both files per database are critical: <db>.adb and <db>.atl.
  • heap_store/ is not the source of truth after migration.
  • Upgrading old instances may take time proportional to heap_store volume.
  • If the backup was taken with TDE enabled (ANGARABASE_TDE_ENABLE=1), restore requires the same valid key material; without it, startup after restore is fail-closed.

Backup/Restore v2 — phase 1a: one-file backupset

Minimal offline pipeline producing a single *.angarabk file (manifest-first format).

Capabilities

CommandPurpose
backup fullOffline FULL backup to a single file.
backup inspectRead manifest only (no payload scan).
backup verifyStruct/hash integrity check (binary answer).
backup restoreLocal restore + txlog-level oracle (best-effort).

Pinned commands (phase 1a)

# FULL (offline/local baseline)
angara-cli backup full \
 --config /path/to/angarabase.conf \
 --out /tmp/full_0001.angarabk \
 --db-id base

# FULL (remote execution via Admin API)
angara-cli backup full \
 --addr 127.0.0.1:9899 \
 --out /tmp/full_0001.angarabk \
 --db-id base

# INSPECT (manifest-only)
angara-cli backup inspect --file /tmp/full_0001.angarabk

# VERIFY v0 (struct/hash)
angara-cli backup verify --file /tmp/full_0001.angarabk --json

# RESTORE (local) into a new directory
angara-cli backup restore \
 --config /path/to/angarabase.conf \
 --file /tmp/full_0001.angarabk \
 --target-dir /tmp/restore_0001 \
 --overwrite

Evidence pack (N=3)

tools/backup_restore/evidence_v2_phase1a.sh --runs 3

Inspect vs verify

  • backup inspect: manifest-only, no payload scan.
  • backup verify: struct/hash integrity; proves backupset consistency, not SQL-level correctness.

Backup/Restore v2 — phase 1b: online FULL + LOG chain + PITR

Online pipeline with point-in-time recovery support.

Capabilities

CommandPurpose
backup full-onlineOnline FULL boundary (best-effort, with backup fence).
backup logWAL chunk by LSN range (strictly contiguous chain).
backup chain-validateBinary validation of the full chain.
backup restore-chainPITR restore to target_lsn + oracle.

Pinned commands (phase 1b)

# ONLINE FULL (best-effort, with backup fence)
# Local execution:
angara-cli backup full-online \
 --config /path/to/angarabase.conf \
 --out /tmp/full_online_0001.angarabk \
 --db-id base

# Remote execution (via Admin API):
angara-cli backup full-online \
 --addr 127.0.0.1:9899 \
 --out /tmp/full_online_0001.angarabk \
 --db-id base

# LOG chunk (LSN boundaries must be contiguous with FULL/prev LOG)
angara-cli backup log \
 --config /path/to/angarabase.conf \
 --out /tmp/log_0001.angarabk \
 --start-lsn <u64> --end-lsn <u64> \
 --db-id base

# Validate chain contiguity
angara-cli backup chain-validate \
 --chain /tmp/full_online_0001.angarabk,/tmp/log_0001.angarabk \
 --json

# PITR restore to target_lsn
angara-cli backup restore-chain \
 --config /path/to/angarabase.conf \
 --target-dir /tmp/restore_chain_0001 \
 --target-lsn <u64> \
 --chain /tmp/full_online_0001.angarabk,/tmp/log_0001.angarabk \
 --overwrite

Evidence pack (N=3)

tools/backup_restore/evidence_v2_phase1b.sh --runs 3

Expected result

After a successful restore the server should start cleanly and previously committed data should be present:

SELECT * FROM sys.health;
SELECT * FROM sys.identity;

For PITR restores, data reflects the state at target_lsn.

Troubleshooting

SymptomAction
Restore fails with TDE errorEnsure the same ANGARABASE_TDE_MASTER_KEY_HEX is set. See Configuration — TDE knobs.
Chain validation failsLSN boundaries between FULL and LOG chunks must be contiguous. Re-take the LOG chunk from the correct start LSN.
Oracle reports mismatchThe txlog replay-pages oracle is best-effort. Collect artifacts and file a report via Support.
heap_store migration slow after restoreExpected for legacy-format backups. Migration is proportional to heap_store size.

For unresolved issues see Known issues and Support.

Host migration (without dump/restore)

An alternative to backup/restore for moving AngaraBase to another host is direct data-file copying using the Instance Lease system.

When applicable

  • Single-node deployment — one AngaraBase instance
  • Shared storage — NFS, SAN, or manual file copy
  • Same version — the same AngaraBase version on source and target
  • Maintenance window — the instance can be stopped during copying

Step-by-step instructions

  1. Stop the source instance:
# Graceful shutdown to release the lease
kill -TERM <angarabase-pid>

# Wait for completion
ps aux | grep angarabase-server
  1. Verify lease release (optional):
-- On another instance or via backup connection
SELECT lease_holder_id FROM sys.identity;
  1. Copy data files:
# Copy data directory
rsync -av /source/data/ /target/data/

# Copy transaction log directory
rsync -av /source/txlog/ /target/txlog/

# Verify integrity
find /target/data -name "*.adb" -exec ls -la {} \;
  1. Start on the target host:
# Update configuration if needed
vim /target/angarabase.conf

# Start AngaraBase
angarabase-server --config-path /target/angarabase.conf
  1. Verify migration:
-- Check lease holder
SELECT lease_holder_hostname, recovery_mode FROM sys.identity;

-- Verify data integrity
SELECT COUNT(*) FROM your_tables;

-- Check system state
SELECT * FROM sys.health;

What to check after startup

  • lease_holder_hostname changed to the new host
  • recovery_mode shows the recovery type
  • All tables are accessible and contain the expected data
  • No errors in server logs
  • Client connections work correctly

Limitations

  • Downtime required — requires stopping the service during copying
  • File consistency — files must be copied atomically
  • Version compatibility — AngaraBase versions must match
  • Configuration — paths in the configuration may need updates

Comparison with backup/restore

AspectHost migrationBackup/restore
DowntimeFile copy timeBackup + restore time
Disk space1x (target only)2x (backup + target)
NetworkDirect copyThrough backup storage
ComplexityLowMedium
Point-in-timeCurrent state onlyAny LSN

See also

Detailed host migration instructions: Crash Recovery — Host Migration

See also