mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
docs: operations manual answers the rc.2 two-host cell (#1048)
Merge note (batch b14; pull_request_target spec-trace workflow has a startup_failure, so its checks run locally): - One Test run (47292188573) succeeded (go test (linux), process-level tests (real binaries)) on the integration tree 0c6ffb38 = main 7f8a7f2d + #1047 #1048 in this order; these squash merges reproduce that tree, verified after the last one. - spec-trace-check.sh and public-text-check.sh, run with main's scripts against this head and body: both exit 0.
This commit is contained in:
1 parent
260eea605b
commit
12ed8fb2e4
1 file changed
+83
-24
@@ -97,7 +97,7 @@ systemd and root access.
|
||||
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
|
||||
sleep 10; ss -ltn | grep -c -E ':(9333|8888|18888) ' # 3: master, filer HTTP, filer gRPC (6 with appendix B's -ip=<A-IP>)
|
||||
```
|
||||
|
||||
`linux_amd64.tar.gz` is the plain build; the `_full` and `_large_disk` variants also work. The filer's gRPC
|
||||
@@ -112,9 +112,8 @@ systemd and root access.
|
||||
- **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.
|
||||
without it. Set up the certificates and roles first, as
|
||||
[appendix B](#appendix-b-two-hosts-and-a-planned-move) shows; 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
|
||||
|
||||
@@ -479,8 +478,12 @@ A deleted name is never created again. To delete the restored volume `v2`:
|
||||
```
|
||||
|
||||
- It answers `{"volume":"v2-<id8>","state":"deleted"}`.
|
||||
- Before the horizon it answers `not_admitted ... live until <time>` and deletes nothing. Run the same command,
|
||||
with the same request id, after that time.
|
||||
- Before the horizon it answers `not_admitted ... live until <time>` and deletes nothing. Read the answer's
|
||||
`retryable` field. In v1.1.1:
|
||||
- **`retryable: true`, exit 75:** the delete is admitted, and its final lease barrier has not passed yet.
|
||||
Run the same command, with the same request id, after that time.
|
||||
- **`retryable: false`, exit 1, "stop the volume first":** blockmaster refused to admit the delete because a
|
||||
serving holder still holds the lease. Do steps 1 and 2 first, then run the same command again.
|
||||
- The delete removes the volume's data and snapshots. A small tombstone stays (`HEAD`, `VOLUME` and empty
|
||||
directories under `/swblock/chunks/v2-<id8>/`): it keeps the name from being created again. Do not remove it.
|
||||
- In v1.1.0, blockmaster keeps the deleted volume's authority record. After step 4, cluster status stays
|
||||
@@ -488,8 +491,14 @@ A deleted name is never created again. To delete the restored volume `v2`:
|
||||
`workspace: volume is being deleted`, and `cluster.check` keeps failing the deleted volume's holder checks
|
||||
(`host.heartbeat`, `volume.lease`, `volume.frontend` and others). All of this is expected, and it does not
|
||||
affect other volumes.
|
||||
- From v1.1.1, the deleted volume reads `deleting` (reason `deletion_reserved`, `delete committed; awaiting
|
||||
metadata retirement`), the cluster stays `ok`, and `cluster.check` exits 0 (its holder checks print `deleting
|
||||
... no serving checks apply`). `ops workspace show --volume v2` still answers `workspace: volume is being
|
||||
deleted`. blockmaster retires the volume's records at its next start after step 4.
|
||||
|
||||
4. **Remove the volume from the cluster spec** (edit it as root, as in section 2), restart blockmaster, and remove the settings file:
|
||||
4. **Remove the volume from the cluster spec** (edit it as root, as in section 2), restart blockmaster, and remove the
|
||||
settings file on every host that ran the volume. If it was the last volume, leave the `volumes:` key with no
|
||||
entries (`volumes: []`):
|
||||
|
||||
```sh
|
||||
sudo rm /etc/sw-block/volumes/v2.env
|
||||
@@ -592,7 +601,11 @@ writing the v1.0 format until you finalize. Until then you can go back.
|
||||
sw-block cluster retire-host --server <id> --confirm <id> --master 127.0.0.1:9180 --json
|
||||
```
|
||||
|
||||
It is refused while the host holds a volume (`HOST_HOLDS_WORK`, each volume named).
|
||||
It is refused while the host holds a volume (`HOST_HOLDS_WORK`, each volume named). Right after a blockmaster
|
||||
restart, it can also name a volume on that host that is already deleted. blockmaster cannot yet prove the volume's
|
||||
last lease has ended, so it waits for its restart floor: the lease's 30 s grant plus the configured clock skew
|
||||
(`--workspace-max-clock-skew`, 20 s by default), so about 50 s with defaults. Run the same command again after
|
||||
that.
|
||||
|
||||
The finalize is **one-way**. Afterwards, old binaries refuse the new format:
|
||||
|
||||
@@ -665,7 +678,8 @@ exits 1, because of the known FAILs listed below.
|
||||
- **A stopped volume** fails its holder checks (`host.heartbeat`, `volume.lease`, `volume.frontend`,
|
||||
`volume.chunkstore`, `volume.cut`, `versions.equal`, and others). Some of the printed cures do not apply. Cluster
|
||||
status shows the cluster `blocked` or `degraded` until the volume runs again. A volume deleted in v1.1.0 stays
|
||||
`degraded` (section 6).
|
||||
`degraded` (section 6). From v1.1.1, a deleted volume reads `deleting`, its checks print `no serving checks apply`,
|
||||
and the cluster stays `ok` (section 6, step 3).
|
||||
|
||||
These FAILs do not mean a fault in v1.1.0:
|
||||
|
||||
@@ -729,7 +743,7 @@ says otherwise.
|
||||
| `remote_unavailable` (retryable) | holder calls; from v1.1.1 every `ops chunk` command that contacts a filer or master | The filer or master could not be reached. From v1.1.1 the CLI exits 75. | Retry once it is reachable, with the same request id. |
|
||||
| `internal` | `ops chunk` commands with `--chunk-filer` | v1.1.0 only: also what an unreachable filer gives, and `ops chunk verify` and `ops chunk snapshot-delete` instead answer `bad_request: ... needs exactly one filer ... connection refused` (exit 2) after 30-60 s. From v1.1.1 these are `remote_unavailable`. | Check the filer address and that the filer runs, then retry. |
|
||||
| `not_admitted` | restore | The target is not in the cluster spec. The printed cure (`--lifecycle-product-loop-interval`) does not apply to this setup. | Add the target without `size_bytes` and restart blockmaster (section 5). |
|
||||
| `not_admitted ... live until <time>` | volume-delete | The volume's lease horizon has not passed. | Repeat with the same request id after that time (section 6). |
|
||||
| `not_admitted ... live until <time>` | volume-delete | The volume's lease horizon has not passed. In v1.1.1 the answer's `retryable` field says which case applies: `true` (exit 75) means the delete is admitted and waits for its final lease barrier; `false` (exit 1, "stop the volume first") means a serving holder still holds the lease, so the delete was not admitted. | `true`: repeat with the same request id after that time. `false`: stop the holder (section 6, steps 1 and 2), then repeat (section 6). |
|
||||
| `remote_full` | cuts, snapshots | The chunk store has no space. | Add capacity, then retry. |
|
||||
| `queue_full` | cuts, snapshots | Reclamation work must drain before another producer publishes. | Retry later. |
|
||||
| `format_level_below_head_version` | cuts, in the holder log | The holder still runs at the format level it attached at, from before the finalize. | A v1.1.1 holder adopts the finalized level at its next lease renewal; restart a v1.1.0 holder (section 7). |
|
||||
@@ -805,12 +819,14 @@ In every v1.1.x:
|
||||
|
||||
**Only for the dedicated single-host installation this manual built**: its own `seaweedfs` unit with data in
|
||||
`/data/weed`, and blockmaster and every volume on this one host. It deletes every volume's data, blockmaster's state
|
||||
and that SeaweedFS data, and nothing can be recovered. Do not use it on several hosts, or where SeaweedFS was
|
||||
already running before this manual (skip step 3's SeaweedFS lines then; that SeaweedFS and its data stay).
|
||||
and that SeaweedFS data, and nothing can be recovered. Do not use it as written on several hosts: for appendix B's
|
||||
two hosts, follow the host-by-host order there. Where SeaweedFS was already running before this manual, skip step
|
||||
3's SeaweedFS lines; that SeaweedFS and its data stay.
|
||||
|
||||
1. **Stop every volume** (each guest unmounted and disconnected first, section 4). Each stop must end with
|
||||
`recovery point in the object store: ...` or `nothing to cut or stop` (exit 0). If a stop refuses, fix the cause it
|
||||
names and run it again; do not go on. `disable` alone does not stop a running holder.
|
||||
names and run it again; do not go on. `disable` alone does not stop a running holder. Skip volumes you deleted
|
||||
in section 6: their stop answers `settings: ... no such file or directory` (exit 2), and that is expected.
|
||||
|
||||
```sh
|
||||
sudo /usr/local/bin/sw-block volume stop v1
|
||||
@@ -836,7 +852,9 @@ already running before this manual (skip step 3's SeaweedFS lines then; that Sea
|
||||
sudo rm -f /etc/systemd/system/sw-blockmaster.service /etc/systemd/system/sw-blockvolume.service \
|
||||
/etc/systemd/system/sw-blockvolume@.service /etc/systemd/system/sw-blockvolume-ublk.service \
|
||||
/etc/tmpfiles.d/sw-block.conf /usr/local/bin/blockmaster /usr/local/bin/blockvolume /usr/local/bin/sw-block &&
|
||||
sudo rm -rf /etc/systemd/system/sw-blockvolume@*.service.d /run/sw-block &&
|
||||
sudo systemctl daemon-reload && sudo userdel sw-block
|
||||
sudo rmdir /mnt/v1 2>/dev/null || true # the guest mount points, if empty
|
||||
```
|
||||
|
||||
The SeaweedFS that section 0 created for this installation, and only that one:
|
||||
@@ -846,6 +864,7 @@ already running before this manual (skip step 3's SeaweedFS lines then; that Sea
|
||||
state=$(systemctl show -p ActiveState --value seaweedfs) && test "$state" = inactive &&
|
||||
sudo rm -rf /data/weed && sudo rm -f /etc/systemd/system/seaweedfs.service /usr/local/bin/weed &&
|
||||
sudo systemctl daemon-reload
|
||||
sudo rmdir /data 2>/dev/null || true # if section 0 created it and it is now empty
|
||||
```
|
||||
|
||||
## Appendix A. Build from source
|
||||
@@ -895,17 +914,44 @@ those advertised addresses, not just the filer. In section 0's SeaweedFS unit, r
|
||||
confirm the actual listeners with `ss -ltn`. SeaweedFS traffic is not protected by blockmaster's mTLS: keep it on
|
||||
the trusted private network.
|
||||
|
||||
Issue certificates using [authenticate the control API](operator-guide.md#authenticate-the-control-api): a CA,
|
||||
a master certificate whose SAN includes `<A-IP>`, node certificates with CN `s1` and `s2`, and a separate operator
|
||||
certificate on each host (for example CN `ops-a` and `ops-b`). Add all four client certificates' SHA-256 fingerprints
|
||||
to A's role file: `node s1`, `node s2`, `admin ops-a` and `admin ops-b`, respectively. Generate each private key on
|
||||
its owning host and send only its CSR to the CA. Keep the CA signing key off the service hosts.
|
||||
Issue the certificates: a CA, a master certificate whose SAN includes `<A-IP>`, node certificates with CN `s1` and
|
||||
`s2`, and a separate operator certificate on each host (CN `ops-a` and `ops-b`). Generate each private key on its
|
||||
owning host and send only its CSR to the CA. Keep the CA signing key off the service hosts.
|
||||
|
||||
```sh
|
||||
# on the CA machine, once
|
||||
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes -days 3650 \
|
||||
-subj "/CN=sw-block CA" -keyout ca.key -out ca.crt
|
||||
|
||||
# on the owning host, one key and CSR per certificate:
|
||||
# A: master (CN blockmaster), node (CN s1), operator (CN ops-a); B: node (CN s2), operator (CN ops-b)
|
||||
openssl req -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes -subj "/CN=s1" -keyout node.key -out node.csr
|
||||
|
||||
# on the CA machine, sign each CSR (the master's with its address in the SAN)
|
||||
openssl x509 -req -in node.csr -CA ca.crt -CAkey ca.key -CAcreateserial -days 825 -out node.crt
|
||||
openssl x509 -req -in master.csr -CA ca.crt -CAkey ca.key -CAcreateserial -days 825 \
|
||||
-extfile <(printf "subjectAltName=IP:<A-IP>") -out master.crt
|
||||
```
|
||||
|
||||
A's role file (`/etc/sw-block/tls/roles`) has one line per client certificate, `sha256:<fingerprint> <role> <id>`,
|
||||
where the id equals the certificate's CN: `node s1`, `node s2`, `admin ops-a` and `admin ops-b`. For each signed
|
||||
client certificate, for example s1's signed `node.crt`:
|
||||
|
||||
```sh
|
||||
echo "sha256:$(openssl x509 -in node.crt -outform DER | sha256sum | cut -d' ' -f1) node s1" >> roles
|
||||
```
|
||||
|
||||
Background: [authenticate the control API](operator-guide.md#authenticate-the-control-api).
|
||||
|
||||
Install the CA certificate, that host's node certificate/key and operator certificate/key under
|
||||
`/etc/sw-block/tls/` as `ca.crt`, `node.crt`, `node.key`, `operator.crt`, `operator.key`. A additionally needs
|
||||
`master.crt`, `master.key` and `roles`. Use root-owned files, group `sw-block`, mode 0640 for service keys and
|
||||
mode 0750 for the directory. Keep the operator key readable only by its operator (root in the examples below).
|
||||
The commands below run in a root shell (`sudo -i` first). On each host, export the operator credentials before CLI calls:
|
||||
The commands below run in a root shell (`sudo -i` first). Run every `sw-block` command there **without** `sudo`,
|
||||
including the ones sections 4, 6 and 12 print with `sudo /usr/local/bin/sw-block ...`: `sudo` resets the
|
||||
environment even from root, so the command loses the `SW_BLOCK_TLS_*` credentials and cannot reach blockmaster
|
||||
(`release not confirmed ... error reading server preface: EOF`). On each host, export the operator credentials before
|
||||
CLI calls:
|
||||
|
||||
```sh
|
||||
export SW_BLOCK_TLS_CERT=/etc/sw-block/tls/operator.crt
|
||||
@@ -985,7 +1031,12 @@ of v1; do not copy A's WAL or settings file to B. Do not use `volume stop` betwe
|
||||
|
||||
Require `recorded ACK: R@E HEAD generation G`. The holder exits 0 by itself; a signal stop skips the ACK.
|
||||
Check `systemctl is-active sw-blockvolume@v1` reports inactive, then `systemctl disable sw-blockvolume@v1`
|
||||
on A so it does not start there at boot.
|
||||
on A so it does not start there at boot. A's settings file and local store are no longer used; remove them so
|
||||
they cannot start an old copy later:
|
||||
|
||||
```sh
|
||||
rm /etc/sw-block/volumes/v1.env && rm -rf /var/lib/sw-block-volume/v1
|
||||
```
|
||||
4. **On A**, move authority, keeping one request id for all retries:
|
||||
|
||||
```sh
|
||||
@@ -1017,7 +1068,15 @@ For iSCSI, use section 4's logout on A and section 3's loopback discovery/login
|
||||
and connect. The same seal, ACK and move sequence applies. Stop, snapshots and holder-status commands now run on B;
|
||||
the master and filer remain on A. Keep the same volume size, replica id and chunk path throughout.
|
||||
|
||||
For teardown, first stop and disconnect the guest on B, then stop/disable its holder. Check for active holders
|
||||
on **both** hosts. Section 12's single-host removal block must not be run unchanged: remove only each host's own
|
||||
units, override and local files after its services are inactive; remove blockmaster and the dedicated SeaweedFS
|
||||
data only on A, after no holder on either host uses them.
|
||||
**Teardown on two hosts**, in the root shell, with its `sw-block` commands run without `sudo` (as above):
|
||||
|
||||
1. **On B, while blockmaster on A still runs:** unmount and disconnect the guest. Then run section 12 step 1
|
||||
(`sw-block volume stop v1`), which releases the lease through blockmaster on A, and steps 2 and 3, without the
|
||||
SeaweedFS block.
|
||||
2. **On A:** skip section 12 step 1 for `v1`. The move made it B's: A's instance was revoked, its unit is inactive
|
||||
and disabled, and its settings file is gone, so `volume stop v1` would answer `settings: ... no such file or
|
||||
directory` (exit 2). Check that no holder runs on A (section 12 step 2's check must print `nothing runs`). Then run
|
||||
section 12 step 2, and step 3 with the SeaweedFS block.
|
||||
|
||||
Section 12's removal also removes the per-instance TLS override (`/etc/systemd/system/sw-blockvolume@*.service.d`).
|
||||
Remove `/etc/sw-block/tls` with `/etc/sw-block`, and keep the CA key where it is.
|
||||
Reference in new issue
Block a user