← Offstack All Offstack Docs Topic & How-To Guides v15.0.0 · ~7 KB

Multi-Host Cluster Testing

Run multi-node cluster failover, lease coordination, shared IBM Db2 / SAP HANA / PostgreSQL testing, and guided multi-machine LAN cluster drills (with dry-run preview).

How to stand up OffStack's enterprise cluster fabric across 2–3 real machines and prove it works — read the automated preflight, run the full verification drill, and do the manual kill-one-node failover.

The fabric is three independent node types over one shared SQL database:

noderoledefault portclass
blob-nodechunk storage (object payloads)7100BlobNodeServer
workerremote Python compute7200ComputeWorkerServer
gatewaythe normal OffStack services4566start.py --unified-port

Object manifests (which nodes hold which chunk) and the node/worker registries live in the shared SQL database; chunks live on the blob nodes' disks. A gateway replica pointed at the same DB + node list reads and writes one object space with no per-host filesystem.


1. Prerequisites (every machine)

MariaDB, SQL Server, Oracle, CockroachDB, Dolt, DuckDB, Firebird, IBM Db2 12.1.6, SAP HANA 2.0 SPS08, or SQLite — and one SQLAlchemy URL every host uses, e.g. postgresql+psycopg://offstack:pw@192.168.1.10:5432/offstack. A shared network SQLite file is not recommended for real load; use a server engine (or a single SQLite path on one host for the local harness).

|local - server_time| from each node's /healthz.

workers (7200), and the gateway (4566).

non-loopback bind refuses to start without one. Generate one:

  # Linux / macOS
  python -c "import secrets; print(secrets.token_urlsafe(48))"
  # Windows PowerShell
  python -c "import secrets; print(secrets.token_urlsafe(48))"

(or an installed OffStack; offstack cluster / python start.py cluster / python -m cluster.cli must run).


2. Start the nodes

Pick H1, H2 = each host's LAN IP (not 127.0.0.1). Binding 0.0.0.0 requires --advertise-url so the node registers a reachable URL, never http://0.0.0.0:....

Set the shared values once per shell:

# Linux / macOS
export DB="postgresql+psycopg://offstack:pw@192.168.1.10:5432/offstack"
export SECRET="<the strong secret>"
export H1="192.168.1.11"   # this host's LAN IP
# Windows PowerShell
$env:DB     = "postgresql+psycopg://offstack:pw@192.168.1.10:5432/offstack"
$env:SECRET = "<the strong secret>"
$env:H1     = "192.168.1.11"

Host 1 — database host, one blob node, one worker

python -m cluster.cli --state-file "$DB" --shared-secret "$SECRET" \
  blob-node --host 0.0.0.0 --port 7100 \
            --advertise-url "http://$H1:7100" \
            --data-dir ./cluster_blobs_h1 --register

python -m cluster.cli --state-file "$DB" --shared-secret "$SECRET" \
  worker --host 0.0.0.0 --port 7200 \
         --advertise-url "http://$H1:7200" \
         --heartbeat-interval 5
python -m cluster.cli --state-file $env:DB --shared-secret $env:SECRET `
  blob-node --host 0.0.0.0 --port 7100 `
            --advertise-url "http://$($env:H1):7100" `
            --data-dir .\cluster_blobs_h1 --register

python -m cluster.cli --state-file $env:DB --shared-secret $env:SECRET `
  worker --host 0.0.0.0 --port 7200 `
         --advertise-url "http://$($env:H1):7200" `
         --heartbeat-interval 5

Host 2 — a second blob node and worker

Same commands on H2, with --advertise-url "http://$H2:7100" / "...:7200" and its own --data-dir.

Optional Host 3 / gateway

python start.py --unified-port 4566 --persist --state-file "$DB" \
  --shared-...  # the normal gateway; blob_store = ClusterBlobStore over the node list

Every node prints its bound port and advertised URL on startup (blob node on http://H1:7100 (bound port 7100 ...) registered as ...). A --heartbeat-interval (default 5 s) keeps each node's registry row fresh so an idle node never ages out past the 30 s staleness window.


3. Verify

Preflight (fast — DB, reachability, clock skew, HMAC)

python -m cluster.cli preflight --state-file "$DB" --shared-secret "$SECRET" \
  --blob-nodes "http://$H1:7100,http://$H2:7100" \
  --workers    "http://$H1:7200,http://$H2:7200"

Add --json for machine-readable output. Exit 0 = all checks pass; 1 = a check failed (the table says which); 2 = usage error.

Cluster status (read-only)

python -m cluster.cli --state-file "$DB" status --json

Lists registered nodes, live workers and the event-log head.

Full verification drill (turnkey)

python scripts/verify_multihost_cluster.py \
  --state-file "$DB" --shared-secret "$SECRET" \
  --blob-nodes "http://$H1:7100,http://$H2:7100" \
  --workers    "http://$H1:7200,http://$H2:7200" \
  --replication-factor 2

It runs, in order: preflight → security (unsigned/wrong-secret/replayed requests refused) → replicated blob integrity (PUT, manifest check, GET + SHA-256, delete) → remote compute dispatch (real workers, no local fallback) → cross-node event bus. Exit 0 = full pass.

On Windows LAN hosts, scripts/run_lan_cluster_drill.ps1 wraps these exact cluster.cli, verify_multihost_cluster.py, and Windows Firewall rules per role (-Role coordinator|worker|blob-node|verify; pass -DryRun to preview commands safely without contacting any host).

Manual failover drill

By default the drill pauses and asks you to stop one replica blob node holding the test blob and one worker, then verifies a blob GET still returns the exact bytes from the surviving replica and compute dispatch still succeeds on the survivor. Pass --skip-manual-failover to run only the automated parts (e.g. in CI).


4. What each security check proves

(401) when a secret is set — an open node is never exposed.

±300 s is refused (replay protection).

5. Troubleshooting

symptomcause / fix
BlobNodeServer ... needs an explicit advertise_url when bound to a wildcard addressyou bound 0.0.0.0 with --register/--advertise-url missing — add --advertise-url http://<LAN-ip>:7100
requires a shared_secret unless bound to a loopback addressset --shared-secret on every non-loopback bind
preflight shows large skewone host's clock is off — fix NTP
table ... already exists on simultaneous startconcurrent boot DDL on one SQLite file; the CLI serialises it with a sidecar lock, but for real hosts use a server engine
worker disappears after ~30 s idle--heartbeat-interval 0 disabled the heartbeat — leave it at 5

Want a live walkthrough or evaluation setup for Offstack? Message George Vranjesevic or reach out at george@developmentsnapshot.com.