Skip to content

Deploying a SeaweedFS cluster (master + volume + filer) on AlmaLinux 9

Stand up a SeaweedFS cluster with a master raft group, volume servers, a filer, and the S3 API on AlmaLinux 9 — replication, erasure coding, TLS, and systemd.

You’ve been running MinIO single-node for a year and the operational profile of “object storage” has shifted under you: a billion small thumbnails from a media app, write-heavy ingestion from a log shipper, and an ML team that keeps asking for a POSIX mount for training data. SeaweedFS is the answer when the workload is small-file heavy and a single S3 endpoint isn’t enough — but only if you deploy it as a real cluster: a master raft group for metadata consensus, volume servers for the actual blobs, a filer for POSIX semantics, and the built-in S3 gateway in front so existing S3 clients work unchanged. Run one binary on one VM and you’ve built a toy. Run the cluster as designed and you’ve built something operators can lean on.

What’s happening

SeaweedFS splits the responsibilities that MinIO collapses into one process: the master holds the cluster topology and assigns file IDs (think etcd, but baked in — masters elect a leader via raft), volume servers hold the actual data in 30 GB volume files (the unit of replication and erasure coding), the filer translates POSIX paths and S3 keys into file IDs and stores that metadata in an external store (Redis, LevelDB, Cassandra, Postgres — pick one), and the S3 gateway lives inside the filer process and answers S3 API calls. Each tier scales independently. You can run three masters and ten volume servers, or three masters and three volume servers — whatever the workload demands.

The reason this matters for small files: SeaweedFS stores many small files in one big volume file with a needle index, so the per-file overhead is bytes rather than the kilobytes you pay on a per-object filesystem like XFS. Workloads that crush XFS — millions of 4 KB thumbnails — sit happily on SeaweedFS. The reason you need a cluster (not a single node) is the same as every other distributed storage system: a single volume server is a single failure domain, and the master must elect a leader (so you need an odd quorum, minimum three). Replication mode 001 means one replica on a different volume server in the same rack; 010 means one replica in a different rack; 200 means EC-style 2+0 with two extra parity shards. Pick once, at bucket creation — changing it later requires rebalancing.

How to verify

After the installer runs on master, volume, and filer nodes, cluster status:

weed shell -master=10.30.0.11:9333
> cluster.check
> volume.list
> fs.meta.cat /buckets/app-uploads

S3 gateway responds at the filer:

curl -s http://10.30.0.14:8333/ | head -20
# <?xml version="1.0" encoding="UTF-8"?>
# <ListAllMyBucketsResult ...>

Put and get an object through the S3 API:

export AWS_ACCESS_KEY_ID=app-key
export AWS_SECRET_ACCESS_KEY=app-secret
aws --endpoint-url http://10.30.0.14:8333 s3 mb s3://app-uploads
echo "probe-$(date +%s)" > /tmp/probe
aws --endpoint-url http://10.30.0.14:8333 s3 cp /tmp/probe s3://app-uploads/probe
aws --endpoint-url http://10.30.0.14:8333 s3 ls s3://app-uploads/

Stop one volume server (systemctl stop seaweedfs-volume on one node) and confirm aws s3 cp of an existing object still works — if replication is 001 or higher, it should.

Verify master raft quorum:

curl -s http://10.30.0.11:9333/cluster/status | jq '.IsLeader, .Peers'

The fix

Save the script as /root/setup-seaweedfs-node.sh and run it on each node after editing the NODE_ROLE, NODE_IP, MASTER_IPS, and (for filers) FILER_BACKEND variables at the top. The installer covers: base hardening (SELinux enforcing, firewalld, fail2ban, dnf-automatic, SSH key-only), XFS data drives on volume nodes (small-file friendly), SeaweedFS 3.69 binary, role-specific systemd unit (master / volume / filer with S3), Redis on filer nodes as metadata backend (default — swap in Postgres for larger deployments), S3 IAM identity file with one application user, and a one-shot bucket-creation block at the end.

#!/usr/bin/env bash
set -euo pipefail

### AlmaLinux 9 SeaweedFS cluster installer
### Roles: master | volume | filer
### Run on each node after editing variables below
### Recommended layout:
###   3 master nodes (consensus)
###   3+ volume nodes (data)
###   1-3 filer nodes (filer + S3 gateway; can be co-located with master in small clusters)

