Skip to content

Backup and restore

Roxa's state (in the compose production stack) has two parts, and they must be backed up consistently (from the same point in time):

WhatWhereContents
Segmentsthe MinIO bucket roxathe data itself (messages)
Metadatathe docker volume roxa-datatopic configs, the segment index, committed offsets

Backup

bash
# metadata (the volume):
docker run --rm -v roxa_roxa-data:/data -v "$PWD:/backup" alpine \
  tar czf /backup/roxa-meta-$(date +%F).tgz -C /data .

# segments: mirror the MinIO bucket to external S3/disk:
docker compose exec minio mc mirror local/roxa /path/to/backup
# or mc mirror to an external alias (another S3)

Restore

The reverse operation — before starting the broker:

  1. Unpack the metadata archive back into the roxa-data volume.
  2. mc mirror the bucket from the backup back into MinIO.
  3. docker compose up -d.

External S3 instead of MinIO

If storage is an external S3 service with its own replication/versioning — segment backup is covered by its facilities, and only the metadata volume remains.