Architecture
Masters, volume servers, the filer, and the S3 gateway, and what each one knows
SeaweedFS splits the job of storing a file into three pieces of knowledge, held by three kinds of server. Knowing which server knows what is the key to every failure scenario later in this module.
Masters: where volumes live
Volume servers store data in volumes: large files (30 GB by default, 256 MB in this lab) each holding many objects. A master knows which volume servers hold each volume, how full each is, and which are writable. It does not know any file names, and file bytes never pass through it.
- Volume servers send heartbeats to the leader with their volumes and free space.
- Clients ask the leader to assign a new file id (which picks a writable volume) and to look up a volume's locations.
- The masters form a Raft group; only the leader answers assign requests. With 3 masters, one can fail.
curl -s localhost:9333/cluster/status
{"IsLeader":true,"Leader":"master-1:9333.19333","Peers":["master-3:9333.19333","master-2:9333.19333"],"MaxVolumeId":50}Volume servers: the bytes
A volume server stores volumes as .dat files (the data, appended to) and
.idx files (needle key → offset and size), and keeps the index in memory.
Reading an object is one memory lookup and one disk read. This is why
SeaweedFS is fast for billions of small files, where file systems and some
object stores struggle with metadata.
Volume servers also do replication: a write to a volume goes to the server the client chose, which forwards it to the volume's other replicas before acknowledging.
The filer: names
Volumes and file ids are enough for an application that stores the ids
itself (like Facebook's photo store). Most applications want names.
The filer maps paths (/buckets/app-data/invoices/2026/10/inv-1.json)
to lists of chunks, each a file id on some volume, plus size, MIME type,
timestamps and metadata. It stores this in a pluggable metadata store:
embedded LevelDB here; Postgres, MySQL, Redis, Cassandra, etcd and others in
larger deployments.
The S3 gateway
The S3 gateway translates the S3 API into filer operations. A bucket is a
directory under /buckets; a key is a path inside it. It runs inside the
filer process here (filer -s3); in larger setups it runs as its own
service, several copies behind a load balancer.
A write, end to end
- The gateway asks the master leader for a file id with the bucket's replication setting.
- It uploads the bytes to the volume server named in the reply, which replicates to the other copy (on another rack) before answering.
- The filer records the name → chunk mapping.
- The client gets
200 OK.
A read is the reverse: filer lookup (name → file ids), master lookup (volume → servers, cached), then a GET from any replica.
Because the filer caches volume locations, reads of existing objects kept working in this lab even with two of the three masters stopped and no leader at all. New writes failed, since nothing could assign a file id. Each component's failure takes out a different set of operations. The Failure Scenarios lesson measures all of them.
Collections
A collection is a group of volumes. The S3 gateway puts each bucket in its own collection, so a bucket's objects never share a volume with another bucket's. That makes deleting a bucket cheap (drop its volumes) and lets replication and TTL be set per bucket.
Lab
- In the master UI (http://localhost:9333), find which servers hold the
volumes of the
backupscollection. - In the filer UI (http://localhost:8888), open
/buckets/backups/db/. - Stop the filer. What happens to S3 requests? To the master UI?