From f5fea69cf7f1ea64e1bbc379f9100141ff63c6ce Mon Sep 17 00:00:00 2001 From: pingqiu-cpu Date: Thu, 3 Dec 2026 05:58:46 -0800 Subject: [PATCH] docs: operations manual for v1.1.x standalone volumes (#974) Merge note (pull_request_target spec-trace workflow has a startup_failure on every branch since 2026-12-02 22:45Z, so its checks run locally): - Test run 47118093690 succeeded (go test (linux), process-level tests (real binaries)) on head 47614211 against main 459059b9, the current main head. - spec-trace-check.sh and public-text-check.sh, run with the main branch's scripts against this head and body: both exit 0. - Docs review ACCEPT on 783166a2: removal runs only after a successful, empty unit query, SeaweedFS removal requires its unit to be inactive, and the multi-host guidance keeps mutual TLS and loopback guests. - Independent first-time operator runs on earlier heads of this manual (Ubuntu 24.04 with an upgrade and a reboot, and AlmaLinux 9 with SELinux enforcing over iSCSI) completed with zero workarounds; the later commits fold in their documentation findings. --- seaweed-block/README.md | 26 +- seaweed-block/docs/operations-manual.md | 844 ++++++++++++++++++++ seaweed-block/docs/releases/v1.1.md | 2 +- seaweed-block/docs/standalone-deployment.md | 3 +- seaweed-block/docs/troubleshooting.md | 3 + 5 files changed, 868 insertions(+), 10 deletions(-) create mode 100644 seaweed-block/docs/operations-manual.md diff --git a/seaweed-block/README.md b/seaweed-block/README.md index ba25e41857..a67424fd97 100644 --- a/seaweed-block/README.md +++ b/seaweed-block/README.md @@ -20,25 +20,35 @@ before v1.1. Do not run it for data you keep. v1.0.x releases ship from the `rel ## Install -The binaries are `blockmaster`, `blockvolume` and the `sw-block` CLI. The commands on this page are for v1.0.0. -**Option 1:** copy them from the v1.0.0 image, -`ghcr.io/seaweedfs/seaweed-block:v1.0.0` (index digest -`sha256:648980beb519a086349d44367e9d19ba6ae94b8939456ae3eb7b7bb5e4b3b28b`): +The binaries are `blockmaster`, `blockvolume` and the `sw-block` CLI, all three from one release: replace `TAG` +below with the release, for example `v1.1.0`. + +**Option 1:** download the release tarball and check it. Releases from v1.1.0 onwards carry it: ```bash -docker create --name swb-extract ghcr.io/seaweedfs/seaweed-block:v1.0.0 +curl -fsSLO https://github.com/seaweedfs/seaweed-block/releases/download/TAG/sw-block-TAG-linux-amd64.tar.gz +curl -fsSLO https://github.com/seaweedfs/seaweed-block/releases/download/TAG/SHA256SUMS +sha256sum -c --ignore-missing SHA256SUMS && tar -xzf sw-block-TAG-linux-amd64.tar.gz --strip-components=1 +./blockvolume --version +``` + +**Option 1b:** copy them from the release image `ghcr.io/seaweedfs/seaweed-block:TAG` (the release page gives its +index digest): + +```bash +docker create --name swb-extract ghcr.io/seaweedfs/seaweed-block:TAG for b in blockmaster blockvolume sw-block; do docker cp swb-extract:/usr/local/bin/$b .; done docker rm swb-extract && ./blockvolume --version ``` -**Option 2:** build from the tag `v1.0.0` (the Go version in `go.mod`): +**Option 2:** build from the tag `TAG` (the Go version in `go.mod`): ```bash -git clone --branch v1.0.0 https://github.com/seaweedfs/seaweed-block && cd seaweed-block +git clone --branch TAG https://github.com/seaweedfs/seaweed-block && cd seaweed-block for b in blockmaster blockvolume sw-block; do go build -o $b ./cmd/$b; done ``` **Option 3:** Helm, see the [Kubernetes quick start](#quick-start-kubernetes-alpha). -Services: [standalone deployment](docs/standalone-deployment.md). Operator guide (supported setup, sizing, recovery point, host loss, limits): [operator guide](docs/operator-guide.md). +Services: [standalone deployment](docs/standalone-deployment.md). Operations manual (install, upgrade and finalize, isolation, monitoring, typed errors): [operations manual](docs/operations-manual.md). Operator guide (supported setup, sizing, recovery point, host loss, limits): [operator guide](docs/operator-guide.md). ## Try it diff --git a/seaweed-block/docs/operations-manual.md b/seaweed-block/docs/operations-manual.md new file mode 100644 index 0000000000..ff732ff663 --- /dev/null +++ b/seaweed-block/docs/operations-manual.md @@ -0,0 +1,844 @@ +# Operations manual (v1.1.x, standalone walstore-chunk volumes) + +This manual takes one host from nothing to a serving volume. It then covers snapshots, restore, stop, delete, +upgrade and monitoring, all with systemd. Every step gives the command to run. Links are for background only; you +should not need them to finish a step. They are relative to the repository's `docs/` directory. + +The examples use one host, with everything on loopback. Where an address must change for several hosts, the step +says so. For the Kubernetes alpha line, see the [Kubernetes quick start](quickstart-kubernetes.md). + +**Two conventions:** + +- **Absolute paths under sudo.** Every command run with `sudo` names its binary by absolute path + (`sudo /usr/local/bin/sw-block ...`). On RHEL and its rebuilds, sudo's `secure_path` does not include + `/usr/local/bin`, so `sudo sw-block` answers `command not found`. Commands without sudo use the short name. +- **Device names.** `/dev/` stands for a device name you read from `lsblk` on your host. Never copy a device + name from an example. + +Contents: + +0. [Prerequisites](#0-prerequisites) +1. [Install the binaries and units](#1-install-the-binaries-and-units) +2. [Cluster spec and blockmaster](#2-cluster-spec-and-blockmaster) +3. [Create and attach a volume](#3-create-and-attach-a-volume) +4. [Stop a volume](#4-stop-a-volume) +5. [Snapshots, restore and verification](#5-snapshots-restore-and-verification) +6. [Delete a volume](#6-delete-a-volume) +7. [Upgrade and finalize the v1.1 format](#7-upgrade-and-finalize-the-v11-format) +8. [Isolation: one I/O share per process](#8-isolation-one-io-share-per-process) +9. [Monitoring](#9-monitoring) +10. [Typed errors and what to do](#10-typed-errors-and-what-to-do) +11. [Known limitations](#11-known-limitations) +12. [Remove everything](#12-remove-everything) + +Appendix A. [Build from source](#appendix-a-build-from-source) + +## 0. Prerequisites + +This manual has been run end to end on Ubuntu 24.04 and on AlmaLinux 9 with SELinux enforcing. You need Linux with +systemd and root access. + +1. **Packages.** You need the guest initiator, synced clocks, git and curl: + + ```sh + # Ubuntu / Debian + sudo apt-get update && sudo apt-get install -y nvme-cli chrony git curl xfsprogs + sudo apt-get install -y open-iscsi # iSCSI guests only + # Ubuntu cloud kernels (azure, aws, gcp) ship nvme_tcp in a separate package: + sudo apt-get install -y linux-modules-extra-$(uname -r) # if modprobe says "Module nvme_tcp not found" + # RHEL 9 / AlmaLinux 9 / Rocky 9 + sudo dnf install -y nvme-cli chrony git curl tar + sudo dnf install -y iscsi-initiator-utils # iSCSI guests only + # both (harmless on an iSCSI-only host) + sudo modprobe nvme_tcp + echo nvme_tcp | sudo tee /etc/modules-load.d/nvme_tcp.conf # load it at every boot + ``` + + Lease safety needs bounded clock skew between hosts, and blockmaster's clock must be slewed, never stepped, + while volumes are served ([clock safety](operator-guide.md#clock-safety-requirement)). Configure chrony to step + only during its first updates at boot: `makestep 1 3`. Ubuntu ships that. EL9 ships `makestep 1.0 -1` (it may + step at any time), so change it on RHEL hosts before blockmaster starts: + + ```sh + grep '^makestep' /etc/chrony.conf /etc/chrony/chrony.conf 2>/dev/null # want: makestep 1 3 + sudo sed -i 's/^makestep .*/makestep 1 3/' /etc/chrony.conf # EL9 + sudo systemctl restart chronyd + ``` + + On a cluster that already serves volumes, make this change only while no volume is served: do not restart + chronyd while leases are live. + +2. **A SeaweedFS 4.53 cluster with exactly one filer.** A volume keeps its chunks in SeaweedFS, through the filer's + gRPC port (18888 by default). You need one master and one filer; a second filer is refused. For a single-host + trial, install `weed` and run it as a systemd unit: + + ```sh + curl -fsSLO https://github.com/seaweedfs/seaweedfs/releases/download/4.53/linux_amd64.tar.gz + curl -fsSLO https://github.com/seaweedfs/seaweedfs/releases/download/4.53/linux_amd64.tar.gz.md5 + md5sum linux_amd64.tar.gz; cat linux_amd64.tar.gz.md5 # the two sums must match + tar -xzf linux_amd64.tar.gz # extracts ./weed + sudo install -m 0755 weed /usr/local/bin/weed + sudo mkdir -p /data/weed # SeaweedFS data: put it on a disk with room for the chunks + sudo tee /etc/systemd/system/seaweedfs.service >/dev/null <<'EOF' + [Unit] + Description=SeaweedFS (single host) + After=network-online.target + [Service] + ExecStart=/usr/local/bin/weed server -dir=/data/weed -ip=127.0.0.1 -filer -volume.max=200 -master.volumeSizeLimitMB=1024 + Restart=on-failure + [Install] + WantedBy=multi-user.target + EOF + sudo systemctl daemon-reload + sudo systemctl enable --now seaweedfs + sleep 10; ss -ltn | grep -c -E ':(9333|8888|18888) ' # 3: master, filer HTTP, filer gRPC + ``` + + `linux_amd64.tar.gz` is the plain build; the `_full` and `_large_disk` variants also work. The filer's gRPC + address is then `127.0.0.1:18888`. + +3. **A disk for the volume's local data.** Each volume keeps its WAL and local copy under + `/var/lib/sw-block-volume/`. That is on the root disk by default; `--durable-root` moves it. To size the + host, see [size a host](operator-guide.md#size-a-host). + +4. **This manual is for one host.** Everything listens on loopback, and nothing needs a firewall port. Two limits + apply to any layout: + - **Guests attach on the volume's own host.** A standalone volume's NVMe/TCP and iSCSI targets bind loopback only; + a non-loopback `--nvme-listen` is refused. Do not change the guest listeners to a host address. + - **blockmaster on another host needs mutual TLS.** blockmaster refuses a non-loopback `SWB_MASTER_LISTEN` + without it. Set up the certificates and roles first, following + [authenticate the control API](operator-guide.md#authenticate-the-control-api); changing the address alone does + not work. The holders then also reach SeaweedFS (its master, filer and volume servers) over the network. + +## 1. Install the binaries and units + +1. **Get the repository at the release tag, then the binaries.** The repository holds the units in `deploy/`. The + binaries are `blockmaster`, `blockvolume` and `sw-block`, all three from the same release. `TAG` is the release, + for example `v1.1.0`. Download the release tarball and check it: + + ```sh + TAG=v1.1.0 + git clone --depth 1 --branch $TAG https://github.com/seaweedfs/seaweed-block && cd seaweed-block # git's detached-HEAD note here is expected + curl -fsSLO https://github.com/seaweedfs/seaweed-block/releases/download/$TAG/sw-block-$TAG-linux-amd64.tar.gz + curl -fsSLO https://github.com/seaweedfs/seaweed-block/releases/download/$TAG/SHA256SUMS + sha256sum -c --ignore-missing SHA256SUMS # sw-block--linux-amd64.tar.gz: OK + tar -xzf sw-block-$TAG-linux-amd64.tar.gz --strip-components=1 + sha256sum -c SHA256SUMS # all four: OK + + ./blockvolume --version # revision= + git rev-parse HEAD # the same commit (v1.1.0 is ff6b0b1bb481d22ee2abc9206bf1ef19938787f5) + ``` + + Releases without a tarball (v1.0.x) take the binaries from the **release image**, which needs Docker or Podman + (`docker.io` on Ubuntu; `podman podman-docker` on RHEL): + + ```sh + sudo docker create --name swb-extract ghcr.io/seaweedfs/seaweed-block:$TAG + for b in blockmaster blockvolume sw-block; do sudo docker cp swb-extract:/usr/local/bin/$b .; done + sudo docker rm swb-extract + ``` + + To build the binaries from source instead, see [appendix A](#appendix-a-build-from-source). + +2. **Install them with the shipped units**, from the same directory: + + ```sh + sudo useradd --system --no-create-home --shell /usr/sbin/nologin sw-block + sudo install -m 0755 blockmaster blockvolume sw-block /usr/local/bin/ + sudo install -d -m 0750 -g sw-block /etc/sw-block + sudo install -m 0640 -g sw-block deploy/config/*.env /etc/sw-block/ + sudo install -m 0644 deploy/systemd/*.service /etc/systemd/system/ + sudo install -m 0644 deploy/systemd/sw-block.tmpfiles.conf /etc/tmpfiles.d/sw-block.conf + sudo systemd-tmpfiles --create /etc/tmpfiles.d/sw-block.conf # /run/sw-block/locks; blockvolume needs it + sudo systemctl daemon-reload + ``` + + The units run `/usr/local/bin/blockmaster` and `/usr/local/bin/blockvolume`, so keep that path. Use + `install`, not `mv`: with SELinux, a file moved from a home directory keeps its home label and systemd may refuse + to run it. + +Do **not** enable `sw-blockvolume.service`. It is the single-volume example for the `--topology` setup, which cannot +serve a walstore-chunk volume. This manual runs each volume as the template unit `sw-blockvolume@.service`, +which `sw-block volume start` creates (section 3). `sw-blockmaster.service` is enabled in section 2. + +**Upgrade order** (for later upgrades too, see section 7): the `sw-block` CLI first, then `blockmaster`, then each +`blockvolume`. A CLI works with holders of its own version and of one version older. An older CLI against a newer +holder is not supported. (The v1.0.2 notes' "CLI last" applied to upgrades within v1.0.x.) + +**Authentication.** For production, set up mutual TLS for the control API ([authenticate the control +API](operator-guide.md#authenticate-the-control-api)). The examples here run on loopback without it. + +## 2. Cluster spec and blockmaster + +blockmaster needs two things: a cluster spec and a lifecycle store. The cluster spec lists the nodes, and each volume +with its size and home placement. A volume's record comes from the cluster spec: no command creates a volume. + +1. **Write `/etc/sw-block/cluster-spec.yaml`** (as root, for example `sudoedit /etc/sw-block/cluster-spec.yaml`, or + `sudo tee /etc/sw-block/cluster-spec.yaml >/dev/null <<'EOF'` ... `EOF`). Later sections edit the same file + the same way: + + ```yaml + nodes: + - server_id: s1 + data_addr: 127.0.0.1:9201 # this node's own data address (volume start's --data-addr); several hosts: never loopback + ctrl_addr: 127.0.0.1:9202 + volumes: + - id: v1 + size_bytes: 4294967296 # 4 GiB; volume start's --size must equal it + replication_factor: 1 + placements: + - server_id: s1 + replica_id: r1 + ``` + + ```sh + sudo chgrp sw-block /etc/sw-block/cluster-spec.yaml && sudo chmod 0640 /etc/sw-block/cluster-spec.yaml + ``` + +2. **Replace all four of these lines in `/etc/sw-block/blockmaster.env`.** The shipped file sets the first and third lines + differently, so replace them rather than adding new ones. The shipped unit turns these lines into flags. + `--topology` and `--cluster-spec` together stop blockmaster, so the topology line must be empty: + + ```sh + SWB_MASTER_TOPOLOGY= + SWB_MASTER_EXPECTED_SLOTS=1 + SWB_MASTER_WORKSPACE_RPC=true + SWB_MASTER_EXTRA_ARGS=--cluster-spec /etc/sw-block/cluster-spec.yaml --lifecycle-store /var/lib/sw-block-master/lifecycle --chunk-filer 127.0.0.1:18888 --chunk-path /swblock/chunks + ``` + + For example: + + ```sh + sudo sed -i -e 's|^SWB_MASTER_TOPOLOGY=.*|SWB_MASTER_TOPOLOGY=|' \ + -e 's|^SWB_MASTER_EXPECTED_SLOTS=.*|SWB_MASTER_EXPECTED_SLOTS=1|' \ + -e 's|^SWB_MASTER_WORKSPACE_RPC=.*|SWB_MASTER_WORKSPACE_RPC=true|' \ + -e 's|^SWB_MASTER_EXTRA_ARGS=.*|SWB_MASTER_EXTRA_ARGS=--cluster-spec /etc/sw-block/cluster-spec.yaml --lifecycle-store /var/lib/sw-block-master/lifecycle --chunk-filer 127.0.0.1:18888 --chunk-path /swblock/chunks|' \ + /etc/sw-block/blockmaster.env + sudo grep -E '^SWB_MASTER_(TOPOLOGY|EXPECTED_SLOTS|WORKSPACE_RPC|EXTRA_ARGS)=' /etc/sw-block/blockmaster.env + ``` + + The lifecycle store must be under `/var/lib/sw-block-master`, the unit's state directory. Any other path is + read-only under the unit, and blockmaster then restarts in a loop with `read-only file system`. + +3. **Start it and check:** + + ```sh + sudo systemctl enable --now sw-blockmaster + sudo journalctl -u sw-blockmaster -n 20 # "new cluster: format level 1 (no prior authority state ...)" + sw-block cluster format-level --master 127.0.0.1:9180 # format level 1 + sw-block ops workspace show --master 127.0.0.1:9180 --volume v1 # exit 0 + ``` + +blockmaster reads the cluster spec only when it starts. After editing the spec, run +`sudo systemctl restart sw-blockmaster`. Serving volumes keep serving across that restart. + +## 3. Create and attach a volume + +1. **Add the volume to the cluster spec** with its `size_bytes` (edit it as root, as in section 2), and restart + blockmaster. Check it with + `sw-block ops workspace show --master 127.0.0.1:9180 --volume ` (exit 0). (For a restore target, which has + no `size_bytes`, the same command exits 1 with `workspace move requires an existing RF1 volume` until the restore. + That is expected.) +2. **Start it.** It needs root, and `--size` must equal the spec's `size_bytes`: + + ```sh + sudo /usr/local/bin/sw-block volume start v1 --server-id s1 --replica-id r1 \ + --data-addr 127.0.0.1:9201 --ctrl-addr 127.0.0.1:9202 --status-addr 127.0.0.1:9203 \ + --size 4GiB --nvme-listen 127.0.0.1:4420 --chunk-filer 127.0.0.1:18888 + ``` + + For an **iSCSI** guest, add `--iscsi-listen 127.0.0.1:3260 --iqn iqn.2026-12.io.seaweedfs:v1`. + `--nvme-listen` stays required: the volume serves both protocols. With SELinux enforcing, `iscsid` may connect + only to ports labeled `iscsi_port_t` (3260 by default). For any other iSCSI port, label it **before discovery**: + + ```sh + sudo dnf install -y policycoreutils-python-utils + sudo semanage port -a -t iscsi_port_t -p tcp + ``` + + The command does four things: + - writes `/etc/sw-block/volumes/v1.env`; + - starts `sw-blockvolume@v1.service`; + - waits until the volume is Healthy (2 minutes by default); + - prints the attach command. (Its hints say `sudo sw-block ...`; on RHEL, use `sudo /usr/local/bin/sw-block ...`.) + + Running it again with the same flags answers `unchanged`. Different flags are refused + (`exists with other settings ... pass --replace`). + +3. **Attach the guest.** For NVMe/TCP, use the command the start printed: + + ```sh + sudo nvme connect -t tcp -a 127.0.0.1 -s 4420 -n nqn.2026-05.io.seaweedfs:v1 --ctrl-loss-tmo=180 --reconnect-delay=2 + lsblk -o NAME,SIZE,MODEL # the new 4G device, model "SeaweedFS V3 BlockVol" + ``` + + For iSCSI: + + ```sh + sudo iscsiadm -m discovery -t sendtargets -p 127.0.0.1:3260 + sudo iscsiadm -m node -T iqn.2026-12.io.seaweedfs:v1 -p 127.0.0.1:3260 --login + lsblk -o NAME,SIZE,VENDOR,MODEL # the new 4G sd device, vendor "SeaweedF", model "BlockVol" + ``` + + - **iscsid and the initiator name.** `iscsid` starts on first use, and it creates `/etc/iscsi/initiatorname.iscsi` + then. You don't need to enable or configure either. + - **Boot.** Discovery records the target with `node.startup = automatic`, so the initiator logs in again at boot, + possibly before the volume serves. To log in yourself once the volume serves, set it to manual: + `sudo iscsiadm -m node -T iqn.2026-12.io.seaweedfs:v1 -p 127.0.0.1:3260 --op update -n node.startup -v manual`. + - **Telling volumes apart.** With several volumes attached, find each device by its name instead of by order. + For iSCSI, run `ls -l /dev/disk/by-path/ | grep ` (for example `...:3261-iscsi-iqn...:v2-lun-0 -> ../../sdc`). + For NVMe/TCP, run `sudo nvme list-subsys`, which shows each NQN with its controller. + +4. **Make a filesystem and mount it.** Run `mkfs` only the first time: it erases the volume. + + ```sh + sudo mkfs.xfs /dev/ # or mkfs.ext4 + sudo mkdir -p /mnt/v1 && sudo mount /dev/ /mnt/v1 + ``` + +Sizes and start time: + +- **Size limit.** New volumes can be up to 1 TiB (1,099,511,627,776 bytes) once the cluster is at format level 1. + New clusters start there; an upgraded cluster gets there with the finalize (section 7). +- **Large volumes before the finalize.** A volume above 256 GiB in the cluster spec is **not registered**. + blockmaster logs `size_requires_format_level_1 ... finalize the v1.1 format` and keeps running without it. Check + blockmaster's log after adding a large volume. (`sw-block ops volume create` answers the same refusal with exit 78.) +- **Start time.** It grows with size: + - attach takes about 1.4 ms per GiB (about 4 s at 1 TiB); + - a restart after a kill takes about 1.5 ms per GiB (about 2.1 s at 1 TiB). + + Both are inside the 30 s startup window. +- **`--recover-timeout`** (default 30 s) is a no-progress window, not a total deadline. Each completed recovery step + renews it, and it pauses while the volume waits for blockmaster. A full window without progress reports + `recovery_stalled` (section 10). +- **One live process per volume per host.** A host lock keeps a second process for the same volume out. The + assignment and the lease keep two hosts apart. + +## 4. Stop a volume + +```sh +# NVMe/TCP guest +sudo umount /mnt/v1 +sudo nvme disconnect -n nqn.2026-05.io.seaweedfs:v1 +sudo /usr/local/bin/sw-block volume stop v1 +``` + +```sh +# iSCSI guest +sudo umount /mnt/v1 +sudo iscsiadm -m node -T iqn.2026-12.io.seaweedfs:v1 -p 127.0.0.1:3260 --logout +sudo /usr/local/bin/sw-block volume stop v1 +``` + +While a guest is connected, the stop refuses with exit 2 (`guests: 1 guest connection(s) ... disconnect them +first`). Otherwise it: + +1. takes a cut, so the object store has every write up to now; +2. stops the unit; +3. ends with `recovery point in the object store: the cut at