Skip to content

RobustMQ Admin Server HTTP API Common Guide

Overview

RobustMQ Admin Server is an HTTP management interface service, providing comprehensive management capabilities for RobustMQ clusters.

  • Base URL: http://localhost:8080
  • API Prefix: /api (all management interfaces use this prefix)
  • Request Method: Use GET for list/detail queries, POST for create/delete operations
  • Data Format: JSON
  • Response Format: JSON

API Documentation Navigation


Full API URI List

/cluster — Cluster Resource APIs

CategoryMethodURIDescription
ConfigGET/api/cluster/config/getGet cluster configuration
ConfigPOST/api/cluster/config/setUpdate cluster configuration
HealthGET/api/cluster/healthyCluster health check
TenantGET/api/cluster/tenant/listList tenants
TenantPOST/api/cluster/tenant/createCreate tenant
TenantPOST/api/cluster/tenant/updateUpdate tenant
TenantPOST/api/cluster/tenant/deleteDelete tenant
TopicGET/api/cluster/topic/listList topics
TopicGET/api/cluster/topic/detailGet topic detail
TopicPOST/api/cluster/topic/createCreate topic
TopicPOST/api/cluster/topic/deleteDelete topic
TopicGET/api/cluster/topic-rewrite/listList topic rewrite rules
TopicPOST/api/cluster/topic-rewrite/createCreate topic rewrite rule
TopicPOST/api/cluster/topic-rewrite/deleteDelete topic rewrite rule
UserGET/api/cluster/user/listList users
UserPOST/api/cluster/user/createCreate user
UserPOST/api/cluster/user/deleteDelete user
ACLGET/api/cluster/acl/listList ACL rules
ACLPOST/api/cluster/acl/createCreate ACL rule
ACLPOST/api/cluster/acl/deleteDelete ACL rule
BlacklistGET/api/cluster/blacklist/listList blacklist entries
BlacklistPOST/api/cluster/blacklist/createCreate blacklist entry
BlacklistPOST/api/cluster/blacklist/deleteDelete blacklist entry
ConnectorGET/api/cluster/connector/listList connectors
ConnectorGET/api/cluster/connector/detailGet connector detail
ConnectorPOST/api/cluster/connector/createCreate connector
ConnectorPOST/api/cluster/connector/deleteDelete connector
SchemaGET/api/cluster/schema/listList schemas
SchemaPOST/api/cluster/schema/createCreate schema
SchemaPOST/api/cluster/schema/deleteDelete schema
SchemaGET/api/cluster/schema-bind/listList schema bindings
SchemaPOST/api/cluster/schema-bind/createCreate schema binding
SchemaPOST/api/cluster/schema-bind/deleteDelete schema binding
OffsetPOST/api/cluster/offset/timestampQuery offset by timestamp
OffsetPOST/api/cluster/offset/groupQuery offset by consumer group
OffsetPOST/api/cluster/offset/commitCommit offset

/mqtt — MQTT Broker APIs

CategoryMethodURIDescription
OverviewGET/api/mqtt/overviewCluster overview information
MonitorGET/api/mqtt/monitor/dataMonitor data query
ClientGET/api/mqtt/client/listList clients
SessionGET/api/mqtt/session/listList sessions
SubscribeGET/api/mqtt/subscribe/listList subscriptions
SubscribeGET/api/mqtt/subscribe/detailGet subscription detail
SubscribeGET/api/mqtt/auto-subscribe/listList auto-subscribe rules
SubscribePOST/api/mqtt/auto-subscribe/createCreate auto-subscribe rule
SubscribePOST/api/mqtt/auto-subscribe/deleteDelete auto-subscribe rule
SubscribeGET/api/mqtt/slow-subscribe/listList slow subscriptions
FlappingGET/api/mqtt/flapping_detect/listList flapping detection records
AlarmGET/api/mqtt/system-alarm/listList system alarms
AlarmGET/api/mqtt/ban-log/listList ban log entries
MessagePOST/api/mqtt/message/sendSend message
MessagePOST/api/mqtt/message/readRead message

/storage-engine — Storage Engine APIs

