mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 18:47:20 +01:00
docs(upgrade): the in-place restart is the procedure
A volume host's upgrade is a restart on the new binary: install it once per host, then for each volume a cut (best effort) and a restart of its unit, which replays the WAL and serves again within its lease. Any holder that restarts after the swap comes up as v1.0.1, which is supported. Seal-and-move stays as an optional alternative. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7861509c9d
commit
0e62df8160
1 file changed
+37
-37
@@ -12,10 +12,8 @@ records and the chunks, roots and HEAD in SeaweedFS. There is no conversion step
|
||||
2. **Then each volume host, one at a time.** Each volume on the host serves again before you start on the next host.
|
||||
3. **The `sw-block` CLI last.**
|
||||
|
||||
Before you start: take a snapshot of each volume (`sw-block ops chunk snapshot`). Every volume then has a recent
|
||||
restore point whatever happens during the upgrade, and the seal in step 2 has little left to copy. The seal runs on
|
||||
v1.0.0 with v1.0.0's limits: each request is bounded at 5 minutes, and a restore target's first cut reads every byte
|
||||
it has filled.
|
||||
Before you start: take a snapshot of each volume (`sw-block ops chunk snapshot`), so that every volume has a recent
|
||||
restore point whatever happens during the upgrade.
|
||||
|
||||
## 1. blockmaster
|
||||
|
||||
@@ -31,41 +29,46 @@ started again by its unit and serves again once blockmaster is back and its barr
|
||||
[standalone deployment](standalone-deployment.md)). No acknowledged write is lost either way.
|
||||
|
||||
During the rest of the upgrade, blockmaster is v1.0.1 while some volume hosts and the `sw-block` CLI are still
|
||||
v1.0.0. This mixed state is supported: v1.0.0 holders keep serving, snapshots and restores work, and every command of
|
||||
step 2 runs from the v1.0.0 CLI.
|
||||
v1.0.0. This mixed state is supported: v1.0.0 holders keep serving, snapshots and restores work, and the commands of
|
||||
step 2 run from the v1.0.0 CLI.
|
||||
|
||||
## 2. Each volume host
|
||||
|
||||
For each volume on the host, do the [planned return to the same host](volume-lifecycle.md#same-host) with the binary
|
||||
swap in the middle:
|
||||
The upgrade of a volume host is a restart on the new binary. v1.0.1 opens the v1.0.0 local store and replays its WAL
|
||||
as on any restart, so every acknowledged write is kept; no seal and no move are needed.
|
||||
|
||||
1. **Seal and hand back** (steps 1 to 5 of the [planned hand-over](volume-lifecycle.md#planned-hand-over)): read the
|
||||
holder, stop the writer, seal with `ops chunk detach --plain`, revoke with the sealed generation, and wait for the
|
||||
recorded ACK. The holder exits with status 0 after its ACK.
|
||||
|
||||
If the seal answers a retryable error or an unknown outcome, run the same command again: repeating it is safe, and
|
||||
once it has applied it answers from the sealed HEAD (`sw-block ops chunk show` then shows `head.State`
|
||||
`detached`).
|
||||
2. **Replace** the `blockvolume` binary with v1.0.1's by installing a new file, not by writing over the old one:
|
||||
1. **Replace the binary**, once per host, by installing a new file, not by writing over the old one:
|
||||
|
||||
```bash
|
||||
sudo install -m 0755 ./blockvolume /usr/local/bin/blockvolume
|
||||
blockvolume --version
|
||||
```
|
||||
|
||||
`install` replaces the file, so processes still running from the old binary keep it. On a host with several
|
||||
volumes the binary is one file: replace it once, at the first volume's step 2.
|
||||
3. **Move back to this host** (step 6, with your own host as the target: `--target-host` this host's `server_id` and
|
||||
the volume's usual `--target-data` and `--target-ctrl`).
|
||||
4. **Start** `blockvolume` within 30 seconds, with the unchanged settings and local root (step 7). Have the start
|
||||
command ready before you run the move. It claims the sealed HEAD at the new epoch and serves its sealed image.
|
||||
5. **Verify** (step 8): the holder logs `adopted as PRIMARY`, and `ops workspace show` prints the new epoch. Reconnect
|
||||
the guest.
|
||||
`install` replaces the file, so the volumes still running keep their old process until they restart. From now on,
|
||||
any `blockvolume` on this host that starts again, planned or not (for example after a lease expiry, exit 75, or a
|
||||
crash), starts as v1.0.1. That is supported: it is the same restart.
|
||||
2. **For each volume on the host, one at a time:**
|
||||
1. Publish its changes with a cut, so that its recovery point is recent if the host is lost during the upgrade:
|
||||
|
||||
Nothing the volume acknowledged is lost. If a step answers otherwise than its page says, stop there and follow that
|
||||
page's table; do not go on to the next volume.
|
||||
```bash
|
||||
sw-block ops chunk cut --volume v1 --status-addr STATUS
|
||||
```
|
||||
|
||||
A host that holds several volumes runs one `blockvolume` per volume: upgrade them one at a time, the same way.
|
||||
The cut needs the volume's `--chunk-control-endpoint`; without it, skip this step. If the cut answers a
|
||||
retryable error or an unknown outcome, go on: the restart keeps every acknowledged write in the local WAL
|
||||
either way.
|
||||
2. Restart its unit: `systemctl restart <the volume's blockvolume unit>`. The new process renews within the
|
||||
30-second lease and serves again from its local WAL (see
|
||||
[restart without a hand-over](volume-lifecycle.md#same-host)).
|
||||
3. Check that it serves: its status shows `"Healthy":true` and `"AuthorityRole":"primary"`
|
||||
(`curl -s 'http://STATUS/status?volume=v1'`). Then go on to the next volume.
|
||||
|
||||
Nothing the volume acknowledged is lost. If a volume does not serve again within its lease, follow
|
||||
[after a crash](volume-lifecycle.md#after-a-crash) for it before you go on.
|
||||
|
||||
You can instead combine the upgrade with a move: seal the volume and hand it over
|
||||
([planned hand-over](volume-lifecycle.md#planned-hand-over)), and start it on the target host with the v1.0.1 binary.
|
||||
This is optional; the restart above is the upgrade procedure.
|
||||
|
||||
## 3. The `sw-block` CLI
|
||||
|
||||
@@ -81,22 +84,19 @@ Replace `sw-block` on every machine that runs it.
|
||||
|
||||
Exit 0 is clean. A snapshot taken before the upgrade restores as before.
|
||||
- v1.0.0 left the roots and segments of old cuts in place. v1.0.1's cleaning removes them, starting at the next
|
||||
`--chunk-maintenance-interval` (hourly by default) and over as many passes as it needs; each pass logs
|
||||
`maintenance volume=<v> ... planned=N removed=N` on the volume's host. Until it has finished, the same verify with
|
||||
`--orphans` lists those roots and segments: that is expected after an upgrade, not damage. Run the `--orphans`
|
||||
check after the cleaning has passed; if it still lists them, run it again after the next pass.
|
||||
`--chunk-maintenance-interval` (hourly by default); each pass logs `maintenance volume=<v> ... planned=N removed=N`
|
||||
on the volume's host. Until the first v1.0.1 pass has finished, the same verify with `--orphans` lists those roots
|
||||
and segments: that is expected after an upgrade, not damage. Run the `--orphans` check after that pass.
|
||||
|
||||
## If a step is interrupted
|
||||
|
||||
Each step can be repeated, and the procedure resumes at the step that did not finish:
|
||||
|
||||
- **blockmaster killed while it starts:** start it again. Volumes behave as in a longer blockmaster stop above.
|
||||
- **A holder killed during its seal:** its unit starts it again. Check with `sw-block ops chunk show`: if
|
||||
`head.State` is `detached`, the seal finished; go on with the revoke. Otherwise the volume is not sealed and the
|
||||
holder serves again from its local WAL; seal again.
|
||||
- **The new `blockvolume` killed while it starts:** start it again. It claims the sealed HEAD at the next renewal. If
|
||||
more than 30 seconds pass after the move, start it after 65 seconds, as in
|
||||
[after a crash](volume-lifecycle.md#after-a-crash).
|
||||
- **A holder killed during its cut:** its unit starts it again, on the new binary if it was already installed.
|
||||
It replays its WAL and serves again; go on with the restart step (or skip it if it already runs v1.0.1).
|
||||
- **The new `blockvolume` killed while it starts:** its unit starts it again. If it does not serve again within its
|
||||
lease, follow [after a crash](volume-lifecycle.md#after-a-crash).
|
||||
- **A whole host lost power mid-procedure:** start its units again, then resume at the step it had not finished.
|
||||
|
||||
## Downgrade
|
||||
|
||||
Reference in new issue
Block a user