Skip to main content

Keep messaging available when a node fails

A single broker is a single point of failure. High-availability clustering runs several Coreflux MQTT Broker nodes as one system: if one node stops, the others keep serving clients. Clients can connect to any healthy node. Important messages (QoS 1 and 2) are copied across nodes so a crash of a minority of the cluster cannot erase a message the broker already accepted.
Like a team with a captain and shared playbook. One node leads changes; the others stay ready. If the captain drops out, the team elects a new one and keeps playing — without rewriting every client’s connection plan.

When to use clustering

Use clustering when you need:
  • continuous MQTT service if one broker stops or is restarted;
  • important publishes (QoS 1/2) to survive if some of the nodes crash after the broker has accepted them; or
  • a fixed or elastic set of broker nodes that should act as one cluster.
Prefer odd node counts (3 or 5) so a clear majority can decide who leads. Clustering requires a license that grants the cluster feature. If you enable clustering without that license, the broker logs a warning and runs standalone.
Clustering is broker configuration, not a LoT System Route. For topic sync with another MQTT broker (including non-Coreflux), use an MQTT Bridge instead.

Configure each node with the same cluster identity and discovery settings, then deploy the same LoT project to every node through your normal workflow.

Quick Start

Add a Cluster section to the broker configuration (or matching environment variables — env vars override the file). On every node, create a dedicated MQTT user for inter-node traffic and set DataPlaneUsername to that username so nodes can exchange topic data.
Use fixed peer addresses when automatic discovery is unavailable (cloud, most Kubernetes networks, multi-subnet LANs):

Concepts operators need

  • One leader. Runtime LoT write commands run only on the current leader. Followers reject writes and tell you which node is the leader. Read-only and node-local commands (queries, diagnostics, license/instance key) still run locally.
  • LoT is not copied between nodes. Each node loads its own LoT from disk / GitOps. A write applied on the leader changes only that node until you distribute the same project files to the others. Point runtime tooling at the leader, and treat your project repository as the source of truth for all nodes.
  • Only matching nodes join. Nodes must share the same cluster identity and join secret so unrelated brokers do not join by accident. (See ClusterId and SharedSecret in the configuration reference.)
  • Session failover needs durability. Enable MQTT state durability so a client that reconnects to another node can get its subscriptions back. Messages queued for offline clients stay on the node that hosted them (see Limitations).

Configuration reference

Core options

The data plane starts only when DataPlaneEnabled is true and DataPlaneUsername names a user that exists in the broker MQTT user store on that node.

Replication options


Ports

Open these between cluster members in your firewall or network policies.

Delivery guarantees

Summary: once the broker has accepted a QoS 1 or 2 publish, that message is stored on a majority of nodes and can be replayed if ownership moves after a failure. If the cluster is split and this side no longer has a majority, it rejects those publishes instead of accepting messages it cannot keep safe.

Operations

Bootstrap and failover

  • A node that sees an existing leader joins as a follower.
  • If no leader is visible and peers exist, the cluster elects a leader and adds members as they are discovered.
  • When the leader is lost, a new one is elected quickly (typically within a fraction of a second). Survivors stop contacting confirmed-dead peers and bring returning nodes back into the mesh automatically.
  • With seeds discovery, a stopped node can remain a configured member (marked unavailable) while majority is computed over the configured list. Prefer kubernetes discovery when instances come and go often.

Observability

Use MQTT Explorer or any MQTT client to subscribe to the $SYS/Coreflux/Cluster/# topics, or call GET /cluster on each node’s operations HTTP port.

Limitations

LoT is not replicated between nodes. Distribute the same project/configuration to every node. Runtime edits on the leader do not appear on followers until you provision them.
Retained messages are node-local. They survive a restart on that node but are not a cluster-wide retained store. A subscriber on another node may not see a retain set elsewhere.
Subscriptions can move; offline queues do not. A client reconnecting with a persistent session to another node can regain its subscriptions when durability is enabled. Queued QoS 1/2 messages for offline clients stay on the node that hosted them until that node returns.
QoS 2 across failover is at-least-once. Design consumers to tolerate duplicates after a node failure or replay.

Next Steps

MQTT State Durability

Persist retained messages, sessions, and queued QoS across restarts — required for session failover.

Broker Configuration

Ports, TLS, listeners, and other broker settings for each node.
Last modified on August 28, 2026