Cluster Configuration
YedMQ uses Raft to coordinate distributed state. This page covers the fields that matter when running multiple nodes and how the current REST workflows fit around them.
Example configuration
[cluster]
cluster_name = "YedMQ"
node_id = 1001
heartbeat_interval = 10
store_dir = "./store"
session_ttl = 86400
startup_mode = "bootstrap"
nodes = [
{ id = 1001, rpc_address = "node1.example.com:3457", api_address = "node1.example.com:3456" },
{ id = 1002, rpc_address = "node2.example.com:3457", api_address = "node2.example.com:3456" },
{ id = 1003, rpc_address = "node3.example.com:3457", api_address = "node3.example.com:3456" },
]
[cluster.rpc]
external = "0.0.0.0:3457"
Main settings
cluster_name: logical name shared by all nodes in the same clusternode_id: unique numeric identifier for the current nodeheartbeat_interval: Raft heartbeat interval in secondsstore_dir: directory used for Raft logs and replicated statesession_ttl: disconnected session retention window; set this explicitly for real deploymentsstartup_mode:bootstrap: first-node mode; the raft groups initialize from the configured member list on startupjoin: scale-out mode; the node waits to be added through cluster management APIs
nodes: known node list with each node'srpc_addressandapi_addresscluster.rpc.external: bind address for inter-node RPC traffic
Current replicated state
YedMQ currently maintains three dedicated raft groups:
- topic metadata
- session actor mapping
- session state
This is why cluster APIs often act on three raft groups at once.
Recommended scale-out workflow
- Start the initial node or initial member set with
startup_mode = "bootstrap". - Start each new node with
startup_mode = "join". - Add the new node through the management API:
POST /api/v1/cluster/learnersadds a learner to the three raft groups.POST /api/v1/cluster/nodesperforms learner addition plus membership change in one request.
- Use
GET /api/v1/cluster/metricsto confirm the new node has joined cleanly.
Example request for the one-shot add-node workflow:
{
"node_id": 1002,
"node": {
"rpc_addr": "10.0.0.2:3457",
"api_addr": "10.0.0.2:3456"
},
"members": [1001, 1002]
}
Manual initialization endpoints
Bootstrap mode initializes raft state on startup, but explicit init endpoints also exist for operational workflows:
POST /api/v1/cluster/initPOST /api/v1/cluster/raft/topic/initPOST /api/v1/cluster/raft/session_actor_map/initPOST /api/v1/cluster/raft/session_state/init