Back up and restore metadata

Back up and restore metadata

Copy the metadata store to a bucket on a schedule, and bring it back as of a past time.

Records live in object storage, and the metadata store records where each one is: streams, their positions, buckets, queues. Without the metadata, the records in the bucket cannot be found. A backup copies every metadata shard to a bucket on a schedule. A restore brings the metadata back as of a time you choose, under a new name, and the nodes then switch to it.

Backups need the metadata store to run on its own machines (an external oxia), built from the oxia that Nova ships. The metadata store inside novad takes no backup policy.

What protects your metadata

Metadata storeBackupsWhat protects it
Inside novad, one nodeNoneNothing: a lost disk loses the metadata
Inside novad, a clusterNoneThree copies of every shard, on three nodes
External oxiaA policy in oxia's cluster configurationThree copies, plus backups in a bucket
External oxia on Kubernetesspec.metadataStore.oxia.backupThree copies, plus backups in a bucket

To add backups to a cluster that keeps its metadata inside novad, first move the metadata store to its own machines; see Metadata store.

How backups work

Each shard is backed up by the data server that holds it, once per interval (1 hour by default), and each backup is kept for the retention (7 days by default). Backups are incremental: a file an earlier backup already uploaded is shared, so a shard that did not change uploads nothing. A data server runs at most 2 backup jobs at once, and the coordinator checks every 30 seconds which shards are due.

The policy covers the streams, queues, registry and dispatch keyspaces. The sessions keyspace holds leases and node liveness, which describe processes that are running now, so it is left out: a restore creates it empty.

Nothing else may delete under the destination

Backups share files. A lifecycle rule that expires objects under the destination corrupts every newer backup that still uses them. The only safe rule aborts incomplete multipart uploads. Give the bucket to the backups alone.

Turn backups on

On machines or Docker

Add a backup block to oxia's cluster configuration, and mark the sessions keyspace backup: false. The data servers upload, so they need credentials for the destination, from AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY or another source the AWS SDK reads. The coordinator needs none.

cluster.yaml, the parts that turn backups on
namespaces:
  - name: nova-sessions
    # … the keyspace's other fields, as before
    backup: false

backup:
  enabled: true
  destination: s3://nova-metadata-backups/metadata?region=us-east-1&endpoint=http://rustfs:9000&path-style=true
  interval: 1h
  retention: 7d

The destination is s3://<bucket>/<prefix>?region=<region>. Add endpoint=<url>&path-style=true for an S3-compatible store such as RustFS, as here. The rest of the file is the one in Metadata store.

On Kubernetes

The policy is part of the Constellation. The controller writes it into oxia's configuration and runs the oxia servers under the ServiceAccount you name, so give that account write access to the destination (on EKS, an IRSA role). The controller's default oxia image is the upstream release oxia/oxia:0.17.1, so set metadataStore.oxia.image to an image built from the oxia that Nova ships.

Hourly backups kept for a week
spec:
  metadataStore:
    oxia:
      backup:
        destination: s3://nova-metadata-backups/metadata?region=eu-west-1
        interval: 1h
        retention: 168h
        serviceAccountName: oxia
destinationRequired
s3://<bucket>/<prefix>?region=<region>, the bucket and prefix the backups go to
intervalDefault1h
The target age of a shard's newest backup, as a Go duration (30m, 1h; no day unit)
retentionDefault7 days
How far back a restore can go, as a Go duration (168h is a week); it must be longer than the interval
serviceAccountNameRequired
The account the oxia servers upload under
compression
Retired and ignored; a spec that still sets it applies

The controller refuses a policy with no destination or account, a retention not longer than the interval, or a constellation whose metadata store is inside novad. With observability.rules on, it also adds two alerts that fire when a shard's backup is too old or a backup request fails; see Alerts.

In the Pulumi reference deployment, oxiaBackups: true, with oxiaBackupInterval and oxiaBackupRetention, fills this block in, and oxiaSource builds the oxia image from a checkout. The stack also creates the backup bucket, nova-metadata-backups- followed by a random suffix, the oxia ServiceAccount and its IAM role.

Check the backups

Use the oxia command line of the oxia build Nova ships, against the coordinator's admin port, 6651. On Kubernetes, reach it with kubectl -n <namespace> port-forward svc/<constellation>-oxia-coordinator 6651:6651.

oxia admin backup list --admin-address oxia-coord:6651 --namespace nova-registry -o json
A one-shard keyspace with one backup
{
  "backups": [
    {
      "shard": 16,
      "backupId": "2026-11-22T18-41-41Z-bf2ff46fd51e6a7f",
      "time": "2026-11-22T18:41:41.661Z",
      "commitOffset": 4,
      "term": 1,
      "hashRangeMin": 0,
      "hashRangeMax": 4294967295,
      "sizeBytes": 5912,
      "sstCount": 2
    }
  ]
}

Before a risky change, make every shard's backup due now, so that the restore point is fresh. The command returns at once with the number of shards it made due, and the backups run in the background:

oxia admin backup --admin-address oxia-coord:6651
SHARDS
13

With 13 shards on one data server, the last of those backups finished about 5 minutes later. List the backups again before you rely on them.

Restore the metadata store

A restore never writes over the live keyspaces. It creates new ones, so you restore under a new prefix: the nodes name their keyspaces <prefix>-streams, <prefix>-queues and so on, through --oxia-namespace. The examples use nova, the prefix in Metadata store and the operator's default. Pick a time inside the retention window. The restored store holds what each shard's newest backup at that time held, and nothing written after it.

On machines or Docker

Restore each keyspace under the new prefix

