Learn Labs
Foundations

Docker & Setup

The all-in-one server, the production-shaped cluster, and the lab profile

Everything in this module lives in seaweedfs/ in the repository. One binary, weed, plays every role; the first argument picks which.

The minimal setup

compose.yaml runs weed server: a master, a volume server, a filer and the S3 gateway in a single process, with no authentication.

services:
seaweedfs:
  image: chrislusf/seaweedfs:4.48
  command: server -dir=/data -s3 -s3.port=8333
  ports: ["9333:9333", "8888:8888", "8333:8333"]
  volumes: [seaweedfs_data:/data]
docker compose up -d
aws --endpoint-url http://localhost:8333 s3 mb s3://scratch
aws --endpoint-url http://localhost:8333 s3 cp README.md s3://scratch/

It's perfect for a laptop or CI, and it has no redundancy at all: one process, one disk, one copy of everything.

The production-shaped cluster

compose_prod.yaml runs each role as its own container, the way you'd run them on separate machines:

S3 APInames → fidsassign / lookupbytesheartbeatsS3 clientboto3, aws clifiler + S3 gateway:8333 / :8888filer storeLevelDBmasters ×3Raft, 1 leadervolume-1..4one per rackmasters never see file bytes; volume servers never see file names
master-1, master-2, master-3Raft quorum: 2 of 3 must agree; one leader-defaultReplication=010every file stored twice, on different racks-volumeSizeLimitMB=256small volumes so the lab creates manyvolume-1 .. volume-4the bytes; one per "rack" (rack1..rack4)-dataCenter=dc1 -rack=rackNwhat placement decisions are based on-max=30at most 30 volumes on this serverfilernames, directories, buckets -> file ids-s3 -s3.config=s3.jsonthe S3 gateway, with identities and keys-defaultStoreDir=/datametadata in embedded LevelDB
docker compose down
docker compose -f compose_prod.yaml up -d
curl -s localhost:9333/cluster/status
{"IsLeader":true,"Leader":"master-1:9333.19333","Peers":["master-3:9333.19333","master-2:9333.19333"],"MaxVolumeId":50}
WhatWhere
S3 APIhttp://localhost:8333 (path-style addressing, region us-east-1)
Master UI: topology, volumes, leaderhttp://localhost:9333
Filer UI: browse buckets as directorieshttp://localhost:8888
Metricsmasters 9324 / 9331 / 9332, volumes 9325-9327 and 9330, filer and S3 9328

The lab profile

The Python labs use boto3, the AWS SDK. They run in a container on the cluster's network:

docker compose -f compose_prod.yaml --profile labs build labs
docker compose -f compose_prod.yaml run --rm labs python s3_basics.py

labs/common.py builds an S3 client for a named identity, pointed at http://filer:8333 with path-style addressing (http://host/bucket/key rather than http://bucket.host/key), which self-hosted stores need unless you set up wildcard DNS.

Lab

  1. Start the minimal stack, create a bucket with the AWS CLI, and open the filer UI at http://localhost:8888 to find it under /buckets.
  2. Switch to the cluster. In the master UI, find the leader and the four volume servers with their racks.
  3. Stop the leader master. How long until /cluster/status on another master names a new one? (It took 13 seconds here.)

On this page