Backup and restore
A tar of a running broker’s volume is not a backup of the cluster. Each broker’s copy is taken at a different moment, a shard’s leader may hold records a majority never acknowledged, and nothing ties the copies to the control plane’s metadata. A backup point is what ties them together: one committed offset per shard log, read from each shard’s leader after a single barrier instant. Copies of the leaders’ shard directories, taken while the brokers keep running, are cut back to the point on restore.
What a backup point guarantees
Section titled “What a backup point guarantees”- Nothing acknowledged before the barrier is missing. The barrier instant is recorded first, and every offset is read after it. A record acknowledged before the barrier is below the offset read for its shard.
- Nothing uncommitted is included. Each offset is the shard’s committed
offset on its leader: for a
Quorumstream or cache, the quorum mark (and never past what the leader itself has made durable); for everything else, what the leader has acknowledged, which underFELIX_DURABLE_FSYNC_MODE=on_commitstops at the last synced record. A Raft shard’s offset is one past the last record its leader acknowledged. That can be past its commit for a moment: aQuorumstream under a periodic fsync answers once a majority has written a record, and aLeaderstream answers on the leader’s lease. Such a record is in the point, since leaving it out would lose an acknowledged write. - Every shard is at its leader’s copy, at one generation. The assignments are read again after the offsets. If any leader or generation changed while offsets were being read, the whole collection starts over; after five tries the command fails rather than write a point from leaders that have since been replaced. A shard its leader cannot vouch for yet (just taken, lease lapsed) is asked about again a few times, and then the command fails naming it. A partial point is not a point.
“Acknowledged” means what the ack promised. A durable Leader publish is acknowledged
after the write unless the broker runs with FELIX_ACK_ON_COMMIT=0, so with
that set, a record acknowledged just before the barrier may not yet be in
any log. See
delivery semantics.
What it does not guarantee
Section titled “What it does not guarantee”- The point is not one instant across shards. Offsets are read one leader at a time, after the barrier, with no write pause. Every shard is at a committed prefix and nothing acknowledged before the barrier is missing, but a record written during the collection can be in the point on one shard and not on another. Felix orders nothing across shards, so no Felix guarantee is broken, but a client that published to shard B after an acknowledgement from shard A during that window can see B’s record without A’s after a restore. The window is one HTTP request per broker; keep placement quiet while taking a point and it stays short.
- A
Leadershard is cut at what its leader had. ALeaderstream’s committed offset is its leader’s acknowledged tail, which a failover could have lost; the point captures what the leader held, not what would have survived. - Caches, consumer groups and counters compact. Their logs are rewritten
into a fresh log appended at the tail. A copy taken after a compaction that
followed the point no longer holds the log as it stood at the point, and the
restore refuses it (
offset … is outside this log). Copy those directories first, right after taking the point; if a restore refuses one, take a new point and copy again. - Brokers with no cluster have no assignments, so there is nothing to take a point of. Stop a single broker and copy its data directory instead.
Taking a backup
Section titled “Taking a backup”-
Take the point. It needs
node.view:cluster:*, the permission that lists shard assignments.Terminal window export FELIX_CONTROLPLANE_URL=http://felix-controlplane:8443export FELIX_CONTROLPLANE_TOKEN=<a Felix token>felixctl backup-point nightly-2026-09-27backup point "nightly-2026-09-27" at 1790467200000 ms, metadata version 4182SHARD LEADER GENERATION RECORDS CURSORS DEAD_LETTERS COUNTERSt1/ns/orders/0 broker-1 7 918233 12 0 -t1/ns/orders/1 broker-2 5 901112 12 0 -t1/ns/prices/0 (cache) broker-0 3 44120 - - 310wrote nightly-2026-09-27.backup-point.jsonEach broker’s offsets come from
GET /backup/offsetson its metrics listener (see Broker API), athttp://<the host of its client address>:8080.--metrics-portchanges the port for every broker, and--broker broker-1=http://10.0.4.7:9090names one broker’s URL outright.--outnames the manifest file. -
Copy each leader’s shard directories while it runs. For every shard in the manifest, from the broker the manifest names as
leader, under that broker’sFELIX_DURABLE_STORAGE_DIR:Log Directory stream records <root>/<shard dir>cache records <root>/caches/<shard dir>consumer-group cursors <root>/groups/<shard dir>dead letters <root>/dead-letters/<shard dir>counters <root>/counters/<shard dir>The shard directory is named after the tenant, namespace, name and shard (
t1_ns_orders_0-<hash>; see the storage format). Within each directory copy the small files first (durable.mark,replica,epochs,producers), then the.logsegments oldest first, then the.indexfiles. That order keeps every file from claiming more than the segments copied after it hold. The copy may run past the point: records are never rewritten in place, so the bytes below the point are final, and whatever lands after them is cut on restore. A torn last record is repaired when the copy is opened. Copy the cache, group and counter directories first, for the compaction reason above. -
Store the manifest with the copies. A copy without its manifest cannot be cut back to a committed point.
-
Back up the control plane’s metadata from a state taken at or after the point, so every stream and assignment the point names exists in it. That is a storage-layer snapshot of the members’ volumes (see Metadata Raft and the Kubernetes Backups notes). The manifest’s
metadata_versionis the assignment change sequence the point was read against.
Restoring
Section titled “Restoring”On the default engine, stop the broker, put its copied shard directories under
FELIX_DURABLE_STORAGE_DIR, run felixctl data restore-point --point FILE --node <broker> on it, and start it. Each log is cut back to the point and the
directory gets a new storage id. A Raft cluster takes the steps under
Restoring a Raft cluster.
Restoring a Raft cluster
Section titled “Restoring a Raft cluster”A Raft shard has no leader to copy back into. The restore cuts the leader’s
copy at the point, wipes every other copy, and re-forms each group from the
cut copy, with felixctl raft reform and the point. Anything acknowledged
after the point is gone, and its offsets are not given out again (see the
offset gap above). Run these in order.
-
Stop every broker, and restore the control plane’s metadata from the backup taken at or after the point.
-
Put back only the leaders’ copies. On each broker, start from an empty
FELIX_DURABLE_STORAGE_DIR, and copy in the shard directories the manifest names that broker asleaderof, from the backup in step 2 of Taking a backup. A broker that led nothing in the point stays empty. These empty copies come back as learners of the re-formed group. A cache shard’s learner catches up from the leader’s snapshot and becomes a voter again. A stream shard’s learner cannot catch up yet, so a restored stream shard runs on its one cut copy until #3005 lands: it serves and takes writes, but with no second copy. -
Cut each leader’s copy to the point, on the broker that holds it, with the broker stopped.
--nodetakes the broker’s own id from the manifest.Terminal window felixctl data restore-point --point nightly-2026-09-27.backup-point.json --node broker-1The output looks like this (illustrative, not captured from a run; the numbers are made up):
new storage id 7d1c0e5a...t1/ns/orders/0 Stream (raft): -> 918233restored 1 logs to point "nightly-2026-09-27"; start this broker, ...The line marked
(raft)is a Raft copy cut at the point. The command refuses, and writes nothing to that copy, when the copy holds a snapshot, a purge or a floor at or past the point: a copy taken after the point moved on cannot be cut back. It also refuses when the record below the point was written in another term than the point records: the leader lost aLeaderwrite and a newer leader wrote over it before the copy. Take a new point and copy again. -
Start every broker. The Raft shards stay “not ready” and wait for a re-form; nothing is lost by waiting.
-
Plan the re-form from the point. This reads each broker and changes nothing.
Terminal window felixctl raft reform plan --restore-point nightly-2026-09-27.backup-point.jsonIllustrative output, not captured from a run:
plan 3f2a9c (all): done; 1 to re-form, 0 blocked, 0 left alonerestore from backup point nightly-2026-09-27: no offset below the point plus 1099511627776 is given outSHARD EPOCH STATE SOURCE VOTERS NOTEt1/ns/orders/0 0 reform broker-1 broker-1 MAY LOSE ACKNOWLEDGED RECORDS: ...1 of these could lose acknowledged records; applying them will need --accept-lossThe cut copy is the only voter: the wiped copies hold nothing the plan can vouch for, so they start as learners.
A shard is
blocked, with the reason, if the point does not name it, names another incarnation of it, or no restored copy ends at the point. Fix the cause (usually a missing or uncut leader copy) and plan again. The new epoch starts at 2^14 offsets per millisecond of the control plane’s clock at plan time, plus a gap (--offset-gap N, 2^40 by default). That keeps a later restore, from this backup or an older one, past every offset an earlier restore gave out, as long as a shard stays under 8 offsets per microsecond and restores are more than four times the control-plane clock skew apart. The point’s own time comes from the machine that took it and is only shown. A plan made before another plan that already restored the shard is refused asstale; use the plan that won, or plan again once the control plane’s clock is past its time. -
Apply it. The plan says it may lose records, because the wiped copies’ votes are unknown, and what it loses is what was acknowledged after the point. Name each shard to accept that.
Terminal window felixctl raft reform apply 3f2a9c --accept-loss t1/ns/orders/0felixctl raft reform apply 3f2a9c --accept-loss cache:t1/ns/sessions/0It prints each shard as
startedonce its group has formed. -
Verify.
Terminal window felixctl raft reform planEvery shard reads
left_alone: each has a leader again. Then read a shard back:Terminal window felixctl sub orders --shard 0 --from earliest --format offsets --count 5felixctl cache get sessions some-keyA stream returns the records the point held, and the first record published after the restore arrives at an offset at least the point plus the gap. A cache returns its restored values.
Rebuilding one broker’s copy
Section titled “Rebuilding one broker’s copy”This works today, as long as every shard the broker holds has other healthy copies.
- Stop the broker.
- Replace its whole data directory (
FELIX_DURABLE_STORAGE_DIR) with an empty one, or with a copy from a backup. If you put a copy back, delete<FELIX_DURABLE_STORAGE_DIR>/storage-idfirst, or runfelix-broker rotate-storage-id --dir /var/lib/felixwith the broker stopped, so the directory gets a new storage id. - Start the broker.
Each shard’s copy on that broker comes back with a new copy id. A member with a new id has never voted, so it joins its group as a learner and catches up from the leader, and the group’s membership change then removes the old member. See “Group and member identity” in per-shard Raft. This costs one full copy of each shard the broker holds.
It does not recover a shard that lost its majority, and it does not work if every copy of a shard is rebuilt this way: for that, restore from a backup point as described above.
What to keep
Section titled “What to keep”Keep taking backup points and copying the leaders’ shard directories as
described above, and keep the metadata backups. felixctl backup-point and the
live copies change nothing on the cluster, and the Raft restore above is the
way back from them.
See also
Section titled “See also”- Durable storage
for why a live copy is safe to take and what
restore_todoes to a log. - Moving shards by hand for
felixctl placement pause, which keeps placement quiet while a point is taken.
