Fenced active–standby
Move traffic after fencing, writer-term acquisition, valid replay and fresh whole-node readiness.
Enterprise runbookEnterprise HA uses one active node and a stopped cold standby prepared for the same workload. A competing broker exits when the active holds the writer fence; it does not remain running as a passive follower. An external orchestrator owns fencing, route movement, and membership. nginz-iotd exposes readiness, writer term, replay frontier, ring generation, and drain state.
The shipped PostgreSQL provider uses a one-second operation deadline. Durable writes and writer-lease renewals must finish within that bound, including WAL flushes. Slow storage can therefore withdraw routing readiness even while PostgreSQL remains reachable. Validate database storage latency under the intended load; keep database durability enabled and respect the readiness gate.
A routable node is the whole local stack: nginx with CitusIO modules, nginz-iotd, its configured nginz-iot-bridge, node-local rings, runtime files, and the configured PostgreSQL provider. The supplied Enterprise profile requires the bridge input ring before broker readiness. Start the broker and bridge together, then the gateway, using the offline kit’s commands.
Route switch signal
route_to_node =
node_ready &&
shard_ready &&
owns_current_writer_term &&
replay_frontier_valid &&
ring_generation_valid &&
required_gates_valid &&
!controlled_drain &&
!stale_active_rejected
Heartbeat, process liveness, nginx reachability, or an open TCP port is not sufficient to move traffic.
Fencing
Production fencing requires stale-writer exclusion. Acceptable providers include:
- an external cluster manager with STONITH or equivalent isolation
- managed volume or storage reservation that excludes a stale writer
- Ceph RBD lock or equivalent storage-backed lock
- a validated NFSv4 profile only where the vendor guarantees stale-client exclusion
Local flock() is a development sequencing fixture. It is not a production fencing provider.
Takeover is blocked unless the orchestrator proves the old active is excluded. Prefer unavailability to split-brain.
The configured nginx iot_cluster_writer_term is a proposal. PostgreSQL lease ownership is the authority.
Failover outline
- Confirm the active is serving and the standby is stopped and absent from the data-plane backend set.
- Capture the active’s redacted support bundle and verify the standby’s image, configuration and native prechecks.
- Simulate active loss or withdraw the active from traffic.
- Fence the active through the selected provider.
- Acquire a newer writer term for the standby.
- Start the new owner’s
nginz-iotdand configured bridge together after fencing. The bridge creates its input ring before broker readiness. - Require fresh local SHM rings using the new term and generation.
- Require broker/store replay to the required frontier and term-valid durable outbox replay.
- Attach nginx modules to the fresh rings.
- Wait for
route_to_node=true. - Move the VIP, load balancer, DNS, or mesh route.
- Reconnect MQTT clients and verify persistent session, retain, Will, and QoS 1 behavior.
- Keep the old active stopped until a later fenced promotion assigns it a newer valid term.
Controlled handoff
Put the source shard into controlled drain before a planned move. Drain stops new assignment; it does not by itself fence the old writer or move the route.
Validate destination binary, config, schema, store compatibility, and capacity first. Capture the active’s support bundle and validate the stopped standby’s inputs. After fencing and promotion, require destination route_to_node=true, move traffic externally and confirm the former active has lost readiness.
Current operating limits
Enterprise supports externally fenced active–standby operation. Active-active writes and transparent TCP migration are unavailable. Promotion requires fencing proof; writer ownership is granted by the external authority. Kubernetes can restart pods. It cannot synthesize replay frontier or own the writer lease.