if [[ "$(id -u)" -ne 0 ]]; then
  echo "Run as root."
  exit 1
fi

# === EDIT PER NODE ===
NODE_ROLE="master"            # master | volume | filer
NODE_IP="10.30.0.11"
MASTER_IPS=("10.30.0.11" "10.30.0.12" "10.30.0.13")
VOLUME_DATA_DIR="/srv/seaweedfs/volumes"  # on volume nodes
VOLUME_MAX_SIZE_MB=30000                  # 30 GB volumes
FILER_BACKEND="redis"                     # redis | postgres | leveldb
S3_ROOT_USER="admin"
S3_ROOT_KEY="CHANGE_ME_LONG_RANDOM_64CHAR"
SEAWEEDFS_VERSION="3.69"
# =====================

echo
echo "========================================"
echo "SeaweedFS ${NODE_ROLE} node ${NODE_IP}"
echo "========================================"
echo

echo "==> Updating base OS"
dnf -y update
dnf -y install epel-release
dnf -y install \
  curl wget chrony fail2ban dnf-automatic \
  policycoreutils-python-utils lsof tcpdump bind-utils tar gzip \
  iproute net-tools jq socat firewalld xfsprogs

systemctl enable --now chronyd
systemctl enable --now firewalld

echo "==> SELinux enforcing"
sed -i 's/^SELINUX=.*/SELINUX=enforcing/' /etc/selinux/config
setenforce 1 || true

echo "==> SSH key-only"
sed -i 's|^[#[:space:]]*PermitRootLogin.*|PermitRootLogin prohibit-password|' /etc/ssh/sshd_config
sed -i 's|^[#[:space:]]*PasswordAuthentication.*|PasswordAuthentication no|' /etc/ssh/sshd_config
sshd -t && systemctl restart sshd

echo "==> fail2ban"
cat > /etc/fail2ban/jail.d/sshd.local <<'FAIL2BAN'
[sshd]
enabled = true
port = ssh
backend = systemd
maxretry = 4
findtime = 10m
bantime = 1h
FAIL2BAN
systemctl enable --now fail2ban

echo "==> dnf-automatic"
cat > /etc/dnf/automatic.conf <<'DNFAUTO'
[commands]
upgrade_type = security
random_sleep = 900
download_updates = yes
apply_updates = yes
[emitters]
emit_via = stdio
DNFAUTO
systemctl enable --now dnf-automatic.timer

echo "==> Kernel/sysctl for object storage"
cat > /etc/sysctl.d/99-seaweedfs.conf <<'SYSCTL'
fs.file-max = 4194304
vm.swappiness = 1
vm.dirty_background_ratio = 5
vm.dirty_ratio = 20
net.core.somaxconn = 8192
net.core.netdev_max_backlog = 30000
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_syncookies = 1
net.ipv4.ip_local_port_range = 10240 65535
SYSCTL
sysctl --system

cat > /etc/security/limits.d/99-seaweedfs.conf <<'LIMITS'
seaweedfs soft nofile 1048576
seaweedfs hard nofile 1048576
seaweedfs soft nproc 65535
seaweedfs hard nproc 65535
LIMITS

echo "==> Creating seaweedfs user"
if ! id seaweedfs >/dev/null 2>&1; then
  groupadd -r seaweedfs
  useradd -M -r -g seaweedfs -s /sbin/nologin seaweedfs
fi

echo "==> Downloading SeaweedFS ${SEAWEEDFS_VERSION}"
cd /tmp
curl -sSL "https://github.com/seaweedfs/seaweedfs/releases/download/${SEAWEEDFS_VERSION}/linux_amd64.tar.gz" \
  -o seaweedfs.tar.gz
tar -xzf seaweedfs.tar.gz
mv weed /usr/local/bin/weed
chmod +x /usr/local/bin/weed
rm -f seaweedfs.tar.gz

# Build master peers comma-separated string
MASTER_PEERS=$(IFS=, ; echo "${MASTER_IPS[*]/%/:9333}")
MASTER_PEERS="${MASTER_PEERS//:9333/}:9333"
# simpler: just join with port suffix manually
MASTER_PEERS=""
for ip in "${MASTER_IPS[@]}"; do
  MASTER_PEERS+="${ip}:9333,"
done
MASTER_PEERS="${MASTER_PEERS%,}"

