Learn Labs
Data Lifecycle

Backups

Backing up the object store, and using it as the backup target for the other modules

Object storage plays two roles in backups. It's the natural destination for everyone else's backups, and it holds data that needs a backup of its own. Replication and versioning are neither: both live inside one cluster, under one set of admin credentials, in one building.

As a backup target

The app identity can write to the backups bucket and nothing else interesting. A Postgres backup, streamed straight from pg_dump into SeaweedFS and restored into a different, empty server:

aws_s3() { docker run --rm -i --network seaweedfs \
  -e AWS_ACCESS_KEY_ID=app -e AWS_SECRET_ACCESS_KEY=app12345 -e AWS_DEFAULT_REGION=us-east-1 \
  amazon/aws-cli:2.31.0 --endpoint-url http://filer:8333 "$@"; }

docker exec pg-src psql -U postgres -tAc "select count(*), sum(total) from orders"
100000|7500075000.0

docker exec pg-src pg_dump -U postgres -Fc postgres | aws_s3 s3 cp - s3://backups/postgres/postgres-2026-10-12.dump
aws_s3 s3 ls s3://backups/postgres/
2026-10-12 15:35:21     497226 postgres-2026-10-12.dump

aws_s3 s3 cp s3://backups/postgres/postgres-2026-10-12.dump - | docker exec -i pg-dst pg_restore -U postgres -d postgres
docker exec pg-dst psql -U postgres -tAc "select count(*), sum(total) from orders"
100000|7500075000.0

s3 cp - reads from standard input and switches to multipart upload on its own, so the dump never touches local disk. The same endpoint works for the other modules:

Postgres, continuous: WAL-G or pgBackRest with repo1-type=s3, repo1-s3-endpoint=...ClickHouse: BACKUP DATABASE shop TO S3('http://filer:8333/backups/clickhouse/2026-10-12', 'app', 'app12345')Redis: upload dump.rdb after BGSAVE, or the AOF directoryPrometheus: Thanos or Mimir keep long-term blocks in a bucketKubernetes: Velero backs up cluster objects and volumes to S3

Backing up the object store

weed filer.backupcontinuously copy every file to another place:S3, GCS, Azure, B2, a local dir (replication.toml)weed filer.synccontinuously replicate to a second SeaweedFS clusterweed filer.meta.backupcontinuously copy filer metadata to another storeweed backupincremental copy of one volume to a local folder
  • Off-site copy of the data: filer.backup to a cloud bucket or filer.sync to a second cluster in another location. Both are continuous and resumable, following the filer's change log.
  • Metadata: if the filer store is embedded LevelDB, back it up with filer.meta.backup. If it's Postgres, it's covered by your Postgres backups, which must not be stored only in this same cluster.
  • Configuration: s3.json, filer.toml, security.toml, compose files. In git.

3-2-1

Three copies, on two kinds of storage, one off-site. For this lab's data: the cluster's two replicas count as one copy (one cluster, one admin), the off-site bucket is the second, and an occasional cold export (disks, tape, a different provider) the third.

Lab

  1. Run the Postgres backup and restore above, then make it a script that exits non-zero if the counts differ.
  2. Configure weed filer.backup to copy /buckets/app-data to a local directory in a new container, upload a file, and find it there.
  3. Delete an object and check what the backup copy did.

On this page