MQTT Cluster Routes
System routes configure broker-level infrastructure, primarily for clustering and high availability. TheMQTT_CLUSTER route type enables multiple Coreflux brokers to work together as a unified system.
System Routes configure broker infrastructure rather than external data connections. For data integration routes, see Data Pipeline Routes or Data Storage Routes.
MQTT_CLUSTER Syntax
Configuration Parameters
IP address or hostname of the primary/peer broker in the cluster.
MQTT port of the cluster peer (typically 1883 or 8883 for TLS).
Unique identifier for this node within the cluster.
Authentication username for cluster communication.
Authentication password for cluster communication.
How long messages remain valid for synchronization (in seconds). Default varies by configuration.
Basic Cluster Configuration
Cluster Architecture
A typical cluster setup involves configuring each node to connect to its peers:Complete 3-Node Cluster Setup
The following example demonstrates a complete 3-node cluster setup. Each node needs route definitions pointing to its peer nodes. We’ll configure Node 1 first, then show the pattern for Nodes 2 and 3.Before You Begin: Ensure all three brokers are installed and accessible on your network. You’ll need the IP addresses and credentials for each node.
Node 1 Configuration
Use Cases
High Availability
Ensure continuous operation even if individual brokers fail:- Clients can connect to any cluster node
- Messages are synchronized across nodes
- Failover is automatic
Geographic Distribution
Deploy brokers in different locations with cluster synchronization:Load Balancing
Distribute client connections across multiple nodes:- Each node handles a portion of clients
- Messages reach all subscribers regardless of which node they’re connected to
- Horizontal scaling as load increases
Configuration Best Practices
Use Unique Client IDs
Use Unique Client IDs
Each cluster connection should have a unique CLIENT_ID:Duplicate IDs can cause connection conflicts.
Set Appropriate Message Validity
Set Appropriate Message Validity
Balance between message reliability and memory usage:
- Short (10-30s): Fast-changing data, high throughput
- Medium (30-60s): Standard operational data
- Long (60-300s): Critical messages, unreliable networks
Use TLS for Production
Use TLS for Production
Always enable TLS for cluster communication in production:
Consistent Authentication
Consistent Authentication
Use the same credentials across all cluster nodes:
Monitoring Cluster Health
Monitor cluster status through system topics:$SYS/broker/cluster/status- Overall cluster health$SYS/broker/cluster/nodes- Connected peer nodes$SYS/broker/cluster/sync- Synchronization status