mkdir -p /etc/seaweedfs /var/log/seaweedfs
chown seaweedfs:seaweedfs /var/log/seaweedfs

echo "==> firewalld rules (open per role)"
firewall-cmd --permanent --add-port=22/tcp

case "${NODE_ROLE}" in
  master)
    firewall-cmd --permanent --add-port=9333/tcp   # master HTTP/raft
    firewall-cmd --permanent --add-port=19333/tcp  # master gRPC
    ;;
  volume)
    firewall-cmd --permanent --add-port=8080/tcp   # volume HTTP
    firewall-cmd --permanent --add-port=18080/tcp  # volume gRPC
    ;;
  filer)
    firewall-cmd --permanent --add-port=8888/tcp   # filer HTTP
    firewall-cmd --permanent --add-port=18888/tcp  # filer gRPC
    firewall-cmd --permanent --add-port=8333/tcp   # S3 API
    firewall-cmd --permanent --add-port=6379/tcp   # redis (filer backend)
    ;;
esac
firewall-cmd --reload

# --- ROLE-SPECIFIC ---

if [[ "${NODE_ROLE}" == "master" ]]; then
  echo "==> Master config"
  mkdir -p /srv/seaweedfs/master
  chown -R seaweedfs:seaweedfs /srv/seaweedfs

  cat > /etc/systemd/system/seaweedfs-master.service <<EOF
[Unit]
Description=SeaweedFS master
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=seaweedfs
Group=seaweedfs
ExecStart=/usr/local/bin/weed master \\
  -ip=${NODE_IP} \\
  -port=9333 \\
  -mdir=/srv/seaweedfs/master \\
  -peers=${MASTER_PEERS} \\
  -defaultReplication=001 \\
  -volumeSizeLimitMB=${VOLUME_MAX_SIZE_MB} \\
  -volumePreallocate=false
Restart=on-failure
LimitNOFILE=1048576

[Install]
WantedBy=multi-user.target
EOF

  systemctl daemon-reload
  systemctl enable --now seaweedfs-master
fi

if [[ "${NODE_ROLE}" == "volume" ]]; then
  echo "==> Volume config"
  mkdir -p "${VOLUME_DATA_DIR}"
  chown -R seaweedfs:seaweedfs "${VOLUME_DATA_DIR}"

  cat > /etc/systemd/system/seaweedfs-volume.service <<EOF
[Unit]
Description=SeaweedFS volume
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=seaweedfs
Group=seaweedfs
ExecStart=/usr/local/bin/weed volume \\
  -ip=${NODE_IP} \\
  -port=8080 \\
  -mserver=${MASTER_PEERS} \\
  -dir=${VOLUME_DATA_DIR} \\
  -max=200 \\
  -compactionMBps=200 \\
  -dataCenter=dc1 \\
  -rack=rack1
Restart=on-failure
LimitNOFILE=1048576

[Install]
WantedBy=multi-user.target
EOF

  systemctl daemon-reload
  systemctl enable --now seaweedfs-volume
fi

if [[ "${NODE_ROLE}" == "filer" ]]; then
  echo "==> Filer + S3 config"

  if [[ "${FILER_BACKEND}" == "redis" ]]; then
    echo "==> Installing Redis as filer metadata backend"
    dnf -y install redis
    sed -i 's|^bind .*|bind 127.0.0.1|' /etc/redis/redis.conf
    sed -i 's|^# requirepass .*|requirepass CHANGE_ME_REDIS|' /etc/redis/redis.conf
    sed -i 's|^appendonly .*|appendonly yes|' /etc/redis/redis.conf
    systemctl enable --now redis
  fi

  mkdir -p /etc/seaweedfs
  cat > /etc/seaweedfs/filer.toml <<EOF
[redis2]
enabled = true
address = "127.0.0.1:6379"
password = "CHANGE_ME_REDIS"
database = 0

[leveldb2]
enabled = false