CategoryMethodURIDescription
ShardPOST/api/storage-engine/shard/listList shards
ShardPOST/api/storage-engine/shard/createCreate shard
ShardPOST/api/storage-engine/shard/deleteDelete shard
SegmentPOST/api/storage-engine/segment/listList segments

Common APIs

CategoryMethodURIDescription
InfoGET/Get service version information
StatusGET/api/statusCluster status query
HealthGET/health/readyReadiness health check
HealthGET/health/nodeNode health check
HealthGET/health/clusterCluster health check

Common Response Format

Success Response

json
{
  "code": 0,
  "message": "success",
  "data": {...}
}

Error Response

json
{
  "code": 500,
  "message": "error message",
  "data": null
}

Paginated Response Format

json
{
  "code": 0,
  "message": "success",
  "data": {
    "data": [...],
    "total_count": 100
  }
}

Common Request Parameters

Most list query interfaces support the following common parameters:

ParameterTypeRequiredDescription
limitu32NoPage size, default 10000
pageu32NoPage number, starts from 1, default 1
sort_fieldstringNoSort field
sort_bystringNoSort order: asc/desc
filter_fieldstringNoFilter field
filter_valuesarrayNoFilter value list
exact_matchstringNoExact match: true/false

Pagination Parameters Example

json
{
  "limit": 20,
  "page": 1,
  "sort_field": "create_time",
  "sort_by": "desc",
  "filter_field": "status",
  "filter_values": ["active"],
  "exact_match": "false"
}

Basic Interface

Service Version Query

  • Endpoint: GET /
  • Description: Get service version information
  • Request Parameters: None
  • Response Example:
json
"RobustMQ API v0.1.34"

Cluster Status Query

  • Endpoint: GET /api/status
  • Description: Get complete cluster status information, including RobustMQ version, cluster name, start time, broker node list, and Meta cluster Raft state
  • Request Parameters:
json
{}

(empty object)

  • Response Example:
json
{
  "code": 0,
  "data": {
    "version": "0.2.1",
    "cluster_name": "broker-server",
    "start_time": 1760828141,
    "broker_node_list": [
      {
        "roles": ["mqtt-broker"],
        "extend": [],
        "node_id": 1,
        "node_ip": "192.168.100.100",
        "grpc_addr": "192.168.100.100:1228",
        "engine_addr": "192.168.100.100:1229",
        "start_time": 1760828141,
        "register_time": 1760828142,
        "storage_fold": []
      }
    ],
    "nodes": ["192.168.100.100", "127.0.0.1"],
    "meta": {
      "running_state": {
        "Ok": null
      },
      "id": 1,
      "current_term": 1,
      "vote": {
        "leader_id": {
          "term": 1,
          "node_id": 1
        },
        "committed": true
      },
      "last_log_index": 422,
      "last_applied": {
        "leader_id": {
          "term": 1,
          "node_id": 1
        },
        "index": 422
      },
      "snapshot": null,
      "purged": null,
      "state": "Leader",
      "current_leader": 1,
      "millis_since_quorum_ack": 0,
      "last_quorum_acked": 1760828146763525625,
      "membership_config": {
        "log_id": {
          "leader_id": {
            "term": 0,
            "node_id": 0
          },
          "index": 0
        },
        "membership": {
          "configs": [[1]],
          "nodes": {
            "1": {
              "node_id": 1,
              "rpc_addr": "127.0.0.1:1228"
            }
          }
        }
      },
      "heartbeat": {
        "1": 1760828146387602084
      },
      "replication": {
        "1": {
          "leader_id": {
            "term": 1,
            "node_id": 1
          },
          "index": 422
        }
      }
    }
  }
}

Response Fields:

FieldTypeDescription
versionstringRobustMQ version number
cluster_namestringCluster name
start_timeu64Service start time (Unix timestamp in seconds)
broker_node_listarrayList of broker nodes
nodesarrayList of unique node IP addresses in the cluster (deduplicated)
metaobjectMeta cluster Raft state information (structured object)

Broker Node Fields:

