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.0s3 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:
A backup isn't a backup until it's been restored. The run above
restores into a separate server and compares a count and a sum. Automate
exactly that on a schedule, and alert when the newest object under
backups/postgres/ is older than a day.
Backing up the object store
- Off-site copy of the data:
filer.backupto a cloud bucket orfiler.syncto 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.
A continuous sync is a mirror, and mirrors copy mistakes. When a script
deletes a prefix, filer.sync deletes it on the other side too, within
seconds. The off-site copy needs its own versioning (or object lock)
and credentials the primary cluster doesn't have, so neither a mistake
nor an attacker on the primary side can reach it.
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
- Run the Postgres backup and restore above, then make it a script that exits non-zero if the counts differ.
- Configure
weed filer.backupto copy/buckets/app-datato a local directory in a new container, upload a file, and find it there. - Delete an object and check what the backup copy did.