Operations

Operations #

Backup, restore, upgrade and recovery for a single node or a Raft cluster. The unit of everything is the node directory: <data-dir>/IceFireDB/<node-id>/.

What is on disk #

PathContentsBacked up by
main.db/The ledis store in the selected driver’s formatCopying the directory
store/Raft log + stable store (leveldb or bolt)Copying the directory
snapshots/<id>/state.binRaft state-machine snapshot: gzip header (start/ts/seed) + sds key/value streamRAFT SNAPSHOT, or copying the directory

state.bin is backend-agnostic: writeSnapshot walks the driver’s snapshot and writes key, value pairs into a gzip stream. That is why a snapshot taken on a badger node restores into a goleveldb node, while the main.db/ directory itself never does. Treat the file as opaque: copy it whole (or in RAFT SNAPSHOT READ windows) and hand it back with --restore — do not unzip or edit it.

Backup #

Option A — snapshot the state machine (recommended, portable)

redis-cli -p 11001 RAFT SNAPSHOT NOW            # returns the new snapshot id
redis-cli -p 11001 RAFT SNAPSHOT LIST           # ids and sizes
redis-cli -p 11001 RAFT SNAPSHOT FILE <id>      # absolute path on the server
# copy that file off the host:
scp db1:/var/lib/icefiredb/IceFireDB/1/snapshots/<id>/state.bin ./backup-$(date +%F).sds

For large or bandwidth-limited snapshots, read it in windows instead of copying the file:

redis-cli -p 11001 --raw RAFT SNAPSHOT READ <id> RANGE 0 1048576 > part-000
redis-cli -p 11001 --raw RAFT SNAPSHOT READ <id> RANGE 1048576 1048576 > part-001

Option B — copy a node directory (fastest for a full cluster)

Stop writes, or pick a follower and let it settle, then copy the whole <data-dir>/IceFireDB/<node-id>/ tree. Copying a leader under write load gives you a directory that is internally consistent as of some recent log index, but “some index” is not a point you control — for a backup you can reason about, use Option A or quiesce the node.

Restore #

--restore bootstraps a brand-new single-node cluster from a snapshot file:

mkdir -p /var/lib/icefiredb-restore
./bin/IceFireDB -n 1 -a 127.0.0.1:11001 -d /var/lib/icefiredb-restore \
  --restore ./backup-2026-11-08.sds

Rules, all enforced by the Raft layer:

  • --restore is ignored if <data-dir>/IceFireDB/<node-id>/ already exists. Use a fresh directory.
  • It cannot be combined with -j; the restored node is the new cluster of one.
  • Every other node must be wiped and re-joined with -j <restored-node-addr> — their logs refer to a cluster history that no longer exists.
  • Restore batches writes 1000 pairs at a time, so memory stays bounded and a large snapshot does not need to fit in RAM.

Rolling upgrade #

One node at a time, followers first, leader last:

  1. Check health — CLUSTER INFO reports cluster_state:ok, RAFT SERVER LIST lists every member, /readyz is 200 on all nodes.
  2. Upgrade a follower. Stop it, replace the binary, start it with the same -n, -a and -d. It rejoins from persisted Raft state and catches up from the log or a snapshot.
  3. Wait for /readyz to return 200 and for its RAFT INFO index to catch up before touching the next node.
  4. Upgrade the leader last. Stop it; a follower is elected; start the upgraded binary; it rejoins as a follower.

Never take down a majority at once: without quorum, writes fail with -CLUSTERDOWN until a leader can be elected again.

Compatibility rules for an existing data directory:

DoDon’t
Keep -n, -a and -d stableChange the node ID or move the directory to another node
Keep --auth/ICEFIREDB_AUTH identical on every nodeRotate the token node-by-node
Keep --storage-backend as it wasSwitch backend on an existing main.db
Keep --raft-backend as it wasSwitch Raft log format under an existing store/

Disaster recovery #

Lost one node — give it a fresh directory (or wipe the old one), then join it:

rm -rf /var/lib/icefiredb/IceFireDB/3
./bin/IceFireDB -n 3 -a 10.0.0.13:11001 --advertise 10.0.0.13:11001 -d /var/lib/icefiredb -j 10.0.0.11:11001

If the old membership entry is still present and the node cannot rejoin, remove it first from a healthy member: RAFT SERVER REMOVE 3, then start the node with -j.

Lost quorum — writes are down but the data still exists on the surviving nodes. Restore the newest snapshot into a fresh single-node cluster (--restore, above), then re-add the other nodes with RAFT SERVER ADD or -j. Data written after that snapshot is lost; this is the only recovery that does not need a majority.

Corrupt storage — main.db/ can be repaired per driver (e.g. GoLevelDB/Badger recovery tools), but the supported path is: remove the node, restore from the latest snapshot, rejoin.

Routine checks #

# is the process serving?
curl -fsS http://127.0.0.1:11002/healthz
curl -fsS http://127.0.0.1:11002/readyz

# is the cluster healthy?
redis-cli -p 11001 CLUSTER INFO
redis-cli -p 11001 RAFT SERVER LIST

# is it roughly in sync? (compare a sample on two nodes)
redis-cli -p 11001 --scan --pattern 'sample:*' | head -50 | xargs -n1 redis-cli -p 11001 GET

Capacity notes #

  • Every node stores the full dataset; there is no sharding. Disk sizing is per node, not per cluster.
  • --nosync trades durability for write throughput; never use it on a node you intend to restore from after a power loss.
  • badger opens with 1 GB memtable and 1 GB block cache defaults; budget them.
  • Raft snapshots accumulate under snapshots/; the Raft layer prunes old ones, but on a node that is never snapshotted the log grows until the next snapshot — plan for that disk usage.