[postgres2]
enabled = false
EOF

  cat > /etc/seaweedfs/s3.json <<EOF
{
  "identities": [
    {
      "name": "${S3_ROOT_USER}",
      "credentials": [
        { "accessKey": "${S3_ROOT_USER}", "secretKey": "${S3_ROOT_KEY}" }
      ],
      "actions": ["Admin","Read","Write","List","Tagging"]
    },
    {
      "name": "app-user",
      "credentials": [
        { "accessKey": "app-key", "secretKey": "app-secret-CHANGE_ME" }
      ],
      "actions": [
        "Read:app-uploads",
        "Write:app-uploads",
        "List:app-uploads",
        "Tagging:app-uploads"
      ]
    }
  ]
}
EOF

  chown -R seaweedfs:seaweedfs /etc/seaweedfs

  cat > /etc/systemd/system/seaweedfs-filer.service <<EOF
[Unit]
Description=SeaweedFS filer + S3
After=network-online.target redis.service
Wants=network-online.target

[Service]
Type=simple
User=seaweedfs
Group=seaweedfs
ExecStart=/usr/local/bin/weed -config_dir=/etc/seaweedfs filer \\
  -ip=${NODE_IP} \\
  -port=8888 \\
  -master=${MASTER_PEERS} \\
  -s3 \\
  -s3.port=8333 \\
  -s3.config=/etc/seaweedfs/s3.json
Restart=on-failure
LimitNOFILE=1048576

[Install]
WantedBy=multi-user.target
EOF

  systemctl daemon-reload
  systemctl enable --now seaweedfs-filer
fi

echo "==> Waiting for service to be reachable"
sleep 5

case "${NODE_ROLE}" in
  master)
    for i in {1..30}; do
      if curl -fs "http://${NODE_IP}:9333/cluster/status" >/dev/null 2>&1; then break; fi
      sleep 2
    done
    curl -s "http://${NODE_IP}:9333/cluster/status" | jq '.'
    ;;
  volume)
    for i in {1..30}; do
      if curl -fs "http://${NODE_IP}:8080/status" >/dev/null 2>&1; then break; fi
      sleep 2
    done
    curl -s "http://${NODE_IP}:8080/status" | jq '.'
    ;;
  filer)
    for i in {1..30}; do
      if curl -fs "http://${NODE_IP}:8888/" >/dev/null 2>&1; then break; fi
      sleep 2
    done
    curl -s "http://${NODE_IP}:8333/" | head
    ;;
esac

echo
echo "========================================"
echo "DONE on this node (role=${NODE_ROLE})."
echo "========================================"
echo
if [[ "${NODE_ROLE}" == "filer" ]]; then
  echo "S3 endpoint: http://${NODE_IP}:8333"
  echo "S3 credentials: app-key / app-secret-CHANGE_ME"
  echo
  echo "Once all masters + volumes are up, on this filer node:"
  cat <<'INIT'
aws configure set aws_access_key_id app-key
aws configure set aws_secret_access_key app-secret-CHANGE_ME
aws --endpoint-url http://NODE_IP:8333 s3 mb s3://app-uploads

# Probe write/read
echo "probe-$(date +%s)" > /tmp/probe
aws --endpoint-url http://NODE_IP:8333 s3 cp /tmp/probe s3://app-uploads/probe
aws --endpoint-url http://NODE_IP:8333 s3 ls s3://app-uploads/
INIT
fi

Make it executable and run on each node in the order: masters first, then volumes, then filers.

chmod 700 /root/setup-seaweedfs-node.sh
/root/setup-seaweedfs-node.sh

Once all three masters have elected a leader (curl http://master:9333/cluster/status shows one IsLeader: true and two peers), bring up the volume servers — they auto-register with the masters and start serving the data plane. Bring up the filer last; it needs both masters and volumes online before it can answer S3 requests. From the filer, create the bucket with aws s3 mb s3://app-uploads and confirm replication kicked in by inspecting weed shell → volume.list — each volume should report replica_placement: 001 and exist on two different volume servers.

For TLS on the S3 endpoint, run HAProxy or Caddy in front of port 8333 — SeaweedFS itself does TLS but the cleanest pattern is to terminate at a proxy that already handles certificate rotation. For high-throughput workloads, scale volume nodes horizontally; the master assigns new file IDs round-robin across volume servers under capacity, so adding nodes is the rebalancing mechanism. Watch weed shell → volume.fix.replication if a volume server is permanently lost: it triggers re-replication on healthy peers.

Run SeaweedFS on Stack Harbor’s managed cloud compute with volume-server monitoring, master raft alerts, and S3-endpoint TLS rotation handled under environment management — or tell us the workload profile and we’ll size the cluster for it.