Skip to content

Cluster & Nodes

Cluster & Nodes

The complete MQTT platform in one small binary: broker, SQL rules, data connectors and multi-tenancy in a single process.

Read node state and health. Use it when the broker looks wrong. You get one row with connection and rule counts.

flowchart LR
Op["operator"] -- "GET /api/v1/nodes" --> API["management API"]
API -- "read sessions" --> S["sessions"]
API -- "read rules" --> R["rule engine"]

Before you start

  • Start the broker from First start.
  • Set INDRA_API_KEY to an operator key. The examples read it.

Note: Calls except /healthz need an operator API key. Pass it as Authorization: Bearer $INDRA_API_KEY.

Cluster topology, node health, and run-queues

GET /api/v1/nodes

Get cluster node status and metrics

Operation id: getNodes.

Parameters:

No parameters.

Request body:

No request body.

Responses:

StatusDescription
200Node status with live counts

Response 200 body:

Media type application/json:

{
"type": "object",
"properties": {
"node_id": {
"type": "string"
},
"status": {
"type": "string"
},
"version": {
"type": "string"
},
"connections": {
"type": "integer"
},
"rules": {
"type": "integer"
}
}
}

Notes:

  • Related calls sit on the same tag page.

Verified: the example flow below runs this call.

Example:

# Illustrative request. Values come from the schema above.
# The example flow below runs verified calls on a live broker.
curl -s -X GET 'http://127.0.0.1:18083/api/v1/nodes' \
-H "Authorization: Bearer $INDRA_API_KEY"

GET /healthz

Node health check

Operation id: healthCheck.

Parameters:

No parameters.

Request body:

No request body.

Responses:

StatusDescription
200Node is healthy and operating normally

Response 200 body:

Media type text/plain:

{
"type": "string",
"example": "OK"
}

Notes:

  • Related calls sit on the same tag page.

Verified: the example flow below runs this call.

Example:

# Illustrative request. Values come from the schema above.
# The example flow below runs verified calls on a live broker.
curl -s -X GET 'http://127.0.0.1:18083/healthz' \
-H "Authorization: Bearer $INDRA_API_KEY"

Example flow

Read real rows through the management API, then read them back. The docs harness runs this flow against a started broker.

Terminal window
python3 - <<'PY'
import os, urllib.request
port = os.environ.get("API_PORT", "18083")
key = os.environ.get("API_KEY", "")
base = f"http://127.0.0.1:{port}"
def get(path):
req = urllib.request.Request(base + path, method="GET")
req.add_header("Authorization", f"Bearer {key}")
with urllib.request.urlopen(req, timeout=5) as r:
return r.status, r.read().decode()
s1, b1 = get("/api/v1/nodes")
assert s1 == 200, b1
assert "running" in b1 or "node_id" in b1, b1
s2, b2 = get("/api/v1/nodes")
assert s2 == 200, b2
assert b1 == b2, "read back the same node row"
print("OK")
PY
OK

Check that it works

Start the broker with this file. The health endpoint returns OK.

[node]
id = "doc-ref"
[listeners.tcp]
bind = "0.0.0.0:1883"
[listeners.tls]
bind = "0.0.0.0:8883"
[listeners.ws]
bind = "0.0.0.0:8083"
[listeners.wss]
bind = "0.0.0.0:8084"
[listeners.api]
bind = "0.0.0.0:18083"
[logging]
level = "warn"
Terminal window
python3 - <<'PY'
import os, socket
port = int(os.environ.get("API_PORT", "18083"))
sock = socket.create_connection(("127.0.0.1", port), timeout=5)
sock.sendall(b"GET /healthz HTTP/1.0\r\nHost: docs\r\n\r\n")
print(sock.makefile().read().strip().splitlines()[-1])
PY
OK

Check one documented call. GET /api/v1/nodes answers 200 with its rows. It prints OK.

Terminal window
python3 - <<'PY'
import os, urllib.request
port = os.environ.get("API_PORT", "18083")
key = os.environ.get("API_KEY", "")
base = f"http://127.0.0.1:{port}"
req = urllib.request.Request(base + "/api/v1/nodes", method="GET")
req.add_header("Authorization", f"Bearer {key}")
with urllib.request.urlopen(req, timeout=5) as r:
body = r.read().decode()
assert r.status == 200, body
assert "running" in body or "node_id" in body, body
print("OK")
PY
OK

Next steps