FieldTypeDescription
rolesarrayNode role list (e.g., ["mqtt-broker"])
extendarrayExtended information (byte array)
node_idu64Node ID
node_ipstringNode IP address
grpc_addrstringgRPC communication address
engine_addrstringStorage engine address
start_timeu64Node start time (Unix timestamp in seconds)
register_timeu64Node registration time (Unix timestamp in seconds)
storage_foldarrayStorage directory list

Meta Cluster State (meta) Fields:

The meta field contains the Raft consensus state information of the Meta cluster, used to monitor the distributed consistency state:

FieldTypeDescription
running_stateobjectRunning state, {"Ok": null} indicates healthy
idu64Current node ID
current_termu64Raft current term number
voteobjectVote information
vote.leader_idobjectLeader identifier, containing term and node_id
vote.committedbooleanWhether the vote has been committed
last_log_indexu64Index of the last log entry
last_appliedobjectLast applied log information
last_applied.leader_idobjectLeader identifier
last_applied.indexu64Index of applied log
snapshotobject/nullSnapshot information (if exists)
purgedobject/nullPurged log information (if exists)
statestringCurrent node Raft state: Leader, Follower, or Candidate
current_leaderu64Current leader node ID
millis_since_quorum_acku64Milliseconds since last quorum acknowledgment
last_quorum_ackedu128Last quorum acknowledged timestamp (nanosecond precision)
membership_configobjectCluster membership configuration
membership_config.log_idobjectLog ID corresponding to the configuration
membership_config.membershipobjectMembership information
membership_config.membership.configsarrayConfiguration array, e.g., [[1]] represents node 1
membership_config.membership.nodesobjectNode mapping, key is node ID string, value is node info
heartbeatobjectHeartbeat mapping, key is node ID, value is heartbeat timestamp (nanoseconds)
replicationobjectReplication state mapping, key is node ID, value contains leader_id and index

Use Cases:

  • Check if node is Leader using the state field
  • Find the current cluster Leader through current_leader field
  • Monitor log synchronization status via last_log_index and last_applied.index
  • Monitor cluster node activity through heartbeat
  • Understand cluster membership configuration via membership_config

Error Code Description

Error CodeDescription
0Request successful
400Request parameter error
401Unauthorized
403Forbidden
404Resource not found
500Internal server error

Usage Examples

Basic Request Example

bash
# Get service version
curl -X GET http://localhost:8080/

# Get cluster status
curl -X GET http://localhost:8080/api/status

# List query with pagination
curl "http://localhost:8080/api/cluster/user/list?limit=10&page=1&sort_field=username&sort_by=asc"

Error Handling Example

bash
# When request fails, detailed error information is returned
{
  "code": 400,
  "message": "Invalid parameter: username is required",
  "data": null
}

Notes

  1. Request Method:
    • List/detail queries (/list, /detail, /api/status, etc.) use GET, with parameters passed via query string
    • Create/delete operations (/create, /delete) use POST, with parameters passed as JSON body
  2. Request Body: POST interfaces require Content-Type: application/json and a JSON body; GET interfaces pass parameters via URL query string
  3. Time Format:
    • Input time uses Unix timestamp (seconds)
    • Output time uses local time format string "YYYY-MM-DD HH:MM:SS"
  4. Pagination: Page number page starts counting from 1
  5. Configuration Validation: Resource creation validates configuration format correctness
  6. Access Control: It's recommended to add appropriate authentication and authorization mechanisms in production environments
  7. Error Handling: All errors return detailed error information for easy debugging
  8. Content Type: Requests must set the Content-Type: application/json header

Development and Debugging

Start Service

bash
# Start admin-server
cargo run --bin admin-server

# Or use compiled binary
./target/release/admin-server

Test Connection

bash
# Test if service is running normally
curl -X GET http://localhost:8080/

Log Viewing

The service outputs detailed log information during runtime, including:

  • Request paths and parameters
  • Response status and data
  • Error messages and stack traces

Last Updated: 2026-03-21

🎉 既然都登录了 GitHub,不如顺手给我们点个 Star 吧!⭐ 你的支持是我们最大的动力 🚀