Skip to content

Cluster Settings ​

Cluster mode config, admin UI, and API.

Environment variables ​

Loaded at startup:

VariableRequiredDefaultNotes
CLUSTER_ENABLEDYes—Set to "true" to enable cluster
CLUSTER_NODE_IDYes—Integer 1–49; out-of-range fails fast
CLUSTER_NODE_NAMENonode-<id>Node name
CLUSTER_NODE_ADDRESSYes—This node's publicly reachable URL
CLUSTER_SECRETYes—This node's initial secret
CLUSTER_SEEDSNoemptySeed addresses for first-time discovery (comma-separated)
CLUSTER_DISCOVERY_INTERVALNo30Discovery period (seconds)
CLUSTER_DEAD_PING_INTERVALNo120Dead-node ping period (seconds)
CLUSTER_MAX_PING_FAILURESNo3Failures before marking dead
CLUSTER_PUSH_INTERVALNo3Pusher push period (seconds)
CLUSTER_BATCH_SIZENo50Sync batch size
CLUSTER_SYNC_LOGSNotrueSet "false" to disable log sync

If CLUSTER_ENABLED != "true", all /api/cluster_node/* endpoints return cluster mode not enabled.

Admin → Cluster ​

The node list lives in Node Management.

Node fields ​

FieldTypeNotes
node_idint UNIQUECluster-wide node number (1–49)
node_namevarchar(64)Node name
addressvarchar(256)Node URL (with http:// or https://)
secret_keyvarchar(128)Cross-node auth key
statusint1=alive / 2=failed
disabledboolSoft-disable flag
last_heartbeatbigintLast heartbeat unix seconds
ping_failuresintConsecutive ping failures

API ​

EndpointMethodAuthNotes
/api/cluster_node/GETRootAll nodes (with is_self flag)
/api/cluster_node/:idGETRootOne node
/api/cluster_node/POSTRootRegister a new node
/api/cluster_node/PUTRootEdit name / address / secret
/api/cluster_node/:idDELETERootSoft-disable
/api/cluster_node/:id/enablePOSTRootRe-enable
/api/cluster_node/ping/:idGETRootManual ping

Register a new node ​

json
{
  "node_id": 1,
  "node_name": "node-cn",
  "address": "https://cn.example.com",
  "secret": "<peer's CLUSTER_SECRET>"
}

Constraints:

  • node_id ∈ [1, 49]
  • address non-empty
  • secret non-empty

Self-registration (auto-write on startup) covers most cases; manual add is for debugging / transitory setups.

"This node" badge ​

The list endpoint adds is_self: bool (n.NodeId == cluster.NodeID). The UI uses this to highlight the local node.

Delete vs Disable ​

ActionAPIEffect
Delete (soft)DELETE /api/cluster_node/:iddisabled=true + status=2
EnablePOST /api/cluster_node/:id/enabledisabled=false + status=1 + reset failure counter
Hard deleteManual SQLDELETE FROM cluster_nodes WHERE node_id = ?

The current node cannot be disabled (controller explicitly blocks it).

Manual Ping ​

GET /api/cluster_node/ping/:id pings the target node:

  • Success → { data: <peer response> }
  • Failure → { success: false, message: <reason> }

Useful for diagnosing "why is this node dead".

FAQ ​

  • All env vars correct but endpoints return "cluster mode not enabled": confirm CLUSTER_ENABLED literally equals the string "true".
  • CLUSTER_NODE_ID out of range: must be 1–49; otherwise the process refuses to start.