The store as of 18:46 UTC, under the prefix nova2
for ns in nova-streams nova-queues nova-registry nova-dispatch; do
  oxia admin restore --admin-address oxia-coord:6651 \
    --namespace "$ns" --as-of 2026-11-22T18:46:00Z \
    --to-namespace "nova2-${ns#nova-}" -o json
done
The answer for the streams keyspace
{
  "namespace": "nova2-streams",
  "shards": [
    {
      "shard": 30,
      "hashRangeMin": 0,
      "hashRangeMax": 1073741823,
      "sourceShard": 0,
      "backupId": "2026-11-22T18-43-40Z-285a8f7e029680dd"
    },
    {
      "shard": 31,
      "hashRangeMin": 1073741824,
      "hashRangeMax": 2147483647,
      "sourceShard": 1,
      "backupId": "2026-11-22T18-45-43Z-e9ab5c770bfa985d"
    },
    {
      "shard": 32,
      "hashRangeMin": 2147483648,
      "hashRangeMax": 3221225471,
      "sourceShard": 2,
      "backupId": "2026-11-22T18-44-10Z-9b6529eb078c0c67"
    },
    {
      "shard": 33,
      "hashRangeMin": 3221225472,
      "hashRangeMax": 4294967295,
      "sourceShard": 3,
      "backupId": "2026-11-22T18-43-10Z-a028f8e29e176757"
    }
  ]
}

Each new shard downloads its backup and elects a leader in the background. The coordinator adds the new keyspaces to its cluster configuration file, nova2-registry with the natural key order of its source.

Create the sessions keyspace empty

oxia admin namespace create nova2-sessions --initial-shards 8 --replication-factor 1 \
  --notifications=false --admin-address oxia-coord:6651 -o json
{
  "name": "nova2-sessions",
  "initial_shard_count": 8,
  "replication_factor": 1,
  "notifications_enabled": false,
  "key_sorting": "hierarchical"
}

Use the replication factor of your other keyspaces; this test cluster had one data server. The new keyspace is backed up like the others, so mark it backup: false in the cluster configuration, as you did for nova-sessions.

Move every node to the new prefix

Stop every node first, then start each one with --oxia-namespace nova2 and its other flags unchanged. Never run nodes on the two prefixes at once: each prefix is a separate store, and a stream could get a leader in both.

The node's log on the restored store
[INFO] wal: ledger minted star=01a2048f-c461-77b7-88fe-703402c8a7ad epoch=2 class=standard layout=hashed priors_fenced=1
[INFO] novad: external oxia oxia=oxia-1:6648 oxia_registry=""

Read your data back

nova --addr novad-1:7780 read nova://demo/events --from 0
0	2026-11-22T18:41:13Z	hello
1	2026-11-22T18:41:13Z	world
2	2026-11-22T18:42:33Z	after the backup
3	2026-11-22T18:46:52Z	written after the backup

Record 3 was written after the restore point, so the restored metadata did not know it. The node still found it: on start, it recovered the ledger it had been writing, whose slots were still in the bucket. Do not count on that: it works only while those slots are still there.

Once the nodes run on the new prefix, delete the old keyspaces when you no longer need them, with oxia admin namespace delete <name>. Oxia expires backups only for the keyspaces in its configuration, so a deleted keyspace's backups stay in the bucket for good. Delete them yourself when you no longer need them: each keyspace's backups are in a folder of its own under the destination, such as metadata/nova-streams/.

On Kubernetes

Name the new prefix first, then restore under it. The controller rewrites oxia's configuration on every pass, and it keeps a restored keyspace there only while the Constellation names its prefix. A restore made first is lost at the next pass.

Name the new prefix

spec:
  metadataStore:
    oxia:
      namespacePrefix: nova2

The controller rolls nothing yet. It sets the condition NamespacePrefixHeld, with the reason NamespacesMissing and the keyspaces to restore, and records one Warning event. The nodes stay on the old prefix. The same hold catches a typo.

Restore the four keyspaces under it

Run the loop from the machines steps above through the port-forward, with --admin-address localhost:6651. While shards download, the hold reads NamespacesRestoring. The controller creates the empty sessions keyspace itself.

Let the controller roll the nodes

Once every shard of all five keyspaces has a leader, the hold lifts and the controller rolls the nodes onto nova2. If it cannot ask oxia, the hold reads NamespacesUnlisted and waits.

After the roll, the controller renders only the new keyspaces, so the coordinator deletes the old ones. Their backups stay in the bucket until you delete them, as on machines. A node still on the old prefix cannot drain once they are gone: delete its pod when the new nodes are ready, and the controller completes its departure.

A constellation whose oxia moved off its nodes keeps oxia's configuration under the coordinator's own provider, so the controller creates and deletes no keyspace there. The hold then names the sessions keyspace too: create it empty yourself, as on machines. After the roll, delete the old keyspaces yourself as well.

In the Pulumi reference deployment, step 1 is pulumi config set --path 'constellationValues.metadataStore.oxia.namespacePrefix' nova2 followed by pulumi up.

If it goes wrong

SymptomLikely causeWhat to do
no backup covers the range at that time: [0, 4294967295] as of …A shard had no backup yet at that time, for example while backups made due were still runningList the backups and pick a later time
NamespacePrefixHeld with NamespacesMissing staysA keyspace of the new prefix was not restored, or its name is wrongRestore the keyspace the condition names, or fix the prefix
NamespacePrefixHeld with NamespacesRestoring staysA restored shard has no leader yetWait; check the oxia servers' logs
The controller refuses the policyNo destination or account, a retention not longer than the interval, or metadata inside novadFix the field the error names

See also

On this page