Failure Scenarios
How a SeaweedFS cluster breaks, measured in this lab
Each component holds a different piece of knowledge, so each failure breaks a different set of operations. Every row below was produced on this module's cluster.
One volume server down
docker stop volume-2
durability.py check -> listed 200: 200 intact, 0 corrupt, 0 unreadable
new 50 KB write during the outage: acceptedFully available, as replication 010 promises. Its volumes are
under-replicated: SeaweedFSVolumeServerDown fires after 1 minute and
SeaweedFSUnderReplicated about 10 to 15 minutes later. Decide:
bring it back, or run volume.fix.replication -apply, which needs free
slots elsewhere. In this lab it couldn't place 4 of the volumes.
Two volume servers down
docker stop volume-2 volume-3
durability.py check -> listed 200: 162 intact, 0 corrupt, 38 unreadable (76.6s)
new 50 KB write during the outage: InternalErrorObjects whose volume had both copies on the stopped pair are unreadable, and slowly: each GET waits through timeouts and retries. New writes failed. Nothing was corrupted, and everything came back when the servers did.
Master leader down
docker stop master-3 # the leader
# master-1 elected after 13 s
S3 write with master-3 down: okRaft elects a new leader within seconds. Volume servers and the filer reconnect to it. In this run S3 writes continued; writes that need a new file id during the election window can fail and should be retried.
Two of three masters down
docker stop master-2 master-3
t=0..30s {"IsLeader":true,"Leader":"master-1:9333.19333", ...}
t=45s {"Peers":[...], ...} # no leader: master-1 stepped down
GET existing: b'x'
PUT: ClientError InternalError
master-1 log: raft.Server: Not current leaderFor 30 to 45 seconds, master-1 kept acting as leader without a majority;
then it stepped down. After that there's no leader and no file ids,
so every write fails. Reads keep working, because the filer has cached
where each volume lives. SeaweedFSNoMasterLeader fires after 2 minutes.
This is Raft doing its job. A leader that can't reach a majority must stop, or the two sides of a network partition could each assign the same file ids. Losing the majority costs availability (writes), never correctness. Run masters on 3 (or 5) separate machines, so this takes two simultaneous failures.
Filer down
docker stop filer
GET: EndpointConnectionError Could not connect to the endpoint URL: "http://filer:8333/app-data/report.txt"
master UI 200The S3 gateway runs inside the filer here, so S3 is completely down, and nothing else is wrong: the masters and volumes are healthy and every byte is intact. In production, run several filers (with a shared store such as Postgres) and S3 gateways behind a load balancer.
The ones that are slower to notice
| Scenario | What happens | Signal |
|---|---|---|
| Disks fill up | Volumes go read-only, new volumes can't be grown, writes fail | SeaweedFSDiskFillingUp, then SeaweedFSNoWritableVolumes |
| Filer store lost (embedded LevelDB disk) | Bytes intact, names gone: S3 serves nothing | Only backups of the store help |
| Deleted data never comes back as space | Deletes are tombstones until vacuum | Bucket size vs disk usage drifts apart |
| A bad deploy overwrites objects | Every replica faithfully copies the mistake | Versioning, or nothing |
| Leaked access key | Whatever its identity allows | S3 request metrics by bucket; scope keys narrowly |
| Clock skew on a client | RequestTimeTooSkewed / signature errors | S3 4xx rate |
Write a runbook entry for each row before you need it: how it shows up,
what's safe to do, what isn't. "Don't run volume.fix.replication -apply
for a server that's only rebooting" and "never wipe the filer's disk" are
much easier to follow when written down in advance.
Lab
- Reproduce each scenario above and note the time until each alert fires.
- Stop the filer while
durability.py writeis running. What does the script report, and are any objects half-written afterwards? - Fill a volume server's disk (a large file in its container) and see which alert fires first.