Download OpenAPI specification:Download
Describe a plugin according to its release.json
and README.md
.
name required | string Example: emqx_plugin_template-5.0-rc.1 ^[A-Za-z]+[A-Za-z0-9-_.]*$ |
{- "name": "emqx_plugin_template-5.0-rc.1",
- "author": [
- "EMQX Team"
], - "builder": {
- "contact": "emqx-support@emqx.io",
- "name": "EMQX Team",
- "website": "www.emqx.com"
}, - "built_on_otp_release": "24",
- "compatibility": {
- "emqx": "~>5.0"
}, - "git_commit_or_build_date": "2021-12-25",
- "functionality": [
- "Demo"
], - "git_ref": "ddab50fafeed6b1faea70fc9ffd8c700d7e26ec1",
- "metadata_vsn": "0.1.0",
- "rel_vsn": "5.0-rc.1",
- "rel_apps": [
- "emqx_plugin_template-5.0.0",
- "map_sets-1.1.0"
], - "description": "This is an demo plugin description",
- "running_status": [
- {
- "node": "emqx@127.0.0.1",
- "status": "running"
}
], - "readme": "This is an demo plugin."
}
Uninstalls a previously uploaded plugin package.
name required | string Example: emqx_plugin_template-5.0-rc.1 ^[A-Za-z]+[A-Za-z0-9-_.]*$ |
{- "code": "PARAM_ERROR",
- "message": "string"
}
Update plugin config. Config schema defined by user's schema.avsc file.
name required | string Example: emqx_plugin_template-5.0-rc.1 ^[A-Za-z]+[A-Za-z0-9-_.]*$ |
{ }
{- "code": "BAD_CONFIG",
- "message": "string"
}
start/stop a installed plugin.
- start: start the plugin.
- stop: stop the plugin.
name required | string Example: emqx_plugin_template-5.0-rc.1 ^[A-Za-z]+[A-Za-z0-9-_.]*$ |
action required | string Enum: "start" "stop" Action |
{- "code": "NOT_FOUND",
- "message": "string"
}
Plugins are launched in top-down order.
Use POST /plugins/{name}/move
to change the boot order.
[- {
- "name": "emqx_plugin_template-5.0-rc.1",
- "author": [
- "EMQX Team"
], - "builder": {
- "contact": "emqx-support@emqx.io",
- "name": "EMQX Team",
- "website": "www.emqx.com"
}, - "built_on_otp_release": "24",
- "compatibility": {
- "emqx": "~>5.0"
}, - "git_commit_or_build_date": "2021-12-25",
- "functionality": [
- "Demo"
], - "git_ref": "ddab50fafeed6b1faea70fc9ffd8c700d7e26ec1",
- "metadata_vsn": "0.1.0",
- "rel_vsn": "5.0-rc.1",
- "rel_apps": [
- "emqx_plugin_template-5.0.0",
- "map_sets-1.1.0"
], - "description": "This is an demo plugin description",
- "running_status": [
- {
- "node": "emqx@127.0.0.1",
- "status": "running"
}
], - "readme": "This is an demo plugin."
}
]
Setting the boot order of plugins.
name required | string Example: emqx_plugin_template-5.0-rc.1 ^[A-Za-z]+[A-Za-z0-9-_.]*$ |
string or string or string
|
{- "position": "after:emqx_plugin_demo-5.1-rc.2"
}
{- "code": "MOVE_FAILED",
- "message": "string"
}
Upload a plugin tarball (plugin-vsn.tar.gz).Follow emqx-plugin-template to develop plugin.
plugin | string <binary> |
{- "code": "UNEXPECTED_ERROR",
- "message": "string"
}
调整全局认证链上指定认证器的顺序。
id required | string 认证器 ID。由认证方式与数据源组成 |
position required | string Example: before:password_based:built_in_database 认证器在链中的位置。可能的值是 'front', 'rear', 'before:{other_authenticator_id}', 'after:{other_authenticator_id}' |
{- "code": "BAD_REQUEST",
- "message": "string"
}
获取全局认证链上指定认证器中的指定用户数据。
id required | string 认证器 ID。由认证方式与数据源组成 |
user_id required | string 用户 ID,根据设置的账号类型不同,可以是 username 或 clientid |
{- "user_id": "user1"
}
更新全局认证链上指定认证器中的指定用户数据。
id required | string 认证器 ID。由认证方式与数据源组成 |
user_id required | string 用户 ID,根据设置的账号类型不同,可以是 username 或 clientid |
password required | string |
is_superuser | boolean Default: false |
{- "password": "******"
}
{- "regular_user": {
- "value": {
- "user_id": "user1"
}, - "summary": "Regular user"
}, - "super_user": {
- "value": {
- "is_superuser": true,
- "user_id": "user2"
}, - "summary": "Superuser"
}
}
删除全局认证链上指定认证器中的指定用户数据。
id required | string 认证器 ID。由认证方式与数据源组成 |
user_id required | string 用户 ID,根据设置的账号类型不同,可以是 username 或 clientid |
{- "code": "NOT_FOUND",
- "message": "string"
}
为全局认证链上的指定认证器导入用户数据。
id required | string 认证器 ID。由认证方式与数据源组成 |
type required | string Enum: "plain" "hash" Example: type=hash The import file template type, enum with |
Import body
filename | string <binary> |
{- "code": "BAD_REQUEST",
- "message": "string"
}
获取全局认证链上指定认证器中的用户列表。
id required | string 认证器 ID。由认证方式与数据源组成 |
page | integer >= 1 Default: 1 Example: page=1 Page number of the results to fetch. |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 Results per page(max 10000) |
like_user_id | string 使用用户 ID (username 或 clientid)模糊查询。 |
is_superuser | boolean 是否是超级用户。 |
{- "data": [
- {
- "user_id": "user1"
}, - {
- "is_superuser": true,
- "user_id": "user2"
}
], - "meta": {
- "count": 300,
- "limit": 20,
- "page": 0
}
}
向全局认证链上的指定认证器添加用户数据。
id required | string 认证器 ID。由认证方式与数据源组成 |
user_id required | string |
password required | string |
is_superuser | boolean Default: false |
{- "password": "******",
- "user_id": "user1"
}
{- "user_id": "user1"
}
获取全局认证链上指定认证器的指标与状态。
id required | string 认证器 ID。由认证方式与数据源组成 |
{- "status": "connected",
- "node_status": [
- {
- "node": "emqx@172.17.0.2",
- "status": "connected"
}
], - "metrics": {
- "nomatch": 0,
- "total": 0,
- "success": 0,
- "failed": 0,
- "rate": 0,
- "rate_last5m": 0,
- "rate_max": 0
}, - "resource_metrics": {
- "success": 0,
- "matched": 0,
- "failed": 0,
- "rate": 0,
- "rate_last5m": 0,
- "rate_max": 0
}, - "node_error": [ ],
- "node_metrics": [
- {
- "node": "emqx@172.17.0.2",
- "metrics": {
- "nomatch": 0,
- "total": 0,
- "matched": 0,
- "failed": 0,
- "rate": 0,
- "rate_last5m": 0,
- "rate_max": 0
}
}
], - "node_resource_metrics": [
- {
- "node": "emqx@172.17.0.2",
- "metrics": {
- "success": 0,
- "matched": 0,
- "failed": 0,
- "rate": 0,
- "rate_last5m": 0,
- "rate_max": 0
}
}
]
}
获取全局认证链上的指定认证器。emqx_dashboard_error_code_apiemqx_dashboard_error_code_api
id required | string 认证器 ID。由认证方式与数据源组成 |
{- "mechanism": "jwt",
- "secret": "mysecret",
- "algorithm": "hmac-based",
- "secret_base64_encoded": false,
- "use_jwks": false,
- "verify_claims": {
- "username": "${username}"
}
}
更新全局认证链上的指定认证器。
id required | string 认证器 ID。由认证方式与数据源组成 |
mechanism required | string Value: "password_based" 认证方式。 |
backend required | string Value: "ldap" 后端类型。 |
query_timeout | string Default: "5s" LDAP 查询的超时时间。 |
enable | boolean Default: true 设为 |
server required | string 要连接的 IPv4 或 IPv6 地址或主机名。 |
pool_size | integer >= 1 Default: 8 桥接远端服务时使用的连接池大小。 |
username required | string 内部数据库的用户名。 |
password | string <password> 内部数据库密码。 |
base_dn required | string 与基本对象条目(或根)相关的名称。 |
filter | string Default: "(objectClass=mqttUser)" 定义哪些条件必须被依次满足的过滤器 |
request_timeout | string Default: "10s" 设置每个单独请求所使用的最大时间(以毫秒为单位)。 |
object (ldap.ssl) | |
password_attribute | string Default: "userPassword" 指示哪个属性用于表示用户密码。 |
is_superuser_attribute | string Default: "isSuperuser" 指示哪个属性用于表示用户是否为超级用户。 |
{- "mechanism": "jwt",
- "secret": "mysecret",
- "algorithm": "hmac-based",
- "secret_base64_encoded": false,
- "use_jwks": false,
- "verify_claims": {
- "username": "${username}"
}
}
{- "code": "BAD_REQUEST",
- "message": "string"
}
[- {
- "mechanism": "jwt",
- "secret": "mysecret",
- "algorithm": "hmac-based",
- "secret_base64_encoded": false,
- "use_jwks": false,
- "verify_claims": {
- "username": "${username}"
}
}, - {
- "mechanism": "password_based",
- "backend": "built_in_database",
- "password_hash_algorithm": {
- "name": "sha256",
- "salt_position": "suffix"
}, - "user_id_type": "username"
}, - {
- "ssl": {
- "enable": false
}, - "connect_timeout": "5s",
- "mechanism": "password_based",
- "pool_size": 8,
- "body": {
- "password": "${password}",
- "username": "${username}"
}, - "headers": {
- "content-type": "application/json"
}, - "method": "post",
- "backend": "http",
- "request_timeout": "5s",
- "enable_pipelining": 100
}, - {
- "mechanism": "password_based",
- "filter": {
- "username": "${username}"
}, - "server": "127.0.0.1:27017",
- "database": "example",
- "backend": "mongodb",
- "password_hash_algorithm": {
- "name": "sha256",
- "salt_position": "suffix"
}, - "collection": "users",
- "is_superuser_field": "is_superuser",
- "password_hash_field": "password_hash",
- "salt_field": "salt"
}, - {
- "mechanism": "password_based",
- "server": "127.0.0.1:6379",
- "cmd": "HMGET ${username} password_hash salt",
- "database": 0,
- "backend": "redis",
- "password_hash_algorithm": {
- "name": "sha256",
- "salt_position": "suffix"
}, - "redis_type": "single"
}
]
为全局认证链创建认证器。
mechanism required | string Value: "password_based" 认证方式。 |
backend required | string Value: "ldap" 后端类型。 |
query_timeout | string Default: "5s" LDAP 查询的超时时间。 |
enable | boolean Default: true 设为 |
server required | string 要连接的 IPv4 或 IPv6 地址或主机名。 |
pool_size | integer >= 1 Default: 8 桥接远端服务时使用的连接池大小。 |
username required | string 内部数据库的用户名。 |
password | string <password> 内部数据库密码。 |
base_dn required | string 与基本对象条目(或根)相关的名称。 |
filter | string Default: "(objectClass=mqttUser)" 定义哪些条件必须被依次满足的过滤器 |
request_timeout | string Default: "10s" 设置每个单独请求所使用的最大时间(以毫秒为单位)。 |
object (ldap.ssl) | |
password_attribute | string Default: "userPassword" 指示哪个属性用于表示用户密码。 |
is_superuser_attribute | string Default: "isSuperuser" 指示哪个属性用于表示用户是否为超级用户。 |
{- "mechanism": "jwt",
- "secret": "mysecret",
- "algorithm": "hmac-based",
- "secret_base64_encoded": false,
- "use_jwks": false,
- "verify_claims": {
- "username": "${username}"
}
}
{- "mechanism": "jwt",
- "secret": "mysecret",
- "algorithm": "hmac-based",
- "secret_base64_encoded": false,
- "use_jwks": false,
- "verify_claims": {
- "username": "${username}"
}
}
在全局认证链中重新排序所有认证器。
id required | string 认证器 ID。由认证方式与数据源组成 |
[- {
- "id": "password_based:built_in_database"
}
]
{- "code": "BAD_REQUEST",
- "message": "string"
}
启用集群中所有节点上的数据桥接。
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
operation required | string Value: "start" Example: start 集群可用操作:'启动'。 |
{- "code": "BAD_REQUEST",
- "message": "string"
}
启用或禁用集群内所有节点上的数据桥接。
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
enable required | boolean Example: true 是否启用该数据桥接。 |
{- "code": "NOT_FOUND",
- "message": "string"
}
[- {
- "name": "my_http_action",
- "status": "connected",
- "type": "http",
- "enable": true,
- "parameters": {
- "path": "/room/${room_no}",
- "body": "${.}",
- "headers": { },
- "method": "post"
}, - "connector": "my_http_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "resource_opts": {
- "query_mode": "async",
- "health_check_interval": "15s",
- "worker_pool_size": 16
}
}, - {
- "name": "mqtt_action",
- "status": "connected",
- "type": "mqtt",
- "description": "My example mqtt action",
- "enable": true,
- "parameters": {
- "retain": false,
- "payload": "${.payload}",
- "topic": "remote/topic",
- "qos": 2
}, - "connector": "mqtt_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "resource_opts": {
- "health_check_interval": "30s"
}
}
]
通过类型和名称创建一个新的数据桥接。
type required | string Value: "mqtt" |
name required | string |
local_topic | string MQTT 主题或主题过滤器作为数据源(动作输入)。 如果规则动作用作数据源,则应将此配置留空,否则消息将在远程系统中重复。 |
enable | boolean Default: true 是否启用此动作。 |
connector required | string 由动作指定的连接器名称,用于选择外部资源。 |
tags | Array of strings 连接器的标签 |
description | string Default: "" 描述性文本。 |
required | object (bridge_mqtt_publisher.action_parameters) |
object (bridge_mqtt_publisher.action_resource_opts) |
{- "name": "my_http_action",
- "type": "http",
- "enable": true,
- "parameters": {
- "path": "/room/${room_no}",
- "body": "${.}",
- "headers": { },
- "method": "post"
}, - "connector": "my_http_connector",
- "resource_opts": {
- "query_mode": "async",
- "health_check_interval": "15s",
- "worker_pool_size": 16
}
}
{- "name": "my_http_action",
- "status": "connected",
- "type": "http",
- "enable": true,
- "parameters": {
- "path": "/room/${room_no}",
- "body": "${.}",
- "headers": { },
- "method": "post"
}, - "connector": "my_http_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "resource_opts": {
- "query_mode": "async",
- "health_check_interval": "15s",
- "worker_pool_size": 16
}
}
测试创建一个新的数据桥接。
type required | string Value: "mqtt" |
name required | string |
local_topic | string MQTT 主题或主题过滤器作为数据源(动作输入)。 如果规则动作用作数据源,则应将此配置留空,否则消息将在远程系统中重复。 |
enable | boolean Default: true 是否启用此动作。 |
connector required | string 由动作指定的连接器名称,用于选择外部资源。 |
tags | Array of strings 连接器的标签 |
description | string Default: "" 描述性文本。 |
required | object (bridge_mqtt_publisher.action_parameters) |
object (bridge_mqtt_publisher.action_resource_opts) |
{- "name": "my_http_action",
- "type": "http",
- "enable": true,
- "parameters": {
- "path": "/room/${room_no}",
- "body": "${.}",
- "headers": { },
- "method": "post"
}, - "connector": "my_http_connector",
- "resource_opts": {
- "query_mode": "async",
- "health_check_interval": "15s",
- "worker_pool_size": 16
}
}
{- "code": "TEST_FAILED",
- "message": "string"
}
通过 id 获取一个数据桥接
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
{- "name": "my_http_action",
- "status": "connected",
- "type": "http",
- "enable": true,
- "parameters": {
- "path": "/room/${room_no}",
- "body": "${.}",
- "headers": { },
- "method": "post"
}, - "connector": "my_http_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "resource_opts": {
- "query_mode": "async",
- "health_check_interval": "15s",
- "worker_pool_size": 16
}
}
通过 id 更新数据桥接
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
local_topic | string MQTT 主题或主题过滤器作为数据源(动作输入)。 如果规则动作用作数据源,则应将此配置留空,否则消息将在远程系统中重复。 |
enable | boolean Default: true 是否启用此动作。 |
connector required | string 由动作指定的连接器名称,用于选择外部资源。 |
tags | Array of strings 连接器的标签 |
description | string Default: "" 描述性文本。 |
required | object (bridge_mqtt_publisher.action_parameters) |
object (bridge_mqtt_publisher.action_resource_opts) |
{- "enable": true,
- "parameters": {
- "path": "/room/${room_no}",
- "body": "${.}",
- "headers": { },
- "method": "post"
}, - "connector": "my_http_connector",
- "resource_opts": {
- "query_mode": "async",
- "health_check_interval": "15s",
- "worker_pool_size": 16
}
}
{- "name": "my_http_action",
- "status": "connected",
- "type": "http",
- "enable": true,
- "parameters": {
- "path": "/room/${room_no}",
- "body": "${.}",
- "headers": { },
- "method": "post"
}, - "connector": "my_http_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "resource_opts": {
- "query_mode": "async",
- "health_check_interval": "15s",
- "worker_pool_size": 16
}
}
通过 id 删除数据桥接
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
also_delete_dep_actions | boolean Default: false 是否级联删除依赖的动作。 |
{- "rules": [
- "string"
], - "code": "BAD_REQUEST",
- "message": "string"
}
通过 id 来获取数据桥接的指标信息。
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
{- "metrics": {
- "dropped": 0,
- "dropped.other": 0,
- "dropped.queue_full": 0,
- "dropped.resource_not_found": 0,
- "dropped.resource_stopped": 0,
- "matched": 0,
- "queuing": 0,
- "retried": 0,
- "failed": 0,
- "inflight": 0,
- "success": 0,
- "rate": 0,
- "rate_max": 0,
- "rate_last5m": 0,
- "received": 0
}, - "node_metrics": [
- {
- "node": "emqx@127.0.0.1",
- "metrics": {
- "dropped": 0,
- "dropped.other": 0,
- "dropped.queue_full": 0,
- "dropped.resource_not_found": 0,
- "dropped.resource_stopped": 0,
- "matched": 0,
- "queuing": 0,
- "retried": 0,
- "failed": 0,
- "inflight": 0,
- "success": 0,
- "rate": 0,
- "rate_max": 0,
- "rate_last5m": 0,
- "received": 0
}
}
]
}
在某个节点上启动数据桥接。
node required | |
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
operation required | string Value: "start" Example: start 节点可用操作:'启动'。 |
{- "code": "BAD_REQUEST",
- "message": "string"
}
获取 EMQX 状态
aggregate | boolean Calculation aggregate for all nodes |
{- "channels.count": 0,
- "channels.max": 0,
- "connections.count": 0,
- "connections.max": 0,
- "delayed.count": 0,
- "delayed.max": 0,
- "live_connections.count": 0,
- "live_connections.max": 0,
- "cluster_sessions.count": 0,
- "cluster_sessions.max": 0,
- "retained.count": 0,
- "retained.max": 0,
- "sessions.count": 0,
- "sessions.max": 0,
- "suboptions.count": 0,
- "suboptions.max": 0,
- "subscribers.count": 0,
- "subscribers.max": 0,
- "subscriptions.count": 0,
- "subscriptions.max": 0,
- "subscriptions.shared.count": 0,
- "subscriptions.shared.max": 0,
- "topics.count": 0,
- "topics.max": 0
}
当前监控(统计)数据,例如整个集群中的连接数和连接速率。
{- "dropped_msg_rate": 0,
- "sent_msg_rate": 0,
- "persisted_rate": 0,
- "received_msg_rate": 0,
- "transformation_failed_rate": 0,
- "transformation_succeeded_rate": 0,
- "validation_failed_rate": 0,
- "validation_succeeded_rate": 0,
- "disconnected_durable_sessions": 0,
- "subscriptions_durable": 0,
- "subscriptions": 0,
- "topics": 0,
- "connections": 0,
- "live_connections": 0,
- "retained_msg_count": 0,
- "shared_subscriptions": 0
}
节点监控(统计)数据,例如指定节点上的连接数和连接速率。
node required | string Example: emqx@172.17.0.2 EMQX node name. |
{- "dropped_msg_rate": 0,
- "sent_msg_rate": 0,
- "persisted_rate": 0,
- "received_msg_rate": 0,
- "transformation_failed_rate": 0,
- "transformation_succeeded_rate": 0,
- "validation_failed_rate": 0,
- "validation_succeeded_rate": 0,
- "disconnected_durable_sessions": 0,
- "subscriptions_durable": 0,
- "subscriptions": 0,
- "topics": 0,
- "connections": 0,
- "live_connections": 0,
- "node_uptime": 0,
- "retained_msg_count": 0,
- "shared_subscriptions": 0
}
包括连接数/在线连接数、主题数/订阅数、消息流入数、流出数、丢弃数等指标。
node required | string Example: emqx@172.17.0.2 EMQX node name. |
latest | integer >= 1 Example: latest=300 The latest N seconds data. Like 300 for 5 min. |
[- {
- "time_stamp": 0,
- "disconnected_durable_sessions": 0,
- "subscriptions_durable": 0,
- "subscriptions": 0,
- "topics": 0,
- "connections": 0,
- "live_connections": 0,
- "received": 0,
- "sent": 0,
- "validation_succeeded": 0,
- "validation_failed": 0,
- "transformation_succeeded": 0,
- "transformation_failed": 0,
- "dropped": 0,
- "persisted": 0
}
]
包括历史的连接数/在线连接数、主题数/订阅数、消息流入数、流出数、丢弃数指标。
latest | integer >= 1 Example: latest=300 The latest N seconds data. Like 300 for 5 min. |
[- {
- "time_stamp": 0,
- "disconnected_durable_sessions": 0,
- "subscriptions_durable": 0,
- "subscriptions": 0,
- "topics": 0,
- "connections": 0,
- "live_connections": 0,
- "received": 0,
- "sent": 0,
- "validation_succeeded": 0,
- "validation_failed": 0,
- "transformation_succeeded": 0,
- "transformation_failed": 0,
- "dropped": 0,
- "persisted": 0
}
]
开启或者关闭功能,或者设置延迟消息数量上限
enable | boolean Default: true 是否启用 |
max_delayed_messages | integer Default: 0 延迟消息的数量上限(0 代表不限数量) |
{- "enable": true,
- "max_delayed_messages": 0
}
{- "enable": true,
- "max_delayed_messages": 0
}
查看延迟消息
node required | string 消息来源节点 |
msgid required | string 延迟消息 ID |
{- "msgid": 0,
- "node": "string",
- "publish_at": "string",
- "delayed_interval": 1,
- "delayed_remaining": 0,
- "expected_at": "string",
- "topic": "/sys/#",
- "qos": 0,
- "from_clientid": "string",
- "from_username": "string"
}
更新全部主题重写规则
action required | string Enum: "subscribe" "publish" "all" 主题重写在哪种操作上生效: |
source_topic required | string 源主题,客户端业务指定的主题 |
dest_topic required | string 目标主题。 |
re required | string 正则表达式 |
[- {
- "action": "publish",
- "source_topic": "x/#",
- "dest_topic": "z/y/$1",
- "re": "^x/y/(.+)$"
}
]
[- {
- "action": "publish",
- "source_topic": "x/#",
- "dest_topic": "z/y/$1",
- "re": "^x/y/(.+)$"
}
]
获取主题监控数据
topic required | string Example: testtopic/1 主题字符串。注意:URL 路径中的主题字符串必须进行编码 |
{- "topic": "testtopic/1",
- "create_time": "2022-01-14T21:48:47+08:00",
- "reset_time": "2022-01-14T21:48:47+08:00",
- "metrics": {
- "message.dropped.count": 0,
- "message.in.count": 0,
- "message.out.count": 0,
- "message.qos0.in.count": 0,
- "message.qos0.out.count": 0,
- "message.qos1.in.count": 0,
- "message.qos1.out.count": 0,
- "message.qos2.in.count": 0,
- "message.qos2.out.count": 0,
- "message.dropped.rate": 0,
- "message.in.rate": 0,
- "message.out.rate": 0,
- "message.qos0.in.rate": 0,
- "message.qos0.out.rate": 0,
- "message.qos1.in.rate": 0,
- "message.qos1.out.rate": 0,
- "message.qos2.in.rate": 0,
- "message.qos2.out.rate": 0
}
}
[- {
- "topic": "testtopic/1",
- "create_time": "2022-01-14T21:48:47+08:00",
- "reset_time": "2022-01-14T21:48:47+08:00",
- "metrics": {
- "message.dropped.count": 0,
- "message.in.count": 0,
- "message.out.count": 0,
- "message.qos0.in.count": 0,
- "message.qos0.out.count": 0,
- "message.qos1.in.count": 0,
- "message.qos1.out.count": 0,
- "message.qos2.in.count": 0,
- "message.qos2.out.count": 0,
- "message.dropped.rate": 0,
- "message.in.rate": 0,
- "message.out.rate": 0,
- "message.qos0.in.rate": 0,
- "message.qos0.out.rate": 0,
- "message.qos1.in.rate": 0,
- "message.qos1.out.rate": 0,
- "message.qos2.in.rate": 0,
- "message.qos2.out.rate": 0
}
}
]
重置主题监控数据
topic | string 如果不设置主题,则重置所有主题监控数据。 |
action required | string 仅支持 reset 重置数据 |
{- "action": "reset"
}
{- "code": "TOPIC_NOT_FOUND",
- "message": "string"
}
添加主题监控,不支持通配符主题。
topic required | string 主题,不支持通配符 |
{- "topic": "testtopic/1"
}
{- "code": "BAD_REQUEST",
- "message": "string"
}
查看延迟消息列表
page | integer >= 1 Default: 1 Example: page=1 Page number of the results to fetch. |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 Results per page(max 10000) |
{- "data": [
- {
- "msgid": 0,
- "node": "string",
- "publish_at": "string",
- "delayed_interval": 1,
- "delayed_remaining": 0,
- "expected_at": "string",
- "topic": "/sys/#",
- "qos": 0,
- "from_clientid": "string",
- "from_username": "string",
- "payload": "string"
}
], - "meta": {
- "page": 1,
- "limit": 1,
- "count": 0
}
}
Observe/Un-Observe 指定资源
clientid required | string Example: urn:oma:lwm2m:oma:2 |
path required | string Example: path=/3/0/7 |
enable required | boolean Example: enable=true |
{- "code": "CLIENT_NOT_FOUND",
- "message": "string"
}
查看指定资源状态
clientid required | string Example: urn:oma:lwm2m:oma:2 |
path required | string Example: path=/3/0/7 |
action required | string Example: action=discover |
{- "clientid": "urn:oma:lwm2m:oma:2",
- "path": "/3/0/7",
- "action": "discover",
- "codeMsg": "reply_not_received",
- "content": [
- {
- "operations": "E",
- "dataType": "Integer",
- "path": "urn:oma:lwm2m:oma:2",
- "name": "lwm2m-test"
}
]
}
发送读指令到某资源
clientid required | string Example: urn:oma:lwm2m:oma:2 |
path required | string Example: path=/3/0/7 |
{- "code": "CLIENT_NOT_FOUND",
- "message": "string"
}
发送写指令到某资源
clientid required | string Example: urn:oma:lwm2m:oma:2 |
path required | string Example: path=/3/0/7 |
type required | string Enum: "Integer" "Float" "Time" "String" "Boolean" "Opaque" "Objlnk" Example: type=Integer |
value required | string Example: value=123 |
{- "code": "CLIENT_NOT_FOUND",
- "message": "string"
}
在某个节点上停止/重新启动数据桥接。
node required | |
id required | string Example: http:http_example 数据桥接 ID , 格式为 {type}:{name} |
operation required | string Enum: "start" "stop" "restart" Example: start 节点可用操作:停止、重新启动 |
{- "code": "BAD_REQUEST",
- "message": "string"
}
通过给定的 ID 测试创建一个新的桥接。
ID 的格式必须为 ’{type}:{name}”
type required | string Enum: "webhook" "http" 动作的类型 |
name required | string 动作名称,用作动作的可读描述。 |
enable | boolean Default: true 启用或停用动作 |
tags | Array of strings 连接器的标签 |
description | string Default: "" 描述性文本。 |
connect_timeout | string Default: "15s" 连接到 HTTP 服务器的超时时间。 |
retry_interval | string Deprecated |
pool_type | string Default: "random" Enum: "random" "hash" 连接池类型。可以是random、hash之一。 |
pool_size | integer >= 1 Default: 8 连接池大小。 |
enable_pipelining | integer >= 1 Default: 100 一个正整数。是否连续发送 HTTP 请求,当设置为1时,意味着在发送每个 HTTP 请求后,需要等待服务器返回,然后继续发送下一个请求。 |
request | object Deprecated This field is never used, so we deprecated it since 5.3.2. |
object (emqx.ssl_client_opts) | |
url required | string HTTP 动作的 URL。 |
direction | string Deprecated Value: "egress" |
local_topic | string 将要转发到 HTTP 服务器的 MQTT 主题过滤器。所有与 local_topic 匹配的 MQTT 'PUBLISH' 消息都将被转发。 |
method | string Default: "post" Enum: "post" "put" "get" "delete" HTTP 请求的方法。所有可用的方法包括:post、put、get、delete。 |
headers | object Default: {"accept":"application/json","cache-control":"no-cache","connection":"keep-alive","content-type":"application/json","keep-alive":"timeout=5"} HTTP 请求头。 |
body | string HTTP 请求的主体。 |
max_retries | integer >= 0 Default: 2 如果发送请求时出错,最大的重试次数。 |
request_timeout | string Deprecated Default: "15s" HTTP 请求超时时间 |
object (bridge_http.v1_resource_opts) |
{- "name": "http_example",
- "type": "http",
- "ssl": {
- "enable": false
}, - "connect_timeout": "15s",
- "pool_size": 4,
- "enable": true,
- "body": "${payload}",
- "method": "post",
- "max_retries": 3,
- "request_timeout": "15s",
- "pool_type": "random",
- "resource_opts": {
- "max_buffer_bytes": 104857600,
- "inflight_window": 100,
- "query_mode": "async",
- "health_check_interval": 15000,
- "worker_pool_size": 1
}, - "enable_pipelining": 100,
- "local_topic": "emqx_http/#"
}
{- "code": "TEST_FAILED",
- "message": "string"
}
启用或禁用所有节点上的桥接
id required | string Example: http:http_example 数据桥接 ID , 格式为 {type}:{name} |
enable required | boolean Example: true 是否启用桥接 |
{- "code": "BAD_REQUEST",
- "message": "string"
}
通过 Id 来获取桥接的指标信息
id required | string Example: http:http_example 数据桥接 ID , 格式为 {type}:{name} |
{- "metrics": {
- "dropped": 0,
- "dropped.other": 0,
- "dropped.queue_full": 0,
- "dropped.resource_not_found": 0,
- "dropped.resource_stopped": 0,
- "matched": 0,
- "queuing": 0,
- "retried": 0,
- "failed": 0,
- "inflight": 0,
- "success": 0,
- "rate": 0,
- "rate_max": 0,
- "rate_last5m": 0,
- "received": 0
}, - "node_metrics": [
- {
- "node": "emqx@127.0.0.1",
- "metrics": {
- "dropped": 0,
- "dropped.other": 0,
- "dropped.queue_full": 0,
- "dropped.resource_not_found": 0,
- "dropped.resource_stopped": 0,
- "matched": 0,
- "queuing": 0,
- "retried": 0,
- "failed": 0,
- "inflight": 0,
- "success": 0,
- "rate": 0,
- "rate_max": 0,
- "rate_last5m": 0,
- "received": 0
}
}
]
}
通过 Id 获取数据桥接
id required | string Example: http:http_example 数据桥接 ID , 格式为 {type}:{name} |
{- "name": "http_example",
- "type": "http",
- "ssl": {
- "enable": false
}, - "connect_timeout": "15s",
- "pool_size": 4,
- "enable": true,
- "body": "${payload}",
- "method": "post",
- "max_retries": 3,
- "request_timeout": "15s",
- "pool_type": "random",
- "resource_opts": {
- "max_buffer_bytes": 104857600,
- "inflight_window": 100,
- "query_mode": "async",
- "health_check_interval": 15000,
- "worker_pool_size": 1
}, - "enable_pipelining": 100,
- "local_topic": "emqx_http/#"
}
通过 Id 更新数据桥接
id required | string Example: http:http_example 数据桥接 ID , 格式为 {type}:{name} |
enable | boolean Default: true 启用或停用动作 |
tags | Array of strings 连接器的标签 |
description | string Default: "" 描述性文本。 |
connect_timeout | string Default: "15s" 连接到 HTTP 服务器的超时时间。 |
retry_interval | string Deprecated |
pool_type | string Default: "random" Enum: "random" "hash" 连接池类型。可以是random、hash之一。 |
pool_size | integer >= 1 Default: 8 连接池大小。 |
enable_pipelining | integer >= 1 Default: 100 一个正整数。是否连续发送 HTTP 请求,当设置为1时,意味着在发送每个 HTTP 请求后,需要等待服务器返回,然后继续发送下一个请求。 |
request | object Deprecated This field is never used, so we deprecated it since 5.3.2. |
object (emqx.ssl_client_opts) | |
url required | string HTTP 动作的 URL。 |
direction | string Deprecated Value: "egress" |
local_topic | string 将要转发到 HTTP 服务器的 MQTT 主题过滤器。所有与 local_topic 匹配的 MQTT 'PUBLISH' 消息都将被转发。 |
method | string Default: "post" Enum: "post" "put" "get" "delete" HTTP 请求的方法。所有可用的方法包括:post、put、get、delete。 |
headers | object Default: {"accept":"application/json","cache-control":"no-cache","connection":"keep-alive","content-type":"application/json","keep-alive":"timeout=5"} HTTP 请求头。 |
body | string HTTP 请求的主体。 |
max_retries | integer >= 0 Default: 2 如果发送请求时出错,最大的重试次数。 |
request_timeout | string Deprecated Default: "15s" HTTP 请求超时时间 |
object (bridge_http.v1_resource_opts) |
{- "ssl": {
- "enable": false
}, - "connect_timeout": "15s",
- "pool_size": 4,
- "enable": true,
- "body": "${payload}",
- "method": "post",
- "max_retries": 3,
- "request_timeout": "15s",
- "pool_type": "random",
- "resource_opts": {
- "max_buffer_bytes": 104857600,
- "inflight_window": 100,
- "query_mode": "async",
- "health_check_interval": 15000,
- "worker_pool_size": 1
}, - "enable_pipelining": 100,
- "local_topic": "emqx_http/#"
}
{- "name": "http_example",
- "type": "http",
- "ssl": {
- "enable": false
}, - "connect_timeout": "15s",
- "pool_size": 4,
- "enable": true,
- "body": "${payload}",
- "method": "post",
- "max_retries": 3,
- "request_timeout": "15s",
- "pool_type": "random",
- "resource_opts": {
- "max_buffer_bytes": 104857600,
- "inflight_window": 100,
- "query_mode": "async",
- "health_check_interval": 15000,
- "worker_pool_size": 1
}, - "enable_pipelining": 100,
- "local_topic": "emqx_http/#"
}
停止或启用所有节点上的桥接
id required | string Example: http:http_example 数据桥接 ID , 格式为 {type}:{name} |
operation required | string Enum: "start" "stop" "restart" Example: start 集群可用操作:停止、重新启动 |
{- "code": "BAD_REQUEST",
- "message": "string"
}
[- {
- "name": "http_example",
- "type": "http",
- "ssl": {
- "enable": false
}, - "connect_timeout": "15s",
- "pool_size": 4,
- "enable": true,
- "body": "${payload}",
- "method": "post",
- "max_retries": 3,
- "request_timeout": "15s",
- "pool_type": "random",
- "resource_opts": {
- "max_buffer_bytes": 104857600,
- "inflight_window": 100,
- "query_mode": "async",
- "health_check_interval": 15000,
- "worker_pool_size": 1
}, - "enable_pipelining": 100,
- "local_topic": "emqx_http/#"
}, - {
- "name": "mqtt_example",
- "type": "mqtt",
- "keepalive": "300s",
- "ssl": {
- "enable": false
}, - "server": "127.0.0.1:1883",
- "enable": true,
- "password": "******",
- "username": "foo",
- "egress": {
- "local": {
- "topic": "emqx/#"
}, - "remote": {
- "retain": false,
- "payload": "${payload}",
- "topic": "from_emqx/${topic}",
- "qos": "${qos}"
}
}, - "proto_ver": "v4",
- "clean_start": true,
- "retry_interval": "15s",
- "max_inflight": 100,
- "resource_opts": {
- "max_buffer_bytes": 104857600,
- "query_mode": "sync",
- "health_check_interval": "15s"
}, - "ingress": {
- "local": {
- "retain": "${retain}",
- "payload": "${payload}",
- "topic": "from_aws/${topic}",
- "qos": "${qos}"
}, - "remote": {
- "topic": "aws/#",
- "qos": 1
}
}
}
]
通过类型和名字创建数据桥接
type required | string Enum: "webhook" "http" 动作的类型 |
name required | string 动作名称,用作动作的可读描述。 |
enable | boolean Default: true 启用或停用动作 |
tags | Array of strings 连接器的标签 |
description | string Default: "" 描述性文本。 |
connect_timeout | string Default: "15s" 连接到 HTTP 服务器的超时时间。 |
retry_interval | string Deprecated |
pool_type | string Default: "random" Enum: "random" "hash" 连接池类型。可以是random、hash之一。 |
pool_size | integer >= 1 Default: 8 连接池大小。 |
enable_pipelining | integer >= 1 Default: 100 一个正整数。是否连续发送 HTTP 请求,当设置为1时,意味着在发送每个 HTTP 请求后,需要等待服务器返回,然后继续发送下一个请求。 |
request | object Deprecated This field is never used, so we deprecated it since 5.3.2. |
object (emqx.ssl_client_opts) | |
url required | string HTTP 动作的 URL。 |
direction | string Deprecated Value: "egress" |
local_topic | string 将要转发到 HTTP 服务器的 MQTT 主题过滤器。所有与 local_topic 匹配的 MQTT 'PUBLISH' 消息都将被转发。 |
method | string Default: "post" Enum: "post" "put" "get" "delete" HTTP 请求的方法。所有可用的方法包括:post、put、get、delete。 |
headers | object Default: {"accept":"application/json","cache-control":"no-cache","connection":"keep-alive","content-type":"application/json","keep-alive":"timeout=5"} HTTP 请求头。 |
body | string HTTP 请求的主体。 |
max_retries | integer >= 0 Default: 2 如果发送请求时出错,最大的重试次数。 |
request_timeout | string Deprecated Default: "15s" HTTP 请求超时时间 |
object (bridge_http.v1_resource_opts) |
{- "name": "http_example",
- "type": "http",
- "ssl": {
- "enable": false
}, - "connect_timeout": "15s",
- "pool_size": 4,
- "enable": true,
- "body": "${payload}",
- "method": "post",
- "max_retries": 3,
- "request_timeout": "15s",
- "pool_type": "random",
- "resource_opts": {
- "max_buffer_bytes": 104857600,
- "inflight_window": 100,
- "query_mode": "async",
- "health_check_interval": 15000,
- "worker_pool_size": 1
}, - "enable_pipelining": 100,
- "local_topic": "emqx_http/#"
}
{- "name": "http_example",
- "type": "http",
- "ssl": {
- "enable": false
}, - "connect_timeout": "15s",
- "pool_size": 4,
- "enable": true,
- "body": "${payload}",
- "method": "post",
- "max_retries": 3,
- "request_timeout": "15s",
- "pool_type": "random",
- "resource_opts": {
- "max_buffer_bytes": 104857600,
- "inflight_window": 100,
- "query_mode": "async",
- "health_check_interval": 15000,
- "worker_pool_size": 1
}, - "enable_pipelining": 100,
- "local_topic": "emqx_http/#"
}
节点的健康检查 API,返回当前节点状态信息。
如果 EMQX 应用程序已经启动并运行,返回状态代码 200,否则返回 503。
这个 API 是在 v5.0.10 中引入的。GET /status
端点(没有 /api/...
前缀)也是这个端点的一个别名。 这个别名从 v5.0.0 开始就有了。自 v5.0.25 和 e5.0.4 开始,可以通过指定 'format' 参数来得到 JSON 格式的信息。
format | string Default: "text" 指定返回的内容格式。使用 'text'(默认)则返回自由格式的字符串; 'json' 则返回 JSON 格式。 |
获取集群的主题列表,主题列表根据订阅关系生成。
topic | string Topic Name |
node | string Example: node=emqx@172.17.0.2 Node Name |
page | integer >= 1 Default: 1 Example: page=1 Page number of the results to fetch. |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 Results per page(max 10000) |
{- "data": [
- {
- "topic": "string",
- "node": "string",
- "session": "string"
}
], - "meta": {
- "page": 1,
- "limit": 50,
- "count": 0,
- "hasnext": true
}
}
获取指定节点上的统计信息,例如主题数量,连接数量等。
node required | string Example: emqx@127.0.0.1 Node name |
{- "channels.count": 0,
- "channels.max": 0,
- "connections.count": 0,
- "connections.max": 0,
- "delayed.count": 0,
- "delayed.max": 0,
- "live_connections.count": 0,
- "live_connections.max": 0,
- "cluster_sessions.count": 0,
- "cluster_sessions.max": 0,
- "retained.count": 0,
- "retained.max": 0,
- "sessions.count": 0,
- "sessions.max": 0,
- "suboptions.count": 0,
- "suboptions.max": 0,
- "subscribers.count": 0,
- "subscribers.max": 0,
- "subscriptions.count": 0,
- "subscriptions.max": 0,
- "subscriptions.shared.count": 0,
- "subscriptions.shared.max": 0,
- "topics.count": 0,
- "topics.max": 0
}
获取指定节点上的运行指标,例如消息发送数量,收到或发送字节数,认证和授权成功失败次数等。
node required | string Example: emqx@127.0.0.1 Node name |
{- "node": "string",
- "bytes.received": 0,
- "bytes.sent": 0,
- "packets.received": 0,
- "packets.sent": 0,
- "packets.connect.received": 0,
- "packets.connack.sent": 0,
- "packets.connack.error": 0,
- "packets.connack.auth_error": 0,
- "packets.publish.received": 0,
- "packets.publish.sent": 0,
- "packets.publish.inuse": 0,
- "packets.publish.error": 0,
- "packets.publish.auth_error": 0,
- "packets.publish.dropped": 0,
- "packets.puback.received": 0,
- "packets.puback.sent": 0,
- "packets.puback.inuse": 0,
- "packets.puback.missed": 0,
- "packets.pubrec.received": 0,
- "packets.pubrec.sent": 0,
- "packets.pubrec.inuse": 0,
- "packets.pubrec.missed": 0,
- "packets.pubrel.received": 0,
- "packets.pubrel.sent": 0,
- "packets.pubrel.missed": 0,
- "packets.pubcomp.received": 0,
- "packets.pubcomp.sent": 0,
- "packets.pubcomp.inuse": 0,
- "packets.pubcomp.missed": 0,
- "packets.subscribe.received": 0,
- "packets.subscribe.error": 0,
- "packets.subscribe.auth_error": 0,
- "packets.suback.sent": 0,
- "packets.unsubscribe.received": 0,
- "packets.unsubscribe.error": 0,
- "packets.unsuback.sent": 0,
- "packets.pingreq.received": 0,
- "packets.pingresp.sent": 0,
- "packets.disconnect.received": 0,
- "packets.disconnect.sent": 0,
- "packets.auth.received": 0,
- "packets.auth.sent": 0,
- "messages.received": 0,
- "messages.sent": 0,
- "messages.qos0.received": 0,
- "messages.qos0.sent": 0,
- "messages.qos1.received": 0,
- "messages.qos1.sent": 0,
- "messages.qos2.received": 0,
- "messages.qos2.sent": 0,
- "messages.publish": 0,
- "messages.dropped": 0,
- "messages.validation_failed": 0,
- "messages.validation_succeeded": 0,
- "messages.transformation_failed": 0,
- "messages.transformation_succeeded": 0,
- "messages.dropped.await_pubrel_timeout": 0,
- "messages.dropped.no_subscribers": 0,
- "messages.forward": 0,
- "messages.delayed": 0,
- "messages.delivered": 0,
- "messages.acked": 0,
- "messages.persisted": 0,
- "delivery.dropped": 0,
- "delivery.dropped.no_local": 0,
- "delivery.dropped.too_large": 0,
- "delivery.dropped.qos0_msg": 0,
- "delivery.dropped.queue_full": 0,
- "delivery.dropped.expired": 0,
- "client.connect": 0,
- "client.connack": 0,
- "client.connected": 0,
- "client.authenticate": 0,
- "client.auth.anonymous": 0,
- "client.authorize": 0,
- "client.subscribe": 0,
- "client.unsubscribe": 0,
- "client.disconnected": 0,
- "session.created": 0,
- "session.resumed": 0,
- "session.takenover": 0,
- "session.discarded": 0,
- "session.terminated": 0,
- "authorization.allow": 0,
- "authorization.deny": 0,
- "authorization.cache_hit": 0,
- "authorization.cache_miss": 0,
- "authentication.success": 0,
- "authentication.success.anonymous": 0,
- "authentication.failure": 0,
- "overload_protection.delay.ok": 0,
- "overload_protection.delay.timeout": 0,
- "overload_protection.hibernation": 0,
- "overload_protection.gc": 0,
- "overload_protection.new_conn": 0
}
获取指定节点的详细信息。
node required | string Example: emqx@127.0.0.1 Node name |
{- "node": "emqx@127.0.0.1",
- "connections": 0,
- "live_connections": 0,
- "cluster_sessions": 0,
- "load1": 2.66,
- "load5": 2.66,
- "load15": 2.66,
- "max_fds": 1024,
- "memory_total": "512.00M",
- "memory_used": "256.00M",
- "node_status": "running",
- "otp_release": "24.2/12.2",
- "process_available": 2097152,
- "process_used": 1024,
- "uptime": 5120000,
- "version": "5.0.0",
- "edition": "Opensource",
- "sys_path": "path/to/emqx",
- "log_path": "path/to/log | The log path is not yet set",
- "role": "core"
}
[- {
- "node": "emqx@127.0.0.1",
- "connections": 0,
- "live_connections": 0,
- "cluster_sessions": 0,
- "load1": 2.66,
- "load5": 2.66,
- "load15": 2.66,
- "max_fds": 1024,
- "memory_total": "512.00M",
- "memory_used": "256.00M",
- "node_status": "running",
- "otp_release": "24.2/12.2",
- "process_available": 2097152,
- "process_used": 1024,
- "uptime": 5120000,
- "version": "5.0.0",
- "edition": "Opensource",
- "sys_path": "path/to/emqx",
- "log_path": "path/to/log | The log path is not yet set",
- "role": "core"
}
]
查看 Exhook 服务器详细信息
name required | string Example: default Exhook 服务器的名称 |
{- "metrics": {
- "succeed": 0,
- "failed": 0,
- "rate": 0,
- "max_rate": 0
}, - "node_metrics": [
- {
- "node": "string",
- "metrics": {
- "succeed": 0,
- "failed": 0,
- "rate": 0,
- "max_rate": 0
}
}
], - "node_status": [
- {
- "node": "string",
- "status": "connected"
}
], - "hooks": [
- {
- "name": "string",
- "params": {
- "$name": "string"
}
}
], - "name": "default",
- "enable": true,
- "request_timeout": "12m",
- "failed_action": "deny",
- "ssl": {
- "cacertfile": "string",
- "cacerts": false,
- "certfile": "string",
- "keyfile": "string",
- "verify": "verify_peer",
- "reuse_sessions": true,
- "depth": 10,
- "password": "",
- "versions": [
- "tlsv1.3",
- "tlsv1.2"
], - "ciphers": [ ],
- "secure_renegotiate": true,
- "log_level": "emergency",
- "hibernate_after": "12m",
- "enable": false,
- "server_name_indication": "disable"
}, - "socket_options": {
- "keepalive": true,
- "nodelay": true,
- "recbuf": "64KB",
- "sndbuf": "16KB"
}, - "auto_reconnect": "60s",
- "pool_size": 8
}
更新 Exhook 服务器
name required | string Example: default Exhook 服务器的名称 |
name required | string ExHook 服务器名称 |
enable | boolean Default: true 开启这个 Exhook 服务器 |
url required | string gRPC 服务器地址 |
request_timeout | string Default: "5s" gRPC 服务器请求超时 |
failed_action | string Default: "deny" Enum: "deny" "ignore" 当 gRPC 请求失败后的操作 |
object (exhook.ssl_conf) | |
object (exhook.socket_options) | |
string or string Default: "60s" 自动重连到 gRPC 服务器的设置。 | |
pool_size | integer >= 1 Default: 8 gRPC 客户端进程池大小 |
{- "name": "default",
- "ssl": {
- "enable": false,
- "certfile": "/etc/emqx/certs/cert.pem",
- "keyfile": "/etc/emqx/certs/key.pem",
- "cacertfile": "/etc/emqx/certs/cacert.pem"
}, - "pool_size": 8,
- "enable": true,
- "request_timeout": "5s",
- "auto_reconnect": "60s",
- "failed_action": "deny"
}
{- "metrics": {
- "succeed": 0,
- "failed": 0,
- "rate": 0,
- "max_rate": 0
}, - "node_metrics": [
- {
- "node": "string",
- "metrics": {
- "succeed": 0,
- "failed": 0,
- "rate": 0,
- "max_rate": 0
}
}
], - "node_status": [
- {
- "node": "string",
- "status": "connected"
}
], - "hooks": [
- {
- "name": "string",
- "params": {
- "$name": "string"
}
}
], - "name": "default",
- "enable": true,
- "request_timeout": "12m",
- "failed_action": "deny",
- "ssl": {
- "cacertfile": "string",
- "cacerts": false,
- "certfile": "string",
- "keyfile": "string",
- "verify": "verify_peer",
- "reuse_sessions": true,
- "depth": 10,
- "password": "",
- "versions": [
- "tlsv1.3",
- "tlsv1.2"
], - "ciphers": [ ],
- "secure_renegotiate": true,
- "log_level": "emergency",
- "hibernate_after": "12m",
- "enable": false,
- "server_name_indication": "disable"
}, - "socket_options": {
- "keepalive": true,
- "nodelay": true,
- "recbuf": "64KB",
- "sndbuf": "16KB"
}, - "auto_reconnect": "60s",
- "pool_size": 8
}
移动 Exhook 服务器顺序。
注意: 移动的参数只能是:front | rear | before:{name} | after:{name}
name required | string Example: default Exhook 服务器的名称 |
position required | string 移动的方向 |
{- "position": "front"
}
{- "code": "BAD_REQUEST",
- "message": "string"
}
[- {
- "metrics": {
- "succeed": 0,
- "failed": 0,
- "rate": 0,
- "max_rate": 0
}, - "node_metrics": [
- {
- "node": "string",
- "metrics": {
- "succeed": 0,
- "failed": 0,
- "rate": 0,
- "max_rate": 0
}
}
], - "node_status": [
- {
- "node": "string",
- "status": "connected"
}
], - "hooks": [
- {
- "name": "string",
- "params": {
- "$name": "string"
}
}
], - "name": "default",
- "enable": true,
- "request_timeout": "12m",
- "failed_action": "deny",
- "ssl": {
- "cacertfile": "string",
- "cacerts": false,
- "certfile": "string",
- "keyfile": "string",
- "verify": "verify_peer",
- "reuse_sessions": true,
- "depth": 10,
- "password": "",
- "versions": [
- "tlsv1.3",
- "tlsv1.2"
], - "ciphers": [ ],
- "secure_renegotiate": true,
- "log_level": "emergency",
- "hibernate_after": "12m",
- "enable": false,
- "server_name_indication": "disable"
}, - "socket_options": {
- "keepalive": true,
- "nodelay": true,
- "recbuf": "64KB",
- "sndbuf": "16KB"
}, - "auto_reconnect": "60s",
- "pool_size": 8
}
]
添加 ExHook 服务器
name required | string ExHook 服务器名称 |
enable | boolean Default: true 开启这个 Exhook 服务器 |
url required | string gRPC 服务器地址 |
request_timeout | string Default: "5s" gRPC 服务器请求超时 |
failed_action | string Default: "deny" Enum: "deny" "ignore" 当 gRPC 请求失败后的操作 |
object (exhook.ssl_conf) | |
object (exhook.socket_options) | |
string or string Default: "60s" 自动重连到 gRPC 服务器的设置。 | |
pool_size | integer >= 1 Default: 8 gRPC 客户端进程池大小 |
{- "name": "default",
- "ssl": {
- "enable": false,
- "certfile": "/etc/emqx/certs/cert.pem",
- "keyfile": "/etc/emqx/certs/key.pem",
- "cacertfile": "/etc/emqx/certs/cacert.pem"
}, - "pool_size": 8,
- "enable": true,
- "request_timeout": "5s",
- "auto_reconnect": "60s",
- "failed_action": "deny"
}
{- "metrics": {
- "succeed": 0,
- "failed": 0,
- "rate": 0,
- "max_rate": 0
}, - "node_metrics": [
- {
- "node": "string",
- "metrics": {
- "succeed": 0,
- "failed": 0,
- "rate": 0,
- "max_rate": 0
}
}
], - "node_status": [
- {
- "node": "string",
- "status": "connected"
}
], - "hooks": [
- {
- "name": "string",
- "params": {
- "$name": "string"
}
}
], - "name": "default",
- "enable": true,
- "request_timeout": "12m",
- "failed_action": "deny",
- "ssl": {
- "cacertfile": "string",
- "cacerts": false,
- "certfile": "string",
- "keyfile": "string",
- "verify": "verify_peer",
- "reuse_sessions": true,
- "depth": 10,
- "password": "",
- "versions": [
- "tlsv1.3",
- "tlsv1.2"
], - "ciphers": [ ],
- "secure_renegotiate": true,
- "log_level": "emergency",
- "hibernate_after": "12m",
- "enable": false,
- "server_name_indication": "disable"
}, - "socket_options": {
- "keepalive": true,
- "nodelay": true,
- "recbuf": "64KB",
- "sndbuf": "16KB"
}, - "auto_reconnect": "60s",
- "pool_size": 8
}
获取 Exhook 服务器的钩子信息
name required | string Example: default Exhook 服务器的名称 |
[- {
- "name": "string",
- "params": {
- "$name": "string"
}, - "metrics": {
- "succeed": 0,
- "failed": 0,
- "rate": 0,
- "max_rate": 0
}, - "node_metrics": [
- {
- "node": "string",
- "metrics": {
- "succeed": 0,
- "failed": 0,
- "rate": 0,
- "max_rate": 0
}
}
]
}
]
{- "collectors": {
- "mnesia": "disabled",
- "vm_dist": "disabled",
- "vm_memory": "disabled",
- "vm_msacc": "disabled",
- "vm_statistics": "disabled",
- "vm_system_info": "disabled"
}, - "enable_basic_auth": false,
- "push_gateway": {
- "interval": "15s",
- "headers": {
- "Authorization": "Basic YWRtaW46Y2JraG55eWd5QDE="
}, - "job_name": "${name}/instance/${name}~${host}"
}
}
更新 Prometheus 配置
push_gateway_server required | string Default: "http://127.0.0.1:9091" 自5.4.0版本起弃用,改用 |
interval required | string Default: "15s" 自5.4.0版本起弃用,改用 |
headers | object Default: {} 自5.4.0版本起弃用,改用 |
job_name required | string Default: "${name}/instance/${name}~${host}" 自5.4.0版本起弃用,改用 |
enable required | boolean Default: false 自5.4.0版本起弃用,改用 |
vm_dist_collector required | string Default: "disabled" Enum: "disabled" "enabled" 自5.4.0版本起弃用,改用 |
mnesia_collector required | string Default: "disabled" Enum: "enabled" "disabled" 自5.4.0版本起弃用,改用 |
vm_statistics_collector required | string Default: "disabled" Enum: "enabled" "disabled" 自5.4.0版本起弃用,改用 |
vm_system_info_collector required | string Default: "disabled" Enum: "enabled" "disabled" 自5.4.0版本起弃用,改用 |
vm_memory_collector required | string Default: "disabled" Enum: "enabled" "disabled" 自5.4.0版本起弃用,改用 |
vm_msacc_collector required | string Default: "disabled" Enum: "enabled" "disabled" 自5.4.0版本起弃用,改用 |
{- "collectors": {
- "mnesia": "disabled",
- "vm_dist": "disabled",
- "vm_memory": "disabled",
- "vm_msacc": "disabled",
- "vm_statistics": "disabled",
- "vm_system_info": "disabled"
}, - "enable_basic_auth": false,
- "push_gateway": {
- "interval": "15s",
- "headers": {
- "Authorization": "Basic YWRtaW46Y2JraG55eWd5QDE="
}, - "job_name": "${name}/instance/${name}~${host}"
}
}
{- "collectors": {
- "mnesia": "disabled",
- "vm_dist": "disabled",
- "vm_memory": "disabled",
- "vm_msacc": "disabled",
- "vm_statistics": "disabled",
- "vm_system_info": "disabled"
}, - "enable_basic_auth": false,
- "push_gateway": {
- "interval": "15s",
- "headers": {
- "Authorization": "Basic YWRtaW46Y2JraG55eWd5QDE="
}, - "job_name": "${name}/instance/${name}~${host}"
}
}
获取数据集成的 Prometheus 指标
mode | string Default: "node" Enum: "node" "all_nodes_aggregated" "all_nodes_unaggregated" Example: mode=node
|
获取 Prometheus 数据
mode | string Default: "node" Enum: "node" "all_nodes_aggregated" "all_nodes_unaggregated" Example: mode=node
|
获取 AuthN、AuthZ 和 Banned 的 Prometheus 指标
mode | string Default: "node" Enum: "node" "all_nodes_aggregated" "all_nodes_unaggregated" Example: mode=node
|
Update opentelmetry configuration
object (opentelemetry.otel_metrics) | |
object (opentelemetry.otel_logs) | |
object (opentelemetry.otel_traces) | |
object (opentelemetry.otel_exporter) |
{- "metrics": {
- "enable": true
}, - "traces": {
- "filter": {
- "trace_all": false
}, - "enable": true
}, - "logs": {
- "level": "warning",
- "enable": true
}
}
{- "metrics": {
- "enable": true
}, - "traces": {
- "filter": {
- "trace_all": false
}, - "enable": true
}, - "logs": {
- "level": "warning",
- "enable": true
}
}
更新自动订阅主题列表
topic required | string 主题名称,支持占位符。例如:client/${clientid}/username/${username}/host/${host}/port/${port} |
qos | integer [ 0 .. 2 ] Default: 0 默认值 0。消息服务质量。 |
rh | integer [ 0 .. 2 ] Default: 0 默认值为 0。此选项用于指定客户端建立订阅时,服务器是否向客户端转发保留的消息。 |
rap | integer [ 0 .. 1 ] Default: 0 默认值为 0。此选项用于指定服务器在向客户端转发消息时是否保留 RETAIN 标记,而且此选项不影响保留消息中的 RETAIN 标记。因此,当选项 Retain As Publish 设置为 0 时,客户端将直接根据消息中的 RETAIN 标记来区分这是普通的转发消息还是保留消息,而不是判断此消息是否为订阅后首次收到的消息(转发的消息可能在保留消息之前发送,这取决于不同消息服务器的具体实现)。 |
nl | integer [ 0 .. 1 ] Default: 0 默认值为 0。 |
[- {
- "topic": "/clientid/${clientid}/username/${username}/host/${host}/port/${port}",
- "qos": 0,
- "rh": 0,
- "rap": 0,
- "nl": 0
}
]
[- {
- "topic": "/clientid/${clientid}/username/${username}/host/${host}/port/${port}",
- "qos": 0,
- "rh": 0,
- "rap": 0,
- "nl": 0
}
]
获取监听器的认证器配置。
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
id required | string 监听器 ID |
{- "mechanism": "jwt",
- "secret": "mysecret",
- "algorithm": "hmac-based",
- "secret_base64_encoded": false,
- "use_jwks": false,
- "verify_claims": {
- "username": "${username}"
}
}
更新指定监听器的认证器配置,或停用/启用该认证器。
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
id required | string 监听器 ID |
mechanism required | string Value: "password_based" 认证方式。 |
backend required | string Value: "ldap" 后端类型。 |
query_timeout | string Default: "5s" LDAP 查询的超时时间。 |
enable | boolean Default: true 设为 |
server required | string 要连接的 IPv4 或 IPv6 地址或主机名。 |
pool_size | integer >= 1 Default: 8 桥接远端服务时使用的连接池大小。 |
username required | string 内部数据库的用户名。 |
password | string <password> 内部数据库密码。 |
base_dn required | string 与基本对象条目(或根)相关的名称。 |
filter | string Default: "(objectClass=mqttUser)" 定义哪些条件必须被依次满足的过滤器 |
request_timeout | string Default: "10s" 设置每个单独请求所使用的最大时间(以毫秒为单位)。 |
object (ldap.ssl) | |
password_attribute | string Default: "userPassword" 指示哪个属性用于表示用户密码。 |
is_superuser_attribute | string Default: "isSuperuser" 指示哪个属性用于表示用户是否为超级用户。 |
{- "mechanism": "jwt",
- "secret": "mysecret",
- "algorithm": "hmac-based",
- "secret_base64_encoded": false,
- "use_jwks": false,
- "verify_claims": {
- "username": "${username}"
}
}
{- "mechanism": "jwt",
- "secret": "mysecret",
- "algorithm": "hmac-based",
- "secret_base64_encoded": false,
- "use_jwks": false,
- "verify_claims": {
- "username": "${username}"
}
}
移除指定监听器的认证器。
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
id required | string 监听器 ID |
{- "code": "BAD_REQUEST",
- "message": "string"
}
为指定监听器开启认证器以实现客户端认证的能力。
当某一监听器开启认证后,所有连接到该监听器的客户端会使用该认证器进行认证。
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
id required | string 监听器 ID |
mechanism required | string Value: "password_based" 认证方式。 |
backend required | string Value: "ldap" 后端类型。 |
query_timeout | string Default: "5s" LDAP 查询的超时时间。 |
enable | boolean Default: true 设为 |
server required | string 要连接的 IPv4 或 IPv6 地址或主机名。 |
pool_size | integer >= 1 Default: 8 桥接远端服务时使用的连接池大小。 |
username required | string 内部数据库的用户名。 |
password | string <password> 内部数据库密码。 |
base_dn required | string 与基本对象条目(或根)相关的名称。 |
filter | string Default: "(objectClass=mqttUser)" 定义哪些条件必须被依次满足的过滤器 |
request_timeout | string Default: "10s" 设置每个单独请求所使用的最大时间(以毫秒为单位)。 |
object (ldap.ssl) | |
password_attribute | string Default: "userPassword" 指示哪个属性用于表示用户密码。 |
is_superuser_attribute | string Default: "isSuperuser" 指示哪个属性用于表示用户是否为超级用户。 |
{- "mechanism": "jwt",
- "secret": "mysecret",
- "algorithm": "hmac-based",
- "secret_base64_encoded": false,
- "use_jwks": false,
- "verify_claims": {
- "username": "${username}"
}
}
{- "mechanism": "jwt",
- "secret": "mysecret",
- "algorithm": "hmac-based",
- "secret_base64_encoded": false,
- "use_jwks": false,
- "verify_claims": {
- "username": "${username}"
}
}
获取网关监听器列表。该接口会返回监听器所有的配置(包括该监听器上的认证器),同时也会返回该监听器在集群中运行的状态。
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
[- {
- "name": "udp-def",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 10
}, - "type": "udp",
- "bind": "22212",
- "udp_options": {
- "buffer": "10KB",
- "recbuf": "10KB",
- "reuseaddr": true,
- "sndbuf": "10KB",
- "active_n": 100
}, - "node_status": [
- {
- "node": "emqx@127.0.0.1",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 10
}
}
]
}, - {
- "name": "dtls-def",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 10
}, - "type": "dtls",
- "bind": "22213",
- "udp_options": {
- "backlog": 1024,
- "active_n": 100
}, - "node_status": [
- {
- "node": "emqx@127.0.0.1",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 10
}
}
], - "dtls_options": {
- "verify": "verify_none",
- "versions": [
- "dtlsv1.2",
- "dtlsv1"
], - "fail_if_no_peer_cert": false,
- "certfile": "${EMQX_ETC_DIR}/certs/cert.pem",
- "keyfile": "${EMQX_ETC_DIR}/certs/key.pem",
- "cacertfile": "${EMQX_ETC_DIR}/certs/cacert.pem"
}, - "max_connections": 1024000,
- "access_rules": [
- "allow all"
], - "acceptors": 16,
- "max_conn_rate": 1000
}, - {
- "name": "ssl-def",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 10
}, - "type": "ssl",
- "bind": "22211",
- "tcp_options": {
- "backlog": 1024,
- "active_n": 100
}, - "ssl_options": {
- "verify": "verify_none",
- "versions": [
- "tlsv1.3",
- "tlsv1.2",
- "tlsv1.1",
- "tlsv1"
], - "fail_if_no_peer_cert": false,
- "certfile": "${EMQX_ETC_DIR}/certs/cert.pem",
- "keyfile": "${EMQX_ETC_DIR}/certs/key.pem",
- "cacertfile": "${EMQX_ETC_DIR}/certs/cacert.pem"
}, - "node_status": [
- {
- "node": "emqx@127.0.0.1",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 10
}
}
], - "max_connections": 1024000,
- "access_rules": [
- "allow all"
], - "acceptors": 16,
- "max_conn_rate": 1000
}, - {
- "name": "tcp-def",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 10
}, - "type": "tcp",
- "bind": "22210",
- "tcp_options": {
- "buffer": "10KB",
- "high_watermark": "1MB",
- "keepalive": "none",
- "nodelay": false,
- "recbuf": "10KB",
- "reuseaddr": true,
- "send_timeout": "15s",
- "send_timeout_close": true,
- "sndbuf": "10KB",
- "backlog": 1024,
- "active_n": 100
}, - "node_status": [
- {
- "node": "emqx@127.0.0.1",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 10
}
}
], - "max_connections": 1024000,
- "acceptors": 16,
- "max_conn_rate": 1000
}, - {
- "name": "ws-def",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 10
}, - "type": "ws",
- "bind": "33043",
- "tcp_options": {
- "buffer": "10KB",
- "high_watermark": "1MB",
- "keepalive": "none",
- "nodelay": false,
- "recbuf": "10KB",
- "reuseaddr": true,
- "send_timeout": "15s",
- "send_timeout_close": true,
- "sndbuf": "10KB",
- "backlog": 1024,
- "active_n": 100
}, - "node_status": [
- {
- "node": "emqx@127.0.0.1",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 10
}
}
], - "websocket": {
- "path": "/ocpp",
- "compress": false,
- "fail_if_no_subprotocol": true,
- "supported_subprotocols": "ocpp1.6",
- "check_origins": "http://localhost:18083, http://127.0.0.1:18083",
- "check_origin_enable": false,
- "piggyback": "single"
}, - "max_connections": 1024000,
- "acceptors": 16,
- "max_conn_rate": 1000
}, - {
- "name": "ws-ssl-def",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 10
}, - "type": "wss",
- "bind": "33053",
- "tcp_options": {
- "buffer": "10KB",
- "high_watermark": "1MB",
- "keepalive": "none",
- "nodelay": false,
- "recbuf": "10KB",
- "reuseaddr": true,
- "send_timeout": "15s",
- "send_timeout_close": true,
- "sndbuf": "10KB",
- "backlog": 1024,
- "active_n": 100
}, - "ssl_options": {
- "verify": "verify_none",
- "versions": [
- "tlsv1.3",
- "tlsv1.2",
- "tlsv1.1",
- "tlsv1"
], - "fail_if_no_peer_cert": false,
- "certfile": "${EMQX_ETC_DIR}/certs/cert.pem",
- "keyfile": "${EMQX_ETC_DIR}/certs/key.pem",
- "cacertfile": "${EMQX_ETC_DIR}/certs/cacert.pem"
}, - "node_status": [
- {
- "node": "emqx@127.0.0.1",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 10
}
}
], - "websocket": {
- "path": "/ocpp",
- "compress": false,
- "fail_if_no_subprotocol": true,
- "supported_subprotocols": "ocpp1.6",
- "check_origins": "http://localhost:18083, http://127.0.0.1:18083",
- "check_origin_enable": false,
- "piggyback": "single"
}, - "max_connections": 1024000,
- "acceptors": 16,
- "max_conn_rate": 1000
}, - {
- "name": "dtls-psk",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 10
}, - "type": "dtls",
- "bind": "22214",
- "node_status": [
- {
- "node": "emqx@127.0.0.1",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 10
}
}
], - "dtls_options": {
- "verify": "verify_none",
- "ciphers": "RSA-PSK-AES256-GCM-SHA384,RSA-PSK-AES256-CBC-SHA384,RSA-PSK-AES128-GCM-SHA256,RSA-PSK-AES128-CBC-SHA256,RSA-PSK-AES256-CBC-SHA,RSA-PSK-AES128-CBC-SHA",
- "versions": [
- "dtlsv1.2",
- "dtlsv1"
], - "fail_if_no_peer_cert": false,
- "certfile": "${EMQX_ETC_DIR}/certs/cert.pem",
- "keyfile": "${EMQX_ETC_DIR}/certs/key.pem",
- "cacertfile": "${EMQX_ETC_DIR}/certs/cacert.pem",
- "user_lookup_fun": "emqx_tls_psk:lookup"
}, - "max_connections": 1024000,
- "acceptors": 16,
- "max_conn_rate": 1000
}, - {
- "name": "tcp-with-authn",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 10
}, - "type": "tcp",
- "bind": "22215",
- "authentication": {
- "mechanism": "password_based",
- "backend": "built_in_database",
- "password_hash_algorithm": {
- "name": "sha256"
}, - "user_id_type": "username"
}, - "node_status": [
- {
- "node": "emqx@127.0.0.1",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 10
}
}
], - "max_connections": 1024000,
- "acceptors": 16,
- "max_conn_rate": 1000
}
]
为指定网关添加监听器。
注:对于某网关不支持的监听器类型,该接口会返回 400: BAD_REQUEST
。
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
id | string 监听器 ID |
type | string Value: "wss" 监听器类型 |
name | string 监听器名称 |
running | boolean 监听器运行状态 |
acceptors | integer Default: 16 Acceptor 进程池大小。 |
object (emqx.tcp_opts) | |
proxy_protocol | boolean Default: false 如果为 EMQX 部署了反向代理,且在代理处启用了 PROXY 协议以传递客户端真实 IP 时,则需要一并开启此选项,以便 EMQX 从 PROXY 协议标头中提取客户端真实 IP。EMQX 将自动检测 PROXY 协议的版本,支持 V1 和 V2。 |
proxy_protocol_timeout | string Default: "3s" 接收 Proxy Protocol 报文头的超时时间。如果在超时内没有收到 Proxy Protocol 包,EMQX 将关闭 TCP 连接。 |
enable | boolean Default: true 是否启用该监听器。 |
bind | string 监听器绑定的 IP 地址或端口。 |
string or integer Default: 1024 监听器支持的最大连接数。 | |
max_conn_rate | integer Default: 1000 监听器允许的最大连接速率。 |
enable_authn | boolean Default: true 配置 |
mountpoint | string 发布或订阅时,在所有主题前增加前缀字符串。 |
access_rules | Array of strings Default: [] 由字符串规则组成的访问规则列表,以限制或允许某些地址的访问。规则之间存在前后顺序。规则的格式为 |
object (emqx.listener_wss_opts) | |
object (gateway.websocket) |
{- "name": "udp-def",
- "type": "udp",
- "bind": "22212",
- "udp_options": {
- "buffer": "10KB",
- "recbuf": "10KB",
- "reuseaddr": true,
- "sndbuf": "10KB",
- "active_n": 100
}
}
{- "name": "udp-def",
- "type": "udp",
- "bind": "22212",
- "udp_options": {
- "buffer": "10KB",
- "recbuf": "10KB",
- "reuseaddr": true,
- "sndbuf": "10KB",
- "active_n": 100
}
}
获取指定网关监听器的配置。
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
id required | string 监听器 ID |
{- "name": "udp-def",
- "type": "udp",
- "bind": "22212",
- "udp_options": {
- "buffer": "10KB",
- "recbuf": "10KB",
- "reuseaddr": true,
- "sndbuf": "10KB",
- "active_n": 100
}
}
更新某网关监听器的配置。被更新的监听器会执行重启,所有已连接到该监听器上的客户端都会被断开。
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
id required | string 监听器 ID |
id | string 监听器 ID |
type | string Value: "wss" 监听器类型 |
name | string 监听器名称 |
running | boolean 监听器运行状态 |
acceptors | integer Default: 16 Acceptor 进程池大小。 |
object (emqx.tcp_opts) | |
proxy_protocol | boolean Default: false 如果为 EMQX 部署了反向代理,且在代理处启用了 PROXY 协议以传递客户端真实 IP 时,则需要一并开启此选项,以便 EMQX 从 PROXY 协议标头中提取客户端真实 IP。EMQX 将自动检测 PROXY 协议的版本,支持 V1 和 V2。 |
proxy_protocol_timeout | string Default: "3s" 接收 Proxy Protocol 报文头的超时时间。如果在超时内没有收到 Proxy Protocol 包,EMQX 将关闭 TCP 连接。 |
enable | boolean Default: true 是否启用该监听器。 |
bind | string 监听器绑定的 IP 地址或端口。 |
string or integer Default: 1024 监听器支持的最大连接数。 | |
max_conn_rate | integer Default: 1000 监听器允许的最大连接速率。 |
enable_authn | boolean Default: true 配置 |
mountpoint | string 发布或订阅时,在所有主题前增加前缀字符串。 |
access_rules | Array of strings Default: [] 由字符串规则组成的访问规则列表,以限制或允许某些地址的访问。规则之间存在前后顺序。规则的格式为 |
object (emqx.listener_wss_opts) | |
object (gateway.websocket) |
{- "name": "udp-def",
- "type": "udp",
- "bind": "22212",
- "udp_options": {
- "buffer": "10KB",
- "recbuf": "10KB",
- "reuseaddr": true,
- "sndbuf": "10KB",
- "active_n": 100
}
}
{- "name": "udp-def",
- "type": "udp",
- "bind": "22212",
- "udp_options": {
- "buffer": "10KB",
- "recbuf": "10KB",
- "reuseaddr": true,
- "sndbuf": "10KB",
- "active_n": 100
}
}
删除指定监听器。被删除的监听器下所有已连接的客户端都会离线。
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
id required | string 监听器 ID |
{- "code": "BAD_REQUEST",
- "message": "string"
}
获取用户信息(仅支持 built_in_database 类型的认证器)
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
id required | string 监听器 ID |
uid required | string 用户 ID |
{- "regular_user": {
- "value": {
- "user_id": "user1"
}, - "summary": "Regular user"
}, - "super_user": {
- "value": {
- "is_superuser": true,
- "user_id": "user2"
}, - "summary": "Superuser"
}
}
更新用户信息(仅支持 built_in_database 类型的认证器)
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
id required | string 监听器 ID |
uid required | string 用户 ID |
password required | string |
is_superuser | boolean Default: false |
{- "password": "******"
}
{- "regular_user": {
- "value": {
- "user_id": "user1"
}, - "summary": "Regular user"
}, - "super_user": {
- "value": {
- "is_superuser": true,
- "user_id": "user2"
}, - "summary": "Superuser"
}
}
删除用户(仅支持 built_in_database 类型的认证器)
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
id required | string 监听器 ID |
uid required | string 用户 ID |
{- "code": "BAD_REQUEST",
- "message": "string"
}
获取用户列表(仅支持 built_in_database 类型的认证器)
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
id required | string 监听器 ID |
page | integer >= 1 Default: 1 Example: page=1 Page number of the results to fetch. |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 Results per page(max 10000) |
{- "regular_user": {
- "value": {
- "user_id": "user1"
}, - "summary": "Regular user"
}, - "super_user": {
- "value": {
- "is_superuser": true,
- "user_id": "user2"
}, - "summary": "Superuser"
}
}
添加用户(仅支持 built_in_database 类型的认证器)
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
id required | string 监听器 ID |
user_id required | string |
password required | string |
is_superuser | boolean Default: false |
{- "password": "******",
- "user_id": "user1"
}
{- "regular_user": {
- "value": {
- "user_id": "user1"
}, - "summary": "Regular user"
}, - "super_user": {
- "value": {
- "is_superuser": true,
- "user_id": "user2"
}, - "summary": "Superuser"
}
}
Get the sub-configurations under sys_topics
{- "sys_msg_interval": "1m",
- "sys_heartbeat_interval": "30s",
- "sys_event_messages": {
- "client_connected": true,
- "client_disconnected": true,
- "client_subscribed": false,
- "client_unsubscribed": false
}
}
Update the sub-configurations under sys_topics
string or string Default: "1m" 向 | |
string or string Default: "30s" 发送心跳系统消息的间隔时间,它包括: | |
object (emqx.event_names) |
{- "sys_msg_interval": "1m",
- "sys_heartbeat_interval": "30s",
- "sys_event_messages": {
- "client_connected": true,
- "client_disconnected": true,
- "client_subscribed": false,
- "client_unsubscribed": false
}
}
{- "sys_msg_interval": "1m",
- "sys_heartbeat_interval": "30s",
- "sys_event_messages": {
- "client_connected": true,
- "client_disconnected": true,
- "client_subscribed": false,
- "client_unsubscribed": false
}
}
Get the sub-configurations under sysmon
{- "vm": {
- "process_check_interval": "12m",
- "process_high_watermark": "12%",
- "process_low_watermark": "12%",
- "long_gc": "disabled",
- "long_schedule": "240ms",
- "large_heap": "32MB",
- "busy_dist_port": true,
- "busy_port": true
}, - "os": {
- "cpu_check_interval": "12m",
- "cpu_high_watermark": "12%",
- "cpu_low_watermark": "12%",
- "mem_check_interval": "60s",
- "sysmem_high_watermark": "12%",
- "procmem_high_watermark": "12%"
}
}
Update the sub-configurations under sysmon
object (emqx.sysmon_vm) | |
object (emqx.sysmon_os) |
{- "vm": {
- "process_check_interval": "12m",
- "process_high_watermark": "12%",
- "process_low_watermark": "12%",
- "long_gc": "disabled",
- "long_schedule": "240ms",
- "large_heap": "32MB",
- "busy_dist_port": true,
- "busy_port": true
}, - "os": {
- "cpu_check_interval": "12m",
- "cpu_high_watermark": "12%",
- "cpu_low_watermark": "12%",
- "mem_check_interval": "60s",
- "sysmem_high_watermark": "12%",
- "procmem_high_watermark": "12%"
}
}
{- "vm": {
- "process_check_interval": "12m",
- "process_high_watermark": "12%",
- "process_low_watermark": "12%",
- "long_gc": "disabled",
- "long_schedule": "240ms",
- "large_heap": "32MB",
- "busy_dist_port": true,
- "busy_port": true
}, - "os": {
- "cpu_check_interval": "12m",
- "cpu_high_watermark": "12%",
- "cpu_low_watermark": "12%",
- "mem_check_interval": "60s",
- "sysmem_high_watermark": "12%",
- "procmem_high_watermark": "12%"
}
}
{- "mqtt": {
- "idle_timeout": "15s",
- "max_packet_size": "32MB",
- "max_clientid_len": 65535,
- "max_topic_levels": 128,
- "max_topic_alias": 65535,
- "retain_available": true,
- "wildcard_subscription": true,
- "shared_subscription": true,
- "shared_subscription_strategy": "random",
- "exclusive_subscription": false,
- "ignore_loop_deliver": false,
- "strict_mode": false,
- "response_information": "",
- "server_keepalive": "disabled",
- "keepalive_multiplier": 1.5,
- "keepalive_check_interval": "12m",
- "retry_interval": "12m",
- "use_username_as_clientid": false,
- "peer_cert_as_username": "disabled",
- "peer_cert_as_clientid": "disabled",
- "client_attrs_init": [ ],
- "session_expiry_interval": "12m",
- "message_expiry_interval": "infinity",
- "max_awaiting_rel": 100,
- "max_qos_allowed": 0,
- "mqueue_priorities": "disabled",
- "mqueue_default_priority": "highest",
- "mqueue_store_qos0": true,
- "max_mqueue_len": 1000,
- "max_inflight": 32,
- "max_subscriptions": "infinity",
- "upgrade_qos": false,
- "await_rel_timeout": "12m"
}, - "flapping_detect": {
- "enable": false,
- "window_time": "12m",
- "max_count": 15,
- "ban_time": "12m"
}, - "force_shutdown": {
- "enable": true,
- "max_mailbox_size": 1000,
- "max_heap_size": "1024KB"
}, - "force_gc": {
- "enable": true,
- "count": 16000,
- "bytes": "32MB"
}, - "durable_sessions": {
- "enable": false,
- "batch_size": 100,
- "idle_poll_interval": "12m",
- "heartbeat_interval": "12m",
- "session_gc_interval": "12m",
- "session_gc_batch_size": 100,
- "message_retention_period": "12m"
}
}
更新全局默认 zone 的配置
object (emqx.mqtt) | |
object (emqx.flapping_detect) | |
object (emqx.force_shutdown) | |
object (emqx.force_gc) | |
object (emqx.durable_sessions) |
{- "mqtt": {
- "idle_timeout": "15s",
- "max_packet_size": "32MB",
- "max_clientid_len": 65535,
- "max_topic_levels": 128,
- "max_topic_alias": 65535,
- "retain_available": true,
- "wildcard_subscription": true,
- "shared_subscription": true,
- "shared_subscription_strategy": "random",
- "exclusive_subscription": false,
- "ignore_loop_deliver": false,
- "strict_mode": false,
- "response_information": "",
- "server_keepalive": "disabled",
- "keepalive_multiplier": 1.5,
- "keepalive_check_interval": "12m",
- "retry_interval": "12m",
- "use_username_as_clientid": false,
- "peer_cert_as_username": "disabled",
- "peer_cert_as_clientid": "disabled",
- "client_attrs_init": [ ],
- "session_expiry_interval": "12m",
- "message_expiry_interval": "infinity",
- "max_awaiting_rel": 100,
- "max_qos_allowed": 0,
- "mqueue_priorities": "disabled",
- "mqueue_default_priority": "highest",
- "mqueue_store_qos0": true,
- "max_mqueue_len": 1000,
- "max_inflight": 32,
- "max_subscriptions": "infinity",
- "upgrade_qos": false,
- "await_rel_timeout": "12m"
}, - "flapping_detect": {
- "enable": false,
- "window_time": "12m",
- "max_count": 15,
- "ban_time": "12m"
}, - "force_shutdown": {
- "enable": true,
- "max_mailbox_size": 1000,
- "max_heap_size": "1024KB"
}, - "force_gc": {
- "enable": true,
- "count": 16000,
- "bytes": "32MB"
}, - "durable_sessions": {
- "enable": false,
- "batch_size": 100,
- "idle_poll_interval": "12m",
- "heartbeat_interval": "12m",
- "session_gc_interval": "12m",
- "session_gc_batch_size": 100,
- "message_retention_period": "12m"
}
}
{- "mqtt": {
- "idle_timeout": "15s",
- "max_packet_size": "32MB",
- "max_clientid_len": 65535,
- "max_topic_levels": 128,
- "max_topic_alias": 65535,
- "retain_available": true,
- "wildcard_subscription": true,
- "shared_subscription": true,
- "shared_subscription_strategy": "random",
- "exclusive_subscription": false,
- "ignore_loop_deliver": false,
- "strict_mode": false,
- "response_information": "",
- "server_keepalive": "disabled",
- "keepalive_multiplier": 1.5,
- "keepalive_check_interval": "12m",
- "retry_interval": "12m",
- "use_username_as_clientid": false,
- "peer_cert_as_username": "disabled",
- "peer_cert_as_clientid": "disabled",
- "client_attrs_init": [ ],
- "session_expiry_interval": "12m",
- "message_expiry_interval": "infinity",
- "max_awaiting_rel": 100,
- "max_qos_allowed": 0,
- "mqueue_priorities": "disabled",
- "mqueue_default_priority": "highest",
- "mqueue_store_qos0": true,
- "max_mqueue_len": 1000,
- "max_inflight": 32,
- "max_subscriptions": "infinity",
- "upgrade_qos": false,
- "await_rel_timeout": "12m"
}, - "flapping_detect": {
- "enable": false,
- "window_time": "12m",
- "max_count": 15,
- "ban_time": "12m"
}, - "force_shutdown": {
- "enable": true,
- "max_mailbox_size": 1000,
- "max_heap_size": "1024KB"
}, - "force_gc": {
- "enable": true,
- "count": 16000,
- "bytes": "32MB"
}, - "durable_sessions": {
- "enable": false,
- "batch_size": 100,
- "idle_poll_interval": "12m",
- "heartbeat_interval": "12m",
- "session_gc_interval": "12m",
- "session_gc_batch_size": 100,
- "message_retention_period": "12m"
}
}
Update the sub-configurations under alarm
actions | Array of strings Default: ["log","publish"] Items Enum: "log" "publish" 警报激活时触发的动作。 |
size_limit | integer [ 1 .. 3000 ] Default: 1000 支持存储的历史告警的最大数量。当达到最大数量限制时,将删除最老的历史告警以存储新的历史告警。 |
validity_period | string Default: "24h" 历史告警的有效期。从历史告警的激活时间而非取消时间开始计算,如果其存在时间超过了有效期,该告警将被删除。 |
{- "actions": [
- "log",
- "publish"
], - "size_limit": 1000,
- "validity_period": "24h"
}
{- "actions": [
- "log",
- "publish"
], - "size_limit": 1000,
- "validity_period": "24h"
}
Get the sub-configurations under dashboard
{- "listeners": {
- "http": {
- "bind": "0.0.0.0:18083",
- "num_acceptors": 10,
- "max_connections": 512,
- "backlog": 1024,
- "send_timeout": "12m",
- "inet6": false,
- "ipv6_v6only": false,
- "proxy_header": false
}, - "https": {
- "bind": "0.0.0.0:18084",
- "ssl_options": {
- "cacertfile": "${EMQX_ETC_DIR}/certs/cacert.pem",
- "cacerts": false,
- "certfile": "${EMQX_ETC_DIR}/certs/cert.pem",
- "keyfile": "${EMQX_ETC_DIR}/certs/key.pem",
- "verify": "verify_peer",
- "reuse_sessions": true,
- "depth": 10,
- "password": "",
- "versions": [
- "tlsv1.3",
- "tlsv1.2"
], - "ciphers": [ ],
- "secure_renegotiate": true,
- "log_level": "emergency",
- "hibernate_after": "12m",
- "dhfile": "string",
- "honor_cipher_order": true,
- "client_renegotiation": true,
- "handshake_timeout": "12m"
}, - "num_acceptors": 10,
- "max_connections": 512,
- "backlog": 1024,
- "send_timeout": "12m",
- "inet6": false,
- "ipv6_v6only": false,
- "proxy_header": false
}
}, - "token_expired_time": "12m",
- "cors": false,
- "swagger_support": true
}
Update the sub-configurations under dashboard
object (dashboard.listeners) | |
token_expired_time | string Default: "60m" 登录成功返回的 JWT token 过期时间,默认为 60 分钟。 |
cors | boolean Default: false CORS(Cross-Origin Resource Sharing,跨域资源共享)允许服务器响应来自任何来源(域名、协议或端口)的请求,启用后允许另一个域名下的服务直接通过 JavaScript 调用 EMQX REST API。 |
swagger_support | boolean Default: true 启用或禁用对 Swagger API 文档的支持。 |
{- "listeners": {
- "http": {
- "bind": "0.0.0.0:18083",
- "num_acceptors": 10,
- "max_connections": 512,
- "backlog": 1024,
- "send_timeout": "12m",
- "inet6": false,
- "ipv6_v6only": false,
- "proxy_header": false
}, - "https": {
- "bind": "0.0.0.0:18084",
- "ssl_options": {
- "cacertfile": "${EMQX_ETC_DIR}/certs/cacert.pem",
- "cacerts": false,
- "certfile": "${EMQX_ETC_DIR}/certs/cert.pem",
- "keyfile": "${EMQX_ETC_DIR}/certs/key.pem",
- "verify": "verify_peer",
- "reuse_sessions": true,
- "depth": 10,
- "password": "",
- "versions": [
- "tlsv1.3",
- "tlsv1.2"
], - "ciphers": [ ],
- "secure_renegotiate": true,
- "log_level": "emergency",
- "hibernate_after": "12m",
- "dhfile": "string",
- "honor_cipher_order": true,
- "client_renegotiation": true,
- "handshake_timeout": "12m"
}, - "num_acceptors": 10,
- "max_connections": 512,
- "backlog": 1024,
- "send_timeout": "12m",
- "inet6": false,
- "ipv6_v6only": false,
- "proxy_header": false
}
}, - "token_expired_time": "12m",
- "cors": false,
- "swagger_support": true
}
{- "listeners": {
- "http": {
- "bind": "0.0.0.0:18083",
- "num_acceptors": 10,
- "max_connections": 512,
- "backlog": 1024,
- "send_timeout": "12m",
- "inet6": false,
- "ipv6_v6only": false,
- "proxy_header": false
}, - "https": {
- "bind": "0.0.0.0:18084",
- "ssl_options": {
- "cacertfile": "${EMQX_ETC_DIR}/certs/cacert.pem",
- "cacerts": false,
- "certfile": "${EMQX_ETC_DIR}/certs/cert.pem",
- "keyfile": "${EMQX_ETC_DIR}/certs/key.pem",
- "verify": "verify_peer",
- "reuse_sessions": true,
- "depth": 10,
- "password": "",
- "versions": [
- "tlsv1.3",
- "tlsv1.2"
], - "ciphers": [ ],
- "secure_renegotiate": true,
- "log_level": "emergency",
- "hibernate_after": "12m",
- "dhfile": "string",
- "honor_cipher_order": true,
- "client_renegotiation": true,
- "handshake_timeout": "12m"
}, - "num_acceptors": 10,
- "max_connections": 512,
- "backlog": 1024,
- "send_timeout": "12m",
- "inet6": false,
- "ipv6_v6only": false,
- "proxy_header": false
}
}, - "token_expired_time": "12m",
- "cors": false,
- "swagger_support": true
}
Update the sub-configurations under broker
enable_session_registry | boolean Default: true 是否启用 Session Registry |
session_history_retain | string Default: "0s" 保留会话注册历史记录的持续时间。将此值设置为大于 0s 的值会增加内存使用并影响性能。 |
{- "enable_session_registry": true,
- "session_history_retain": "1h"
}
{- "enable_session_registry": true,
- "session_history_retain": "1h"
}
重置(使用 conf_path
参数)指定的配置路径下的值
- 若指定路径的配置有默认值,则使用默认值;
- 若指定路径的配置没有默认值,则返回 HTTP 状态码 400。
rootname required | string Enum: "broker" "log" "sysmon" "sys_topics" "alarm" "dashboard" Example: sysmon |
conf_path | string Example: conf_path=os.sysmem_high_watermark The config path separated by '.' character |
{- "code": "NO_DEFAULT_VALUE",
- "message": "string"
}
获取指定键的所有配置,包括热更新和非热更新项目。
key | string Enum: "actions" "alarm" "api_key" "authentication" "authorization" "auto_subscribe" "banned" "bridges" "cluster" "conn_congestion" "connectors" "crl_cache" "dashboard" "delayed" "durable_storage" "exhook" "flapping_detect" "force_gc" "force_shutdown" "gateway" "limiter" "listeners" "log" "mqtt" "node" "opentelemetry" "overload_protection" "prometheus" "psk_authentication" "retainer" "rewrite" "rpc" "rule_engine" "slow_subs" "sources" "sys_topics" "sysmon" "telemetry" "topic_metrics" Example: key=sysmon |
node | string 指定节点名称。如果未指定,则返回当前 HTTP 请求节点的配置。 |
更新指定建的配置。
mode | string Default: "merge" Enum: "replace" "merge" |
ignore_readonly | boolean Default: false |
{- "code": "UPDATE_FAILED",
- "message": "string"
}
Get the sub-configurations under log
{- "console": {
- "level": "debug",
- "enable": true,
- "formatter": "text",
- "timestamp_format": "auto",
- "time_offset": "system"
}, - "file": {
- "level": "warning"
}, - "throttling": {
- "time_window": "1h"
}
}
Update the sub-configurations under log
object (emqx.console_handler) | |
object or emqx.log_file_handler (object) Default: {"level":"warning"} 输出到文件的日志处理进程列表 | |
object (emqx.log_throttling) |
{- "console": {
- "level": "debug",
- "enable": true,
- "formatter": "text",
- "timestamp_format": "auto",
- "time_offset": "system"
}, - "file": {
- "level": "warning"
}, - "throttling": {
- "time_window": "1h"
}
}
{- "console": {
- "level": "debug",
- "enable": true,
- "formatter": "text",
- "timestamp_format": "auto",
- "time_offset": "system"
}, - "file": {
- "level": "warning"
}, - "throttling": {
- "time_window": "1h"
}
}
获取集群中的会话总数。
默认情况下,仅包括那些未过期的会话。
如果 broker.session_history_retain 配置设置为大于 0 秒的持续时间,
这个计数也将包括在指定保留时间内过期的会话。
通过指定 since 参数,它可以返回在指定时间内过期的会话数。
since | integer >= 0 Default: 0 Example: since=1705391625 Include sessions expired after this time (UNIX Epoch in seconds precision) |
"string"
获取指定客户端的详细信息
clientid required | string |
{- "heap_size": 610,
- "send_msg.dropped.expired": 0,
- "send_oct": 31,
- "recv_msg.qos1": 0,
- "is_persistent": false,
- "send_pkt": 4,
- "clean_start": true,
- "inflight_cnt": 0,
- "node": "emqx@127.0.0.1",
- "send_msg.dropped.queue_full": 0,
- "awaiting_rel_cnt": 0,
- "inflight_max": 32,
- "created_at": "2024-01-01T12:34:56.789+08:00",
- "subscriptions_cnt": 1,
- "mailbox_len": 0,
- "send_cnt": 4,
- "connected": true,
- "ip_address": "127.0.0.1",
- "awaiting_rel_max": 100,
- "recv_msg.qos2": 0,
- "proto_ver": 5,
- "mountpoint": "null",
- "proto_name": "MQTT",
- "durable": false,
- "port": 52571,
- "connected_at": "2024-01-01T12:34:56.789+08:00",
- "enable_authn": true,
- "expiry_interval": 0,
- "username": null,
- "recv_msg": 0,
- "recv_oct": 49,
- "send_msg.dropped.too_large": 0,
- "keepalive": 60,
- "send_msg.qos1": 0,
- "send_msg.qos2": 0,
- "recv_msg.qos0": 0,
- "send_msg.qos0": 0,
- "subscriptions_max": "infinity",
- "mqueue_max": 1000,
- "mqueue_dropped": 0,
- "clientid": "01",
- "is_bridge": false,
- "peerport": 52571,
- "send_msg": 0,
- "listener": "tcp:default",
- "recv_cnt": 4,
- "recv_pkt": 4,
- "recv_msg.dropped": 0,
- "send_msg.dropped": 0,
- "recv_msg.dropped.await_pubrel_timeout": 0,
- "reductions": 6836,
- "mqueue_len": 0
}
批量取消订阅
clientid required | string |
topic | string Topic |
[- {
- "topic": "testtopic/#"
}
]
{- "code": "CLIENTID_NOT_FOUND",
- "message": "string"
}
批量订阅
clientid required | string |
topic required | string Topic |
qos | integer [ 0 .. 2 ] Default: 0 QoS |
nl | integer Default: 0 No Local |
rap | integer Default: 0 Retain as Published |
rh | integer Default: 0 Retain Handling |
[- {
- "topic": "testtopic/#",
- "qos": 0,
- "nl": 0,
- "rap": 0,
- "rh": 0
}
]
[- {
- "node": "emqx@127.0.0.1",
- "topic": "testtopic/1",
- "clientid": "emqx_clientid_xx128cdhfc",
- "qos": 0,
- "nl": 0,
- "rap": 0,
- "rh": 0,
- "durable": false
}
]
订阅
clientid required | string |
topic required | string Topic |
qos | integer [ 0 .. 2 ] Default: 0 QoS |
nl | integer Default: 0 No Local |
rap | integer Default: 0 Retain as Published |
rh | integer Default: 0 Retain Handling |
{- "topic": "testtopic/#",
- "qos": 0,
- "nl": 0,
- "rap": 0,
- "rh": 0
}
{- "node": "emqx@127.0.0.1",
- "topic": "testtopic/1",
- "clientid": "emqx_clientid_xx128cdhfc",
- "qos": 0,
- "nl": 0,
- "rap": 0,
- "rh": 0,
- "durable": false
}
获取客户端消息队列中的消息。
clientid required | string |
payload | string Default: "base64" Enum: "none" "base64" "plain" Client's inflight/mqueue messages payload encoding. If set to |
max_payload_bytes | string Default: "1MB" Example: max_payload_bytes=32MB Client's inflight/mqueue messages payload limit. The total payload size of all messages in the response will not exceed this value. Messages beyond the limit will be silently omitted in the response. The only exception to this rule is when the first message payload is already larger than the limit. In this case, the first message will be returned in the response. |
string or string or string Example: position=none An opaque token that can then be in subsequent requests to get the next chunk of results: "?position={prev_response.meta.position}" | |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 Results per page(max 10000) |
{- "data": [
- {
- "from_clientid": "mqttx_59ac0a87",
- "from_username": "test-user",
- "mqueue_priority": 0,
- "msgid": "000611F460D57FA9F44500000D360002",
- "payload": "eyJmb28iOiAiYmFyIn0=",
- "publish_at": 1709055346487,
- "qos": 0,
- "topic": "t/test"
}
], - "meta": {
- "count": 100,
- "last": "1710785444656449826_10"
}
}
获取客户端未确认消息。
clientid required | string |
payload | string Default: "base64" Enum: "none" "base64" "plain" Client's inflight/mqueue messages payload encoding. If set to |
max_payload_bytes | string Default: "1MB" Example: max_payload_bytes=32MB Client's inflight/mqueue messages payload limit. The total payload size of all messages in the response will not exceed this value. Messages beyond the limit will be silently omitted in the response. The only exception to this rule is when the first message payload is already larger than the limit. In this case, the first message will be returned in the response. |
string or string or string Example: position=none An opaque token that can then be in subsequent requests to get the next chunk of results: "?position={prev_response.meta.position}" | |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 Results per page(max 10000) |
{- "data": [
- {
- "from_clientid": "mqttx_59ac0a87",
- "from_username": "test-user",
- "msgid": "000611F460D57FA9F44500000D360002",
- "payload": "eyJmb28iOiAiYmFyIn0=",
- "publish_at": 1709055346487,
- "qos": 0,
- "topic": "t/test"
}
], - "meta": {
- "count": 100,
- "last": "1710785444656449826"
}
}
取消订阅
clientid required | string |
topic | string Topic |
{- "topic": "testtopic/#"
}
{- "code": "CLIENTID_NOT_FOUND",
- "message": "string"
}
获取指定客户端的订阅列表
clientid required | string |
[- {
- "node": "emqx@127.0.0.1",
- "topic": "testtopic/1",
- "clientid": "emqx_clientid_xx128cdhfc",
- "qos": 0,
- "nl": 0,
- "rap": 0,
- "rh": 0,
- "durable": false
}
]
列出客户端
page | integer >= 1 Default: 1 Example: page=1 Page number of the results to fetch. |
node | string Example: node=emqx@127.0.0.1 Node name |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 Results per page(max 10000) |
username | Array of strings User name, multiple values can be specified by repeating the parameter: username=u1&username=u2 |
ip_address | string Example: ip_address=127.0.0.1 Client's IP address |
conn_state | string Enum: "connected" "idle" "disconnected" The current connection status of the client, the possible values are connected,idle,disconnected |
clean_start | boolean Whether the client uses a new session |
proto_ver | string Client protocol version |
like_clientid | string Fuzzy search |
like_username | string Fuzzy search |
integer or string Search client session creation time by greater than or equal method, rfc3339 or timestamp(millisecond) | |
integer or string Search client session creation time by less than or equal method, rfc3339 or timestamp(millisecond) | |
integer or string Search client connection creation time by greater than or equal method, rfc3339 or timestamp(epoch millisecond) | |
integer or string Search client connection creation time by less than or equal method, rfc3339 or timestamp(millisecond) | |
clientid | Array of strings Client ID, multiple values can be specified by repeating the parameter: clientid=c1&clientid=c2 |
Array of strings or string Default: "all" Comma separated list of client fields to return in the response |
{- "data": [
- {
- "heap_size": 610,
- "send_msg.dropped.expired": 0,
- "send_oct": 31,
- "recv_msg.qos1": 0,
- "is_persistent": false,
- "send_pkt": 4,
- "clean_start": true,
- "inflight_cnt": 0,
- "node": "emqx@127.0.0.1",
- "send_msg.dropped.queue_full": 0,
- "awaiting_rel_cnt": 0,
- "inflight_max": 32,
- "created_at": "2024-01-01T12:34:56.789+08:00",
- "subscriptions_cnt": 1,
- "mailbox_len": 0,
- "send_cnt": 4,
- "connected": true,
- "ip_address": "127.0.0.1",
- "awaiting_rel_max": 100,
- "recv_msg.qos2": 0,
- "proto_ver": 5,
- "mountpoint": "null",
- "proto_name": "MQTT",
- "durable": false,
- "port": 52571,
- "connected_at": "2024-01-01T12:34:56.789+08:00",
- "enable_authn": true,
- "expiry_interval": 0,
- "username": null,
- "recv_msg": 0,
- "recv_oct": 49,
- "send_msg.dropped.too_large": 0,
- "keepalive": 60,
- "send_msg.qos1": 0,
- "send_msg.qos2": 0,
- "recv_msg.qos0": 0,
- "send_msg.qos0": 0,
- "subscriptions_max": "infinity",
- "mqueue_max": 1000,
- "mqueue_dropped": 0,
- "clientid": "01",
- "is_bridge": false,
- "peerport": 52571,
- "send_msg": 0,
- "listener": "tcp:default",
- "recv_cnt": 4,
- "recv_pkt": 4,
- "recv_msg.dropped": 0,
- "send_msg.dropped": 0,
- "recv_msg.dropped.await_pubrel_timeout": 0,
- "reductions": 6836,
- "mqueue_len": 0
}
], - "meta": {
- "count": 1,
- "hasnext": false,
- "limit": 50,
- "page": 1
}
}
测试创建一个新的连接器。
type required | string Value: "mqtt" 连接器的类型。 |
name required | string 连接器的名称 |
enable | boolean Default: true 是否启用该连接器。 |
tags | Array of strings 连接器的标签 |
description | string Default: "" 描述性文本。 |
pool_size | integer >= 1 Default: 8 将发布消息到远程代理的 MQTT 客户端池的大小。 |
object (connector_mqtt.resource_opts) | |
mode | string Deprecated Default: "cluster_shareload" Value: "cluster_shareload" MQTT 动作的模式。 |
server required | string 远程 MQTT 代理的主机和端口 |
clientid_prefix | string 附加到 egress 动作使用的 clientid 前缀(可选)。 |
reconnect_interval | string Deprecated |
proto_ver | string Default: "v4" Enum: "v3" "v4" "v5" MQTT协议版本 |
bridge_mode | boolean Default: false 如果启用桥接模式。 |
username | string MQTT 协议的用户名 |
password | string <password> MQTT 协议的密码 |
clean_start | boolean Default: true 在重新连接到入口动作时是否启动新会话 |
keepalive | string Default: "300s" MQTT Keepalive. Time interval is a string that contains a number followed by time unit: |
retry_interval | string Default: "15s" Message retry interval. Delay for the MQTT bridge to retry sending the QoS1/QoS2 messages in case of ACK not received. Time interval is a string that contains a number followed by time unit: |
max_inflight | integer >= 0 Default: 32 MQTT 协议的最大 inflight(已发送但未确认)消息数 |
object (emqx.ssl_client_opts) |
{- "name": "my_http_connector",
- "type": "http",
- "connect_timeout": "15s",
- "pool_size": 1,
- "enable": true,
- "headers": {
- "content-type": "application/json"
}, - "pool_type": "hash",
- "enable_pipelining": 100
}
{- "code": "TEST_FAILED",
- "message": "string"
}
通过 id 获取一个连接器。
id required | string Example: http:my_http_connector 连接器 id。必须是 {type}:{name} 的格式。 |
{- "name": "my_http_connector",
- "status": "connected",
- "type": "http",
- "connect_timeout": "15s",
- "pool_size": 1,
- "enable": true,
- "headers": {
- "content-type": "application/json"
}, - "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "pool_type": "hash",
- "enable_pipelining": 100
}
通过 id 更新一个连接器。
id required | string Example: http:my_http_connector 连接器 id。必须是 {type}:{name} 的格式。 |
enable | boolean Default: true 是否启用该连接器。 |
tags | Array of strings 连接器的标签 |
description | string Default: "" 描述性文本。 |
pool_size | integer >= 1 Default: 8 将发布消息到远程代理的 MQTT 客户端池的大小。 |
object (connector_mqtt.resource_opts) | |
mode | string Deprecated Default: "cluster_shareload" Value: "cluster_shareload" MQTT 动作的模式。 |
server required | string 远程 MQTT 代理的主机和端口 |
clientid_prefix | string 附加到 egress 动作使用的 clientid 前缀(可选)。 |
reconnect_interval | string Deprecated |
proto_ver | string Default: "v4" Enum: "v3" "v4" "v5" MQTT协议版本 |
bridge_mode | boolean Default: false 如果启用桥接模式。 |
username | string MQTT 协议的用户名 |
password | string <password> MQTT 协议的密码 |
clean_start | boolean Default: true 在重新连接到入口动作时是否启动新会话 |
keepalive | string Default: "300s" MQTT Keepalive. Time interval is a string that contains a number followed by time unit: |
retry_interval | string Default: "15s" Message retry interval. Delay for the MQTT bridge to retry sending the QoS1/QoS2 messages in case of ACK not received. Time interval is a string that contains a number followed by time unit: |
max_inflight | integer >= 0 Default: 32 MQTT 协议的最大 inflight(已发送但未确认)消息数 |
object (emqx.ssl_client_opts) |
{- "connect_timeout": "15s",
- "pool_size": 1,
- "enable": true,
- "headers": {
- "content-type": "application/json"
}, - "pool_type": "hash",
- "enable_pipelining": 100
}
{- "name": "my_http_connector",
- "status": "connected",
- "type": "http",
- "connect_timeout": "15s",
- "pool_size": 1,
- "enable": true,
- "headers": {
- "content-type": "application/json"
}, - "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "pool_type": "hash",
- "enable_pipelining": 100
}
在集群的所有节点上启动连接器。
id required | string Example: http:my_http_connector 连接器 id。必须是 {type}:{name} 的格式。 |
operation required | string Value: "start" Example: start 集群可用操作:'start'。 |
{- "code": "BAD_REQUEST",
- "message": "string"
}
在特定节点上启动连接器。
node required | |
id required | string Example: http:my_http_connector 连接器 id。必须是 {type}:{name} 的格式。 |
operation required | string Value: "start" Example: start 节点可用操作:'start'。 |
{- "code": "BAD_REQUEST",
- "message": "string"
}
在集群的所有节点上启用或禁用连接器。
id required | string Example: http:my_http_connector 连接器 id。必须是 {type}:{name} 的格式。 |
enable required | boolean Example: true 是否启用此连接器。 |
{- "code": "NOT_FOUND",
- "message": "string"
}
[- {
- "name": "my_http_connector",
- "status": "connected",
- "type": "http",
- "connect_timeout": "15s",
- "pool_size": 1,
- "enable": true,
- "headers": {
- "content-type": "application/json"
}, - "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "pool_type": "hash",
- "enable_pipelining": 100
}
]
通过类型和名称创建一个新的连接器。
type required | string Value: "mqtt" 连接器的类型。 |
name required | string 连接器的名称 |
enable | boolean Default: true 是否启用该连接器。 |
tags | Array of strings 连接器的标签 |
description | string Default: "" 描述性文本。 |
pool_size | integer >= 1 Default: 8 将发布消息到远程代理的 MQTT 客户端池的大小。 |
object (connector_mqtt.resource_opts) | |
mode | string Deprecated Default: "cluster_shareload" Value: "cluster_shareload" MQTT 动作的模式。 |
server required | string 远程 MQTT 代理的主机和端口 |
clientid_prefix | string 附加到 egress 动作使用的 clientid 前缀(可选)。 |
reconnect_interval | string Deprecated |
proto_ver | string Default: "v4" Enum: "v3" "v4" "v5" MQTT协议版本 |
bridge_mode | boolean Default: false 如果启用桥接模式。 |
username | string MQTT 协议的用户名 |
password | string <password> MQTT 协议的密码 |
clean_start | boolean Default: true 在重新连接到入口动作时是否启动新会话 |
keepalive | string Default: "300s" MQTT Keepalive. Time interval is a string that contains a number followed by time unit: |
retry_interval | string Default: "15s" Message retry interval. Delay for the MQTT bridge to retry sending the QoS1/QoS2 messages in case of ACK not received. Time interval is a string that contains a number followed by time unit: |
max_inflight | integer >= 0 Default: 32 MQTT 协议的最大 inflight(已发送但未确认)消息数 |
object (emqx.ssl_client_opts) |
{- "name": "my_http_connector",
- "type": "http",
- "connect_timeout": "15s",
- "pool_size": 1,
- "enable": true,
- "headers": {
- "content-type": "application/json"
}, - "pool_type": "hash",
- "enable_pipelining": 100
}
{- "name": "my_http_connector",
- "status": "connected",
- "type": "http",
- "connect_timeout": "15s",
- "pool_size": 1,
- "enable": true,
- "headers": {
- "content-type": "application/json"
}, - "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "pool_type": "hash",
- "enable_pipelining": 100
}
在某个节点上启动数据桥接。
node required | |
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
operation required | string Value: "start" Example: start 节点可用操作:'启动'。 |
{- "code": "BAD_REQUEST",
- "message": "string"
}
[- {
- "name": "mqtt_source",
- "status": "connected",
- "type": "mqtt",
- "description": "My example mqtt source",
- "enable": true,
- "parameters": {
- "topic": "remote/topic",
- "qos": 1
}, - "connector": "mqtt_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "resource_opts": {
- "health_check_interval": "30s"
}
}
]
通过类型和名称创建一个新的数据桥接。
type required | string Value: "mqtt" |
name required | string |
enable | boolean Default: true 是否启用此动作。 |
connector required | string 由动作指定的连接器名称,用于选择外部资源。 |
tags | Array of strings 连接器的标签 |
description | string Default: "" 描述性文本。 |
required | object (bridge_mqtt_publisher.ingress_parameters) |
object (bridge_mqtt_publisher.source_resource_opts) |
{- "name": "mqtt_source",
- "type": "mqtt",
- "description": "My example mqtt source",
- "enable": true,
- "parameters": {
- "topic": "remote/topic",
- "qos": 1
}, - "connector": "mqtt_connector",
- "resource_opts": {
- "health_check_interval": "30s"
}
}
{- "name": "mqtt_source",
- "status": "connected",
- "type": "mqtt",
- "description": "My example mqtt source",
- "enable": true,
- "parameters": {
- "topic": "remote/topic",
- "qos": 1
}, - "connector": "mqtt_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "resource_opts": {
- "health_check_interval": "30s"
}
}
通过 id 获取一个数据桥接
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
{- "name": "mqtt_source",
- "status": "connected",
- "type": "mqtt",
- "description": "My example mqtt source",
- "enable": true,
- "parameters": {
- "topic": "remote/topic",
- "qos": 1
}, - "connector": "mqtt_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "resource_opts": {
- "health_check_interval": "30s"
}
}
通过 id 更新数据桥接
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
enable | boolean Default: true 是否启用此动作。 |
connector required | string 由动作指定的连接器名称,用于选择外部资源。 |
tags | Array of strings 连接器的标签 |
description | string Default: "" 描述性文本。 |
required | object (bridge_mqtt_publisher.ingress_parameters) |
object (bridge_mqtt_publisher.source_resource_opts) |
{- "description": "My example mqtt source",
- "enable": true,
- "parameters": {
- "topic": "remote/topic",
- "qos": 1
}, - "connector": "mqtt_connector",
- "resource_opts": {
- "health_check_interval": "30s"
}
}
{- "name": "mqtt_source",
- "status": "connected",
- "type": "mqtt",
- "description": "My example mqtt source",
- "enable": true,
- "parameters": {
- "topic": "remote/topic",
- "qos": 1
}, - "connector": "mqtt_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "resource_opts": {
- "health_check_interval": "30s"
}
}
通过 id 删除数据桥接
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
also_delete_dep_actions | boolean Default: false 是否级联删除依赖的动作。 |
{- "rules": [
- "string"
], - "code": "BAD_REQUEST",
- "message": "string"
}
启用或禁用集群内所有节点上的数据桥接。
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
enable required | boolean Example: true 是否启用该数据桥接。 |
{- "code": "NOT_FOUND",
- "message": "string"
}
测试创建一个新的数据桥接。
type required | string Value: "mqtt" |
name required | string |
enable | boolean Default: true 是否启用此动作。 |
connector required | string 由动作指定的连接器名称,用于选择外部资源。 |
tags | Array of strings 连接器的标签 |
description | string Default: "" 描述性文本。 |
required | object (bridge_mqtt_publisher.ingress_parameters) |
object (bridge_mqtt_publisher.source_resource_opts) |
{- "name": "mqtt_source",
- "type": "mqtt",
- "description": "My example mqtt source",
- "enable": true,
- "parameters": {
- "topic": "remote/topic",
- "qos": 1
}, - "connector": "mqtt_connector",
- "resource_opts": {
- "health_check_interval": "30s"
}
}
{- "code": "TEST_FAILED",
- "message": "string"
}
通过 id 来获取数据桥接的指标信息。
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
{- "metrics": {
- "dropped": 0,
- "dropped.other": 0,
- "dropped.queue_full": 0,
- "dropped.resource_not_found": 0,
- "dropped.resource_stopped": 0,
- "matched": 0,
- "queuing": 0,
- "retried": 0,
- "failed": 0,
- "inflight": 0,
- "success": 0,
- "rate": 0,
- "rate_max": 0,
- "rate_last5m": 0,
- "received": 0
}, - "node_metrics": [
- {
- "node": "emqx@127.0.0.1",
- "metrics": {
- "dropped": 0,
- "dropped.other": 0,
- "dropped.queue_full": 0,
- "dropped.resource_not_found": 0,
- "dropped.resource_stopped": 0,
- "matched": 0,
- "queuing": 0,
- "retried": 0,
- "failed": 0,
- "inflight": 0,
- "success": 0,
- "rate": 0,
- "rate_max": 0,
- "rate_last5m": 0,
- "received": 0
}
}
]
}
启用集群中所有节点上的数据桥接。
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
operation required | string Value: "start" Example: start 集群可用操作:'启动'。 |
{- "code": "BAD_REQUEST",
- "message": "string"
}
{- "emqx_version": "5.0.0-beta.3-32d1547c",
- "license": {
- "edition": "opensource"
}, - "os_name": "Linux",
- "os_version": "20.04",
- "otp_version": "24",
- "up_time": 20220113,
- "uuid": "AAAAAAAA-BBBB-CCCC-2022-DDDDEEEEFFF",
- "nodes_uuid": [
- "AAAAAAAA-BBBB-CCCC-2022-DDDDEEEEFFF",
- "ZZZZZZZZ-CCCC-BBBB-2022-DDDDEEEEFFF"
], - "active_plugins": [
- "Plugin A",
- "Plugin B"
], - "active_modules": [
- "Module A",
- "Module B"
], - "num_clients": 20220113,
- "messages_received": 2022,
- "messages_sent": 2022
}
{- "node": "emqx@127.0.0.1",
- "size": 22740,
- "filename": "emqx-export-2023-11-23-19-13-19.043.tar.gz",
- "created_at": "2023-11-23T19:13:19+02:00",
- "created_at_sec": 1700759599
}
Import a data backup file
node | string Node name |
filename required | string Data backup file name |
{- "node": "emqx@127.0.0.1",
- "filename": "emqx-export-2023-11-23-19-13-19.043.tar.gz"
}
{- "code": "BAD_REQUEST",
- "message": "string"
}
List backup files
page | integer >= 1 Default: 1 Example: page=1 Page number of the results to fetch. |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 Results per page(max 10000) |
{- "data": [
- {
- "node": "emqx@127.0.0.1",
- "size": 22740,
- "filename": "emqx-export-2023-09-02-11-11-33.012.tar.gz",
- "created_at": "2023-09-02T11:11:33+02:00",
- "created_at_sec": 1693645893
}, - {
- "node": "emqx@127.0.0.1",
- "size": 22740,
- "filename": "emqx-export-2023-11-23-19-13-19.043.tar.gz",
- "created_at": "2023-11-23T19:13:19+02:00",
- "created_at_sec": 1700759599
}
], - "meta": {
- "count": 300,
- "limit": 20,
- "page": 0
}
}
向一个节点发送加入集群的邀请,但不等待加入结果。加入状态可以通过 GET api/<version>/invitation
获取。
node required | string Example: emqx2@127.0.0.1 node name |
{- "code": "BAD_REQUEST",
- "message": "string"
}
邀请节点加入集群
node required | string Example: emqx2@127.0.0.1 node name |
timeout | integer >= 0 Timeout in milliseconds |
{- "timeout": "15000"
}
{- "code": "BAD_REQUEST",
- "message": "string"
}
{- "succeed": [
- {
- "node": "emqx2@127.0.0.1",
- "started_at": "2024-01-30T15:24:39.355+08:00",
- "finished_at": "2024-01-30T15:24:39.355+08:00"
}
], - "in_progress": [
- {
- "node": "emqx2@127.0.0.1",
- "started_at": "2024-01-30T15:24:39.355+08:00"
}
], - "failed": [
- {
- "node": "emqx2@127.0.0.1",
- "started_at": "2024-01-30T15:24:39.355+08:00",
- "finished_at": "2024-01-30T15:24:39.355+08:00",
- "reason": "Bad RPC to target node"
}
]
}
获取客户端信息
clientid required | string 客户端 ID |
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" 网关名称 |
{- "recv_oct": 56,
- "mailbox_len": 0,
- "inflight_cnt": 0,
- "send_msg": 0,
- "disconnected_at": null,
- "keepalive": 0,
- "node": "emqx@127.0.0.1",
- "send_cnt": 1,
- "proto_ver": "1.0",
- "awaiting_rel_max": "infinity",
- "is_bridge": false,
- "mqueue_len": 0,
- "recv_msg": 0,
- "proto_name": "LwM2M",
- "mqueue_max": "infinity",
- "send_oct": 61,
- "expiry_interval": 0,
- "created_at": "2021-12-07T10:44:02.721+08:00",
- "heap_size": 4185,
- "clean_start": true,
- "connected_at": "2021-12-07T10:44:02.721+08:00",
- "send_pkt": 1,
- "recv_pkt": 1,
- "port": 50675,
- "ip_address": "127.0.0.1",
- "lifetime": 86400,
- "endpoint_name": "urn:imei:154928475237123",
- "awaiting_rel_cnt": 0,
- "inflight_max": "infinity",
- "subscriptions_cnt": 0,
- "clientid": "MzAyMzEzNTUwNzk1NDA1MzYyMzIwNzUxNjQwMTY1NzQ0NjE",
- "subscriptions_max": "infinity",
- "username": "guest",
- "connected": true,
- "mqueue_dropped": 0,
- "reductions": 72022,
- "recv_cnt": 1
}
获取某客户端的主题订阅列表
clientid required | string 客户端 ID |
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" 网关名称 |
[- {
- "nl": 0,
- "topic": "test/topic",
- "qos": 1,
- "rap": 0,
- "rh": 0
}
]
为某客户端新增订阅关系
clientid required | string 客户端 ID |
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" 网关名称 |
topic | string 主题过滤器或主题名称 |
qos | integer QoS 等级,枚举:0,1,2 |
nl | integer No Local 选项,枚举:0,1 |
rap | integer Retain as Published 选项,枚举:0,1 |
rh | integer Retain Handling 选项,枚举:0,1,2 |
object (emqx_gateway_api_clients.extra_sub_props) |
{- "nl": 0,
- "topic": "test/topic",
- "qos": 1,
- "rap": 0,
- "rh": 0
}
{- "nl": 0,
- "topic": "test/topic",
- "qos": 1,
- "rap": 0,
- "rh": 0
}
为某客户端删除某订阅关系
topic required | string 主题过滤器或主题名称 |
clientid required | string 客户端 ID |
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" 网关名称 |
{- "code": "BAD_REQUEST",
- "message": "string"
}
获取指定网关的客户端列表
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" 网关名称 |
node | string 匹配客户端的节点名称 |
clientid | string 匹配客户端 ID |
username | string 匹配客户端 Username |
ip_address | string 匹配客户端 IP 地址 |
conn_state | string 匹配客户端连接状态 |
proto_ver | string 匹配客户端协议版本 |
clean_start | boolean 匹配客户端 |
like_clientid | string 子串匹配客户端 ID |
like_username | string 子串匹配 客户端 Username |
integer or string 匹配会话创建时间大于等于指定值的客户端 | |
integer or string 匹配会话创建时间小于等于指定值的客户端 | |
integer or string 匹配连接创建时间大于等于指定值的客户端 | |
integer or string 匹配连接创建时间小于等于指定值的客户端 | |
endpoint_name | string 匹配 LwM2M 客户端 Endpoint Name |
like_endpoint_name | string 子串匹配 LwM2M 客户端 Endpoint Name |
gte_lifetime | string 匹配心跳时间大于等于指定值的 LwM2M 客户端 |
lte_lifetime | string 匹配心跳时间小于等于指定值的 LwM2M 客户端 |
page | integer >= 1 Default: 1 Example: page=1 Page number of the results to fetch. |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 Results per page(max 10000) |
{- "data": [
- {
- "node": "string",
- "clientid": "string",
- "username": "string",
- "mountpoint": "string",
- "proto_name": "string",
- "proto_ver": "string",
- "ip_address": "string",
- "port": 0,
- "is_bridge": true,
- "connected_at": 1640995200000,
- "disconnected_at": 1640995200000,
- "connected": true,
- "keepalive": 0,
- "clean_start": true,
- "expiry_interval": 0,
- "created_at": 1640995200000,
- "subscriptions_cnt": 0,
- "subscriptions_max": 0,
- "inflight_cnt": 0,
- "inflight_max": 0,
- "mqueue_len": 0,
- "mqueue_max": 0,
- "mqueue_dropped": 0,
- "awaiting_rel_cnt": 0,
- "awaiting_rel_max": 0,
- "recv_oct": 0,
- "recv_cnt": 0,
- "recv_pkt": 0,
- "recv_msg": 0,
- "send_oct": 0,
- "send_cnt": 0,
- "send_pkt": 0,
- "send_msg": 0,
- "mailbox_len": 0,
- "heap_size": 0,
- "reductions": 0
}
], - "meta": {
- "page": 1,
- "limit": 50,
- "count": 0,
- "hasnext": true
}
}
批量发布多条消息。
可能的 HTTP 状态码如下:
200: 所有的消息都被成功发送到至少一个订阅。
202: 至少有一个消息没有匹配到任何订阅。
400: 至少有一个消息编码错误,如非法主题,或 QoS 超出范围等。
503: 至少有一个小因为服务重启的原因导致转发失败。
请求的 Body 或者 Body 中包含的某个消息无法通过 API 规范的类型检查时,HTTP 响应的消息与发布单个消息的 API
/publish
是一样的。
如果所有的消息都是合法的,那么 HTTP 返回的内容是一个 JSON 数组,每个元素代表了该消息转发的状态。
payload_encoding | string Default: "plain" Enum: "plain" "base64" MQTT 消息体的编码方式,可以是 |
topic required | string 主题 |
qos | integer [ 0 .. 2 ] Default: 0 QoS |
clientid | string Deprecated |
payload required | string MQTT 消息体. |
object (emqx_mgmt_api_publish.message_properties) | |
retain | boolean Default: false 保留消息,布尔型字段,用于表示该消息是否是保留消息。 |
[- {
- "payload_encoding": "plain",
- "topic": "api/example/topic",
- "qos": 0,
- "clientid": "string",
- "payload": "hello emqx api",
- "properties": {
- "payload_format_indicator": 0,
- "message_expiry_interval": 0,
- "response_topic": "some_other_topic",
- "correlation_data": "string",
- "user_properties": {
- "foo": "bar"
}, - "content_type": "text/plain"
}, - "retain": false
}
]
[- {
- "id": "string"
}
]
发布单条信息。
可能的 HTTP 状态码如下:
200: 消息被成功发送到至少一个订阅。
202: 没有匹配到任何订阅。
400: 消息编码错误,如非法主题,或 QoS 超出范围等。
503: 服务重启等过程中导致转发失败。
payload_encoding | string Default: "plain" Enum: "plain" "base64" MQTT 消息体的编码方式,可以是 |
topic required | string 主题 |
qos | integer [ 0 .. 2 ] Default: 0 QoS |
clientid | string Deprecated |
payload required | string MQTT 消息体. |
object (emqx_mgmt_api_publish.message_properties) | |
retain | boolean Default: false 保留消息,布尔型字段,用于表示该消息是否是保留消息。 |
{- "payload_encoding": "plain",
- "topic": "api/example/topic",
- "qos": 0,
- "clientid": "string",
- "payload": "hello emqx api",
- "properties": {
- "payload_format_indicator": 0,
- "message_expiry_interval": 0,
- "response_topic": "some_other_topic",
- "correlation_data": "string",
- "user_properties": {
- "foo": "bar"
}, - "content_type": "text/plain"
}, - "retain": false
}
{- "id": "string"
}
测试一个规则
rule_engine.ctx_message_transformation_failed (object) or rule_engine.ctx_schema_validation_failed (object) or rule_engine.ctx_delivery_dropped (object) or rule_engine.ctx_bridge_mqtt (object) or rule_engine.ctx_check_authn_complete (object) or rule_engine.ctx_check_authz_complete (object) or rule_engine.ctx_connack (object) or rule_engine.ctx_disconnected (object) or rule_engine.ctx_connected (object) or rule_engine.ctx_dropped (object) or rule_engine.ctx_acked (object) or rule_engine.ctx_delivered (object) or rule_engine.ctx_unsub (object) or rule_engine.ctx_sub (object) or rule_engine.ctx_pub (object) Default: {} 测试事件的上下文 | |
sql required | string 测试的 SQL |
{- "context": { },
- "sql": "string"
}
{- "code": "BAD_REQUEST",
- "message": "string"
}
依据指定的消息内容和运行环境执行相应的规则。
id required | string Example: my_rule_id |
rule_engine.ctx_message_transformation_failed (object) or rule_engine.ctx_schema_validation_failed (object) or rule_engine.ctx_delivery_dropped (object) or rule_engine.ctx_bridge_mqtt (object) or rule_engine.ctx_check_authn_complete (object) or rule_engine.ctx_check_authz_complete (object) or rule_engine.ctx_connack (object) or rule_engine.ctx_disconnected (object) or rule_engine.ctx_connected (object) or rule_engine.ctx_dropped (object) or rule_engine.ctx_acked (object) or rule_engine.ctx_delivered (object) or rule_engine.ctx_unsub (object) or rule_engine.ctx_sub (object) or rule_engine.ctx_pub (object) Default: {} 测试事件的上下文 | |
stop_action_after_template_rendering | boolean Default: true 如果操作在模板渲染后应该停止,请将此设置为 true(默认为 true)。 |
{- "context": { },
- "stop_action_after_template_rendering": true
}
{- "code": "BAD_REQUEST",
- "message": "string"
}
列出所有规则
enable | boolean 根据规则是否开启条件过滤 |
from | string 根据规则来源 Topic 过滤, 需要完全匹配 |
like_id | string 根据规则 id 过滤, 使用子串模糊匹配 |
like_from | string 根据规则来源 Topic 过滤, 使用子串模糊匹配 |
like_description | string 根据规则描述过滤, 使用子串模糊匹配 |
match_from | string 根据规则来源 Topic 过滤, 使用 MQTT Topic 匹配 |
page | integer >= 1 Default: 1 Example: page=1 Page number of the results to fetch. |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 Results per page(max 10000) |
{- "data": [
- {
- "id": "293fb66f",
- "from": "t/#",
- "created_at": "2021-12-01T15:00:43.153+08:00",
- "name": "foo",
- "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1",
- "actions": [
- "webhook:my_webhook",
- {
- "args": {
- "payload": "${payload}",
- "topic": "t/1"
}, - "function": "republish"
}, - {
- "function": "console"
}
], - "enable": true,
- "description": "Some description",
- "metadata": { }
}
], - "meta": {
- "page": 1,
- "limit": 50,
- "count": 0,
- "hasnext": true
}
}
通过指定 ID 创建规则
name | string Default: "" 规则名字 |
sql required | string 用于处理消息的 SQL 。 |
Array of rule_engine.user_provided_function (object) or rule_engine.builtin_action_console (object) or rule_engine.builtin_action_republish (object) or strings Default: [] 规则的动作列表。 | |
enable | boolean Default: true 启用或禁用规则引擎 |
description | string Default: "" 规则的描述 |
metadata | object 规则的元数据,不要手动修改 |
{- "name": "foo",
- "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1",
- "actions": [
- "webhook:my_webhook",
- {
- "args": {
- "payload": "${payload}",
- "topic": "t/1"
}, - "function": "republish"
}, - {
- "function": "console"
}
], - "enable": true,
- "description": "Some description",
- "metadata": { }
}
{- "id": "293fb66f",
- "from": "t/#",
- "created_at": "2021-12-01T15:00:43.153+08:00",
- "name": "foo",
- "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1",
- "actions": [
- "webhook:my_webhook",
- {
- "args": {
- "payload": "${payload}",
- "topic": "t/1"
}, - "function": "republish"
}, - {
- "function": "console"
}
], - "enable": true,
- "description": "Some description",
- "metadata": { }
}
通过给定的 Id 获得规则的指标数据
id required | string Example: my_rule_id |
{- "id": "293fb66f",
- "metrics": {
- "matched": 0,
- "matched.rate": 0,
- "matched.rate.max": 0,
- "matched.rate.last5m": 0,
- "passed": 0,
- "failed": 0,
- "failed.exception": 0,
- "failed.unknown": 0,
- "actions.total": 0,
- "actions.success": 0,
- "actions.failed": 0,
- "actions.failed.out_of_service": 0,
- "actions.failed.unknown": 0
}, - "node_metrics": [
- {
- "node": "emqx@127.0.0.1",
- "matched": 0,
- "matched.rate": 0,
- "matched.rate.max": 0,
- "matched.rate.last5m": 0,
- "passed": 0,
- "failed": 0,
- "failed.exception": 0,
- "failed.unknown": 0,
- "actions.total": 0,
- "actions.success": 0,
- "actions.failed": 0,
- "actions.failed.out_of_service": 0,
- "actions.failed.unknown": 0
}
]
}
通过 ID 查询规则
id required | string Example: my_rule_id |
{- "id": "293fb66f",
- "from": "t/#",
- "created_at": "2021-12-01T15:00:43.153+08:00",
- "name": "foo",
- "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1",
- "actions": [
- "webhook:my_webhook",
- {
- "args": {
- "payload": "${payload}",
- "topic": "t/1"
}, - "function": "republish"
}, - {
- "function": "console"
}
], - "enable": true,
- "description": "Some description",
- "metadata": { }
}
通过 ID 更新集群里所有节点上的规则
id required | string Example: my_rule_id |
name | string Default: "" 规则名字 |
sql required | string 用于处理消息的 SQL 。 |
Array of rule_engine.user_provided_function (object) or rule_engine.builtin_action_console (object) or rule_engine.builtin_action_republish (object) or strings Default: [] 规则的动作列表。 | |
enable | boolean Default: true 启用或禁用规则引擎 |
description | string Default: "" 规则的描述 |
metadata | object 规则的元数据,不要手动修改 |
{- "name": "foo",
- "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1",
- "actions": [
- "webhook:my_webhook",
- {
- "args": {
- "payload": "${payload}",
- "topic": "t/1"
}, - "function": "republish"
}, - {
- "function": "console"
}
], - "enable": true,
- "description": "Some description",
- "metadata": { }
}
{- "id": "293fb66f",
- "from": "t/#",
- "created_at": "2021-12-01T15:00:43.153+08:00",
- "name": "foo",
- "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1",
- "actions": [
- "webhook:my_webhook",
- {
- "args": {
- "payload": "${payload}",
- "topic": "t/1"
}, - "function": "republish"
}, - {
- "function": "console"
}
], - "enable": true,
- "description": "Some description",
- "metadata": { }
}
更新规则引擎配置。
ignore_sys_message | boolean Default: true 当设置为“true”(默认)时,规则引擎将忽略发布到 $SYS 主题的消息。 |
jq_function_default_timeout | string Default: "10s" 规则引擎内建函数 |
{- "ignore_sys_message": true,
- "jq_function_default_timeout": "32s"
}
{- "ignore_sys_message": true,
- "jq_function_default_timeout": "32s"
}
更新指定网关的基础配置、和启用的状态。
注:认证、和监听器的配置更新需参考对应的 API 接口。
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
enable required | boolean Example: true 是否开启此网关 |
{- "code": "NOT_FOUND",
- "message": "string"
}
该接口会返回指定或所有网关的概览状态,
包括当前状态、连接数、监听器状态等。
status | string Enum: "running" "stopped" "unloaded" Example: status=running 通过网关状态筛选 |
[- {
- "name": "coap",
- "status": "unloaded"
}, - {
- "name": "exproto",
- "status": "unloaded"
}, - {
- "name": "lwm2m",
- "status": "running",
- "started_at": "2021-12-08T14:41:26.202+08:00",
- "node_status": [
- {
- "node": "node@127.0.0.1",
- "status": "running",
- "max_connections": 1024000,
- "current_connections": 0
}
], - "listeners": [
- {
- "id": "lwm2m:udp:default",
- "name": "default",
- "running": true,
- "type": "udp"
}
], - "max_connections": 1024000,
- "created_at": "2021-12-08T14:41:26.171+08:00",
- "current_connections": 0
}, - {
- "name": "mqttsn",
- "status": "stopped",
- "node_status": [
- {
- "node": "node@127.0.0.1",
- "status": "running",
- "max_connections": 1024000,
- "current_connections": 0
}
], - "listeners": [
- {
- "id": "mqttsn:udp:default",
- "name": "default",
- "running": false,
- "type": "udp"
}
], - "max_connections": 1024000,
- "created_at": "2021-12-08T14:41:45.071+08:00",
- "stopped_at": "2021-12-08T14:56:35.576+08:00",
- "current_connections": 0
}, - {
- "name": "stomp",
- "status": "running",
- "started_at": "2021-12-08T14:42:15.274+08:00",
- "node_status": [
- {
- "node": "node@127.0.0.1",
- "status": "running",
- "max_connections": 1024000,
- "current_connections": 0
}
], - "listeners": [
- {
- "id": "stomp:tcp:default",
- "name": "default",
- "running": true,
- "type": "tcp"
}
], - "max_connections": 1024000,
- "created_at": "2021-12-08T14:42:15.272+08:00",
- "current_connections": 0
}
]
获取网关配置详情
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
{- "name": "coap",
- "enable": true,
- "heartbeat": "30s",
- "listeners": [
- {
- "name": "default",
- "type": "udp",
- "bind": "5683",
- "max_connections": 1024000,
- "max_conn_rate": 1000
}
], - "idle_timeout": "30s",
- "mountpoint": "coap/",
- "enable_stats": true,
- "connection_required": false,
- "notify_type": "qos",
- "publish_qos": "coap",
- "subscribe_qos": "coap"
}
更新指定网关的基础配置、和启用的状态。
注:认证、和监听器的配置更新需参考对应的 API 接口。
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
object (gateway.stomp_frame) | |
mountpoint | string Default: "" 发布或订阅时,在所有主题前增加前缀字符串。 |
enable | boolean Default: true 是否启用该网关 |
enable_stats | boolean Default: true 是否开启客户端统计 |
idle_timeout | string Default: "30s" 客户端连接过程的空闲时间。该配置用于: |
object (gateway.clientinfo_override) |
{- "enable": true,
- "heartbeat": "30s",
- "idle_timeout": "30s",
- "mountpoint": "coap2/",
- "enable_stats": true,
- "connection_required": false,
- "notify_type": "qos",
- "publish_qos": "coap",
- "subscribe_qos": "coap"
}
{- "code": "BAD_REQUEST",
- "message": "string"
}
下载指定 trace 的日志文件
name required | string Example: EMQX-TRACE-1 [a-zA-Z0-9-_] |
node | string Example: node=emqx@127.0.0.1 指定从哪个节点获取 trace 文件内容。 |
{- "code": "NOT_FOUND",
- "message": "string"
}
[- {
- "name": "EMQX-TRACE-1",
- "type": "clientid",
- "topic": "/dev/#",
- "clientid": "dev-001",
- "ip_address": "127.0.0.1",
- "ruleid": "my_rule",
- "status": "running",
- "payload_encode": "hex",
- "start_at": "2021-11-04T18:17:38+08:00",
- "end_at": "2021-11-05T18:17:38+08:00",
- "log_size": [
- {
- "node": "emqx@127.0.0.1",
- "size": 1024
}
], - "formatter": "text"
}
]
创建 trace
name required | string 日志追踪的唯一名字。只允许使用小写字母 a-z、大写字母 A-Z、数字 0-9 和下划线 '_'。 |
type required | string Enum: "clientid" "topic" "ip_address" "ruleid" 过滤器类型 |
topic | string 如果过滤器类型为 'topic' 则该字段可以指定用于匹配的 MQTT 主题或主题过滤器。 |
clientid | string 如果过滤器类型为 'clientid' 则该字段可以指定用于匹配的 MQTT 客户端 ID。 |
ip_address | string 如果过滤器类型为 'ip_address' 则该字段可以指定用于匹配的客户端 IP 地址。 |
ruleid | string |
payload_encode | string Default: "text" Enum: "hex" "text" "hidden" Determine the format of the payload format in the trace file. |
integer or string rfc3339 或者 epoch 时间戳格式 | |
integer or string rfc3339 或者 epoch 时间戳格式 | |
string or string 用于格式化追踪日志条目的格式处理器。设置为 text 将日志条目格式化为纯文本(默认)。设置为 json 将每个日志条目格式化为 JSON 对象。 |
{- "name": "EMQX-TRACE-1",
- "type": "clientid",
- "topic": "/dev/#",
- "clientid": "dev-001",
- "ip_address": "127.0.0.1",
- "ruleid": "my_rule",
- "payload_encode": "hex",
- "start_at": "2021-11-04T18:17:38+08:00",
- "end_at": "2021-11-05T18:17:38+08:00",
- "formatter": "text"
}
{- "name": "EMQX-TRACE-1",
- "type": "clientid",
- "topic": "/dev/#",
- "clientid": "dev-001",
- "ip_address": "127.0.0.1",
- "ruleid": "my_rule",
- "status": "running",
- "payload_encode": "hex",
- "start_at": "2021-11-04T18:17:38+08:00",
- "end_at": "2021-11-05T18:17:38+08:00",
- "log_size": [
- {
- "node": "emqx@127.0.0.1",
- "size": 1024
}
], - "formatter": "text"
}
查看 trace
name required | string Example: EMQX-TRACE-1 [a-zA-Z0-9-_] |
bytes | integer [ 0 .. 2147483647 ] Default: 1000 单个 HTTP 相应中包含 trace 日志的字节数。 |
position | integer Default: 0 指定从该偏移量开始读取指定的 trace 日志文件。 |
node | string Example: node=emqx@127.0.0.1 指定从哪个节点获取 trace 文件内容。 |
{- "items": "TEXT-LOG-ITEMS",
- "meta": {
- "bytes": 1000,
- "position": 0
}
}
停止指定的 trace
name required | string Example: EMQX-TRACE-1 [a-zA-Z0-9-_] |
{- "name": "EMQX-TRACE-1",
- "type": "clientid",
- "topic": "/dev/#",
- "clientid": "dev-001",
- "ip_address": "127.0.0.1",
- "ruleid": "my_rule",
- "status": "running",
- "payload_encode": "hex",
- "start_at": "2021-11-04T18:17:38+08:00",
- "end_at": "2021-11-05T18:17:38+08:00",
- "log_size": [
- {
- "node": "emqx@127.0.0.1",
- "size": 1024
}
], - "formatter": "text"
}
创建 Dashboard 用户
username | string <= 100 characters Dashboard 用户名 |
password | string <= 100 characters Dashboard 密码 |
description | string Dashboard 用户备注 |
{- "username": "admin",
- "password": "public",
- "description": "administrator"
}
{- "username": "admin",
- "description": "administrator",
- "backend": "local"
}
登录成功后返回 Dashboard 认证 Token。
username | string <= 100 characters Dashboard 用户名 |
password | string <= 100 characters Dashboard 密码 |
{- "username": "admin",
- "password": "public"
}
{- "token": "string",
- "version": "5.0.0",
- "license": {
- "edition": "opensource"
}
}
更新 Dashboard 用户备注
username required | string Example: admin Dashboard 用户名 |
description | string Dashboard 用户备注 |
{- "description": "administrator"
}
{- "username": "admin",
- "description": "administrator",
- "backend": "local"
}
更改 Dashboard 用户密码
username required | string Example: admin Dashboard 用户名 |
old_pwd | string 旧密码 |
new_pwd | string 新密码 |
{- "old_pwd": "string",
- "new_pwd": "string"
}
{- "code": "BAD_REQUEST",
- "message": "string"
}
Dashboard 用户退出登录
username | string <= 100 characters Dashboard 用户名 |
{- "username": "admin"
}
{- "code": "BAD_USERNAME_OR_PWD",
- "message": "string"
}
列出所有节点上的指定类型的监听器
type | string Enum: "tcp" "ssl" "ws" "wss" "quic" Example: type=tcp Listener type |
[- {
- "id": "tcp:demo",
- "name": "demo",
- "status": {
- "running": true,
- "max_connections": 2048000,
- "current_connections": 201
}, - "type": "tcp",
- "bind": "0.0.0.0:1884",
- "number": 2,
- "enable": true,
- "node_status": [
- {
- "node": "emqx@127.0.0.1",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 100
}
}, - {
- "node": "emqx@127.0.0.1",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 101
}
}
], - "acceptors": 16
}, - {
- "id": "tcp:default",
- "name": "default",
- "status": {
- "running": true,
- "max_connections": "infinity",
- "current_connections": 501
}, - "type": "tcp",
- "bind": "0.0.0.0:1883",
- "number": 2,
- "enable": true,
- "node_status": [
- {
- "node": "emqx@127.0.0.1",
- "status": {
- "running": true,
- "max_connections": "infinity",
- "current_connections": 200
}
}, - {
- "node": "emqx@127.0.0.1",
- "status": {
- "running": true,
- "max_connections": "infinity",
- "current_connections": 301
}
}
], - "acceptors": 32
}
]
在所有节点上创建指定的监听器
type required | string Value: "quic" Listener type |
running | boolean Listener status |
name required | string Listener name |
current_connections | integer >= 0 Current connections |
ciphers | Array of strings Default: ["TLS_AES_256_GCM_SHA384","TLS_AES_128_GCM_SHA256","TLS_CHACHA20_POLY1305_SHA256"] 此配置保存由逗号分隔的 TLS 密码套件名称,或作为字符串数组。例如 |
object (emqx.listener_quic_ssl_opts) | |
enable | boolean Default: true 启停监听器。 |
bind required | string Default: 14567 监听套接字的 IP 地址和端口。 |
acceptors | integer >= 1 Default: 16 监听器接收池的大小。 |
integer or string Default: "infinity" 监听器允许的最大并发连接数。 | |
mountpoint | string Default: "" 发布或订阅时,请在所有主题前面加上 mountpoint 字符串。 |
zone | string Default: "default" 监听器所属的配置 zone。 |
enable_authn | string Default: true Enum: true false "quick_deny_anonymous" 配置为 |
max_conn_rate | string Default: "infinity" 用于限制当前监听器接受连接的速率。一旦达到限制,EMQX 将暂停从 Accept 队列获取连接,从而推迟或拒绝新的连接。 |
messages_rate | string 用于限制单个客户端每秒可以向 EMQX 发送的消息数。一旦达到限制,EMQX 将暂停从接收缓冲区读取数据,从而使发送方减速甚至暂时挂起。 |
bytes_rate | string 用于限制单个客户端每秒可以向 EMQX 发送的字节数。一旦达到限制,EMQX 将暂停从接收缓冲区读取数据,从而使发送方减速甚至暂时挂起。 |
{- "name": "demo",
- "running": true,
- "type": "tcp",
- "bind": "0.0.0.0:1884",
- "tcp_options": {
- "buffer": "4KB",
- "high_watermark": "1MB",
- "nodelay": false,
- "reuseaddr": true,
- "send_timeout": "15s",
- "send_timeout_close": true,
- "backlog": 1024,
- "active_n": 100
}, - "max_connections": 204800,
- "access_rules": [
- "allow all"
], - "acceptors": 16,
- "proxy_protocol": false,
- "proxy_protocol_timeout": "3s",
- "zone": "default",
- "mountpoint": "/",
- "current_connections": 10240
}
{- "id": "tcp:demo",
- "running": true,
- "type": "tcp",
- "bind": "0.0.0.0:1884",
- "tcp_options": {
- "buffer": "4KB",
- "high_watermark": "1MB",
- "nodelay": false,
- "reuseaddr": true,
- "send_timeout": "15s",
- "send_timeout_close": true,
- "backlog": 1024,
- "active_n": 100
}, - "max_connections": 204800,
- "access_rules": [
- "allow all"
], - "acceptors": 16,
- "proxy_protocol": false,
- "proxy_protocol_timeout": "3s",
- "zone": "default",
- "mountpoint": "/",
- "current_connections": 10240
}
获取指定 ID 的监听器
id required | string Example: tcp:demo Listener id |
{- "id": "tcp:demo",
- "running": true,
- "type": "tcp",
- "bind": "0.0.0.0:1884",
- "tcp_options": {
- "buffer": "4KB",
- "high_watermark": "1MB",
- "nodelay": false,
- "reuseaddr": true,
- "send_timeout": "15s",
- "send_timeout_close": true,
- "backlog": 1024,
- "active_n": 100
}, - "max_connections": 204800,
- "access_rules": [
- "allow all"
], - "acceptors": 16,
- "proxy_protocol": false,
- "proxy_protocol_timeout": "3s",
- "zone": "default",
- "mountpoint": "/",
- "current_connections": 10240
}
为集群中所有的节点更新指定 ID 的监听器
id required | string Example: tcp:demo Listener id |
type required | string Value: "wss" Listener type |
running | boolean Listener status |
id required | string Listener id |
current_connections | integer >= 0 Current connections |
bind | string Default: 8084 监听套接字的 IP 地址和端口。 |
enable | boolean Default: true 启停监听器。 |
acceptors | integer >= 1 Default: 16 监听器接收池的大小。 |
integer or string Default: "infinity" 监听器允许的最大并发连接数。 | |
mountpoint | string Default: "" 发布或订阅时,请在所有主题前面加上 mountpoint 字符串。 |
zone | string Default: "default" 监听器所属的配置 zone。 |
enable_authn | string Default: true Enum: true false "quick_deny_anonymous" 配置为 |
max_conn_rate | string Default: "infinity" 用于限制当前监听器接受连接的速率。一旦达到限制,EMQX 将暂停从 Accept 队列获取连接,从而推迟或拒绝新的连接。 |
messages_rate | string 用于限制单个客户端每秒可以向 EMQX 发送的消息数。一旦达到限制,EMQX 将暂停从接收缓冲区读取数据,从而使发送方减速甚至暂时挂起。 |
bytes_rate | string 用于限制单个客户端每秒可以向 EMQX 发送的字节数。一旦达到限制,EMQX 将暂停从接收缓冲区读取数据,从而使发送方减速甚至暂时挂起。 |
access_rules | Array of strings Default: ["allow all"] 由字符串规则组成的访问规则列表,以限制或允许某些地址的访问,规则之间存在前后顺序,格式为 |
proxy_protocol | boolean Default: false 如果为 EMQX 部署了反向代理,且代理处启用了 PROXY 协议以传递客户端真实 IP 时,则需要一并开启此选项,以便 EMQX 从 PROXY 协议标头中提取客户端真实 IP。EMQX 将自动检测 PROXY 协议的版本,支持 V1 和 V2。 |
proxy_protocol_timeout | string Default: "3s" 代理协议超时。如果在超时时间内未收到代理协议数据包,EMQX 将关闭 TCP 连接。 |
object (emqx.tcp_opts) | |
object (emqx.listener_wss_opts) | |
object (emqx.ws_opts) |
{- "id": "tcp:demo",
- "running": true,
- "type": "tcp",
- "bind": "0.0.0.0:1884",
- "tcp_options": {
- "buffer": "4KB",
- "high_watermark": "1MB",
- "nodelay": false,
- "reuseaddr": true,
- "send_timeout": "15s",
- "send_timeout_close": true,
- "backlog": 1024,
- "active_n": 100
}, - "max_connections": 204800,
- "access_rules": [
- "allow all"
], - "acceptors": 16,
- "proxy_protocol": false,
- "proxy_protocol_timeout": "3s",
- "zone": "default",
- "mountpoint": "/",
- "current_connections": 10240
}
{- "id": "tcp:demo",
- "running": true,
- "type": "tcp",
- "bind": "0.0.0.0:1884",
- "tcp_options": {
- "buffer": "4KB",
- "high_watermark": "1MB",
- "nodelay": false,
- "reuseaddr": true,
- "send_timeout": "15s",
- "send_timeout_close": true,
- "backlog": 1024,
- "active_n": 100
}, - "max_connections": 204800,
- "access_rules": [
- "allow all"
], - "acceptors": 16,
- "proxy_protocol": false,
- "proxy_protocol_timeout": "3s",
- "zone": "default",
- "mountpoint": "/",
- "current_connections": 10240
}
[- {
- "status": {
- "running": true,
- "max_connections": 2048000,
- "current_connections": 21
}, - "type": "tcp",
- "enable": false,
- "node_status": [
- {
- "node": "emqx@127.0.0.1",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 11
}
}, - {
- "node": "emqx@127.0.0.1",
- "status": {
- "running": true,
- "max_connections": 1024000,
- "current_connections": 10
}
}
], - "ids": [
- "tcp:demo"
]
}, - {
- "status": {
- "running": true,
- "max_connections": "infinity",
- "current_connections": 71
}, - "type": "ssl",
- "enable": false,
- "node_status": [
- {
- "node": "emqx@127.0.0.1",
- "status": {
- "running": true,
- "max_connections": "infinity",
- "current_connections": 31
}
}, - {
- "node": "emqx@127.0.0.1",
- "status": {
- "running": true,
- "max_connections": "infinity",
- "current_connections": 40
}
}
], - "ids": [
- "ssl:default"
]
}
]
获取指定网关认证器的配置
当网关或认证未启用时,返回 404。
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
{- "mechanism": "jwt",
- "secret": "mysecret",
- "algorithm": "hmac-based",
- "secret_base64_encoded": false,
- "use_jwks": false,
- "verify_claims": {
- "username": "${username}"
}
}
更新指定网关认证器的配置,或停用认证器。
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
mechanism required | string Value: "password_based" 认证方式。 |
backend required | string Value: "ldap" 后端类型。 |
query_timeout | string Default: "5s" LDAP 查询的超时时间。 |
enable | boolean Default: true 设为 |
server required | string 要连接的 IPv4 或 IPv6 地址或主机名。 |
pool_size | integer >= 1 Default: 8 桥接远端服务时使用的连接池大小。 |
username required | string 内部数据库的用户名。 |
password | string <password> 内部数据库密码。 |
base_dn required | string 与基本对象条目(或根)相关的名称。 |
filter | string Default: "(objectClass=mqttUser)" 定义哪些条件必须被依次满足的过滤器 |
request_timeout | string Default: "10s" 设置每个单独请求所使用的最大时间(以毫秒为单位)。 |
object (ldap.ssl) | |
password_attribute | string Default: "userPassword" 指示哪个属性用于表示用户密码。 |
is_superuser_attribute | string Default: "isSuperuser" 指示哪个属性用于表示用户是否为超级用户。 |
{- "mechanism": "jwt",
- "secret": "mysecret",
- "algorithm": "hmac-based",
- "secret_base64_encoded": false,
- "use_jwks": false,
- "verify_claims": {
- "username": "${username}"
}
}
{- "mechanism": "jwt",
- "secret": "mysecret",
- "algorithm": "hmac-based",
- "secret_base64_encoded": false,
- "use_jwks": false,
- "verify_claims": {
- "username": "${username}"
}
}
删除指定网关的认证器。
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
{- "code": "BAD_REQUEST",
- "message": "string"
}
为指定网关开启认证器实现客户端认证的功能。
当未配置认证器或关闭认证器时,则认为允许所有客户端的连接。
注:在网关中仅支持添加一个认证器,而不是像 MQTT 一样允许配置多个认证器构成认证链。
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
mechanism required | string Value: "password_based" 认证方式。 |
backend required | string Value: "ldap" 后端类型。 |
query_timeout | string Default: "5s" LDAP 查询的超时时间。 |
enable | boolean Default: true 设为 |
server required | string 要连接的 IPv4 或 IPv6 地址或主机名。 |
pool_size | integer >= 1 Default: 8 桥接远端服务时使用的连接池大小。 |
username required | string 内部数据库的用户名。 |
password | string <password> 内部数据库密码。 |
base_dn required | string 与基本对象条目(或根)相关的名称。 |
filter | string Default: "(objectClass=mqttUser)" 定义哪些条件必须被依次满足的过滤器 |
request_timeout | string Default: "10s" 设置每个单独请求所使用的最大时间(以毫秒为单位)。 |
object (ldap.ssl) | |
password_attribute | string Default: "userPassword" 指示哪个属性用于表示用户密码。 |
is_superuser_attribute | string Default: "isSuperuser" 指示哪个属性用于表示用户是否为超级用户。 |
{- "mechanism": "jwt",
- "secret": "mysecret",
- "algorithm": "hmac-based",
- "secret_base64_encoded": false,
- "use_jwks": false,
- "verify_claims": {
- "username": "${username}"
}
}
{- "mechanism": "jwt",
- "secret": "mysecret",
- "algorithm": "hmac-based",
- "secret_base64_encoded": false,
- "use_jwks": false,
- "verify_claims": {
- "username": "${username}"
}
}
导入用户(仅支持 built_in_database 类型的认证器)
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
filename | string <binary> |
{- "code": "BAD_REQUEST",
- "message": "string"
}
获取用户列表(仅支持 built_in_database 类型的认证器)
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
page | integer >= 1 Default: 1 Example: page=1 Page number of the results to fetch. |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 Results per page(max 10000) |
like_user_id | string Example: like_user_id=test_ 使用用户 ID (username 或 clientid)模糊搜索,仅支持按子串的方式进行搜索。 |
is_superuser | boolean 是否是超级用户 |
{- "data": [
- {
- "user_id": "user1"
}, - {
- "is_superuser": true,
- "user_id": "user2"
}
], - "meta": {
- "count": 300,
- "limit": 20,
- "page": 0
}
}
添加用户(仅支持 built_in_database 类型的认证器)
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
user_id required | string |
password required | string |
is_superuser | boolean Default: false |
{- "password": "******",
- "user_id": "user1"
}
{- "regular_user": {
- "value": {
- "user_id": "user1"
}, - "summary": "Regular user"
}, - "super_user": {
- "value": {
- "is_superuser": true,
- "user_id": "user2"
}, - "summary": "Superuser"
}
}
获取用户信息(仅支持 built_in_database 类型的认证器)
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
uid required | string Example: test_username 用户 ID |
{- "regular_user": {
- "value": {
- "user_id": "user1"
}, - "summary": "Regular user"
}, - "super_user": {
- "value": {
- "is_superuser": true,
- "user_id": "user2"
}, - "summary": "Superuser"
}
}
更新用户信息(仅支持 built_in_database 类型的认证器)
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
uid required | string Example: test_username 用户 ID |
password required | string |
is_superuser | boolean Default: false |
{- "password": "******"
}
{- "regular_user": {
- "value": {
- "user_id": "user1"
}, - "summary": "Regular user"
}, - "super_user": {
- "value": {
- "is_superuser": true,
- "user_id": "user2"
}, - "summary": "Superuser"
}
}
删除用户(仅支持 built_in_database 类型的认证器)
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
uid required | string Example: test_username 用户 ID |
{- "code": "BAD_REQUEST",
- "message": "string"
}
导入用户(仅支持 built_in_database 类型的认证器)
name required | string Enum: "coap" "exproto" "lwm2m" "mqttsn" "stomp" Example: stomp 网关名称. |
id required | string Example: stomp:tcp:def 监听器 ID |
filename | string <binary> |
{- "code": "BAD_REQUEST",
- "message": "string"
}
Add site as a replica for the durable storage
ds required | string Value: "messages" Example: messages Durable storage ID |
site required | string Example: AFA18CB1C22F0157 Site ID |
{- "code": "BAD_REQUEST",
- "message": "string"
}
Remove site as a replica for the durable storage
ds required | string Value: "messages" Example: messages Durable storage ID |
site required | string Example: AFA18CB1C22F0157 Site ID |
{- "code": "BAD_REQUEST",
- "message": "string"
}
Update replicas of the durable storage
ds required | string Value: "messages" Example: messages Durable storage ID |
[- "string"
]
[- "string"
]
Get durable storage
ds required | string Value: "messages" Example: messages Durable storage ID |
{- "name": "messages",
- "shards": [
- {
- "id": "1",
- "replicas": [
- {
- "site": "AFA18CB1C22F0157",
- "status": "up"
}
]
}
]
}
发送 CoAP 消息到指定客户端
clientid required | string |
token | string 消息 Token, 可以为空 |
method | string Enum: "get" "put" "post" "delete" 请求 Method 类型 |
timeout | string 请求超时 |
content_type | string Enum: "text/plain" "application/json" "application/octet-stream" Payload 类型 |
payload | string Payload 内容 |
{- "token": "string",
- "method": "get",
- "timeout": "32s",
- "content_type": "text/plain",
- "payload": "string"
}
{- "id": 0,
- "token": "string",
- "method": "string",
- "payload": "string"
}
查看保留消息列表
topic | string 主题过滤器,支持通配符,省略此项以匹配所有消息。 |
page | integer >= 1 Default: 1 Example: page=1 Page number of the results to fetch. |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 Results per page(max 10000) |
{- "data": [
- {
- "msgid": "string",
- "topic": "string",
- "qos": 0,
- "publish_at": "string",
- "from_clientid": "string",
- "from_username": "string"
}
], - "meta": {
- "page": 1,
- "limit": 50,
- "count": 0,
- "hasnext": true
}
}
{- "enable": true,
- "msg_expiry_interval": "32s",
- "msg_clear_interval": "32s",
- "max_payload_size": "32MB",
- "stop_publish_clear_msg": false,
- "delivery_rate": "1000/s",
- "backend": {
- "type": "built_in_database",
- "storage_type": "ram",
- "max_retained_messages": 0,
- "index_specs": [
- [
- 2,
- 4
], - [
- 1,
- 3
]
], - "enable": true
}
}
更新配置
enable | boolean Default: true 是否开启消息保留功能。 |
msg_expiry_interval | string Default: "0s" 过期的保留消息将不会再被投递,设置为 0 则表示保留消息永不过期。但如果 MQTT 消息中指定了 |
msg_clear_interval | string Default: "0s" 检查并清除过期保留消息的时间间隔。这可以避免已经过期的保留消息仍然被长时间地存储。 |
max_payload_size | string Default: "1MB" 允许存储的保留消息的最大大小。EMQX 将拒绝存储超过此大小的保留消息,并输出一条包含 'retain_failed_for_payload_size_exceeded_limit' 关键字的 Error 日志。 |
stop_publish_clear_msg | boolean Default: false 当 PUBLISH 消息的保留标志被设置且有效载荷为空时,是否继续发布消息。 |
delivery_rate | string Default: "1000/s" 发送保留消息的最大速率。 |
object (retainer.mnesia_config) |
{- "enable": true,
- "msg_expiry_interval": "32s",
- "msg_clear_interval": "32s",
- "max_payload_size": "32MB",
- "stop_publish_clear_msg": false,
- "delivery_rate": "1000/s",
- "backend": {
- "type": "built_in_database",
- "storage_type": "ram",
- "max_retained_messages": 0,
- "index_specs": [
- [
- 2,
- 4
], - [
- 1,
- 3
]
], - "enable": true
}
}
{- "enable": true,
- "msg_expiry_interval": "32s",
- "msg_clear_interval": "32s",
- "max_payload_size": "32MB",
- "stop_publish_clear_msg": false,
- "delivery_rate": "1000/s",
- "backend": {
- "type": "built_in_database",
- "storage_type": "ram",
- "max_retained_messages": 0,
- "index_specs": [
- [
- 2,
- 4
], - [
- 1,
- 3
]
], - "enable": true
}
}
列出当前激活的告警或历史告警,由查询参数决定。
page | integer >= 1 Default: 1 Example: page=1 Page number of the results to fetch. |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 Results per page(max 10000) |
activated | boolean 用于指定查询的告警类型, |
{- "data": [
- {
- "node": "emqx@172.17.0.2",
- "name": "high_system_memory_usage",
- "message": "System memory usage is higher than 70%",
- "details": {
- "high_watermark": 70
}, - "duration": 297056,
- "activate_at": "2021-10-25T11:52:52.548+08:00",
- "deactivate_at": "2021-10-31T10:52:52.548+08:00"
}
], - "meta": {
- "page": 1,
- "limit": 50,
- "count": 0,
- "hasnext": true
}
}
获取集群的订阅列表。
page | integer >= 1 Default: 1 Example: page=1 Page number of the results to fetch. |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 Results per page(max 10000) |
node | string Example: node=emqx@172.17.0.2 Node name |
clientid | string Client ID |
qos | integer [ 0 .. 2 ] Example: qos=0 QoS |
topic | string Topic, url encoding |
match_topic | string Match topic string, url encoding |
share_group | string Shared subscription group name |
durable | boolean Filter subscriptions by durability |
[- {
- "node": "emqx@127.0.0.1",
- "topic": "testtopic/1",
- "clientid": "emqx_clientid_xx128cdhfc",
- "qos": 0,
- "nl": 0,
- "rap": 0,
- "rh": 0,
- "durable": false
}
]
API 错误码
code required | string Enum: "BAD_USERNAME_OR_PWD" "BAD_API_KEY_OR_SECRET" "BAD_REQUEST" "NOT_MATCH" "ALREADY_EXISTS" "BAD_CONFIG_SCHEMA" "BAD_LISTENER_ID" "BAD_NODE_NAME" "BAD_RPC" "BAD_TOPIC" "EXCEED_LIMIT" "INVALID_PARAMETER" "CONFLICT" "NO_DEFAULT_VALUE" "DEPENDENCY_EXISTS" "MESSAGE_ID_SCHEMA_ERROR" "INVALID_ID" "MESSAGE_ID_NOT_FOUND" "NOT_FOUND" "CLIENTID_NOT_FOUND" "CLIENT_NOT_FOUND" "RESOURCE_NOT_FOUND" "TOPIC_NOT_FOUND" "USER_NOT_FOUND" "INTERNAL_ERROR" "SERVICE_UNAVAILABLE" "SOURCE_ERROR" "UPDATE_FAILED" "REST_FAILED" "CLIENT_NOT_RESPONSE" Example: BAD_USERNAME_OR_PWD API Error Codes |
{- "code": "string",
- "description": "string"
}
更新配置
enable | boolean Default: false 是否启用慢订阅 |
threshold | string Default: "500ms" 消息时延大于此阈值的消费端 Client ID 与主题将被记录到慢订阅列表中。 |
expire_interval | string Default: "300s" 慢订阅记录的过期时间,如果记录在过期时间内没有更新,那么该记录将被删除。 |
top_k_num | integer >= 1 Default: 10 慢订阅记录的最大数量,最大不能超过 1000。 |
stats_type | string Default: "whole" Enum: "whole" "internal" "response" 消息时延的计算方式: |
{- "enable": false,
- "threshold": "32s",
- "expire_interval": "32s",
- "top_k_num": 10,
- "stats_type": "whole"
}
{- "enable": false,
- "threshold": "32s",
- "expire_interval": "32s",
- "top_k_num": 10,
- "stats_type": "whole"
}
查看慢订阅的统计数据
page | integer >= 1 Default: 1 Example: page=1 Page number of the results to fetch. |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 Results per page(max 10000) |
{- "data": [
- {
- "clientid": "string",
- "node": "string",
- "topic": "string",
- "timespan": 0,
- "last_update_time": 0
}
]
}
创建一个新的 API 密钥
name | string Unique and format by [a-zA-Z0-9-_] |
(integer or string) or string Default: "infinity" No longer valid datetime | |
desc | string |
enable | boolean Enable/Disable |
expired | boolean Expired |
{- "name": "EMQX-API-KEY-1",
- "expired_at": "2021-12-05T02:01:34.186Z",
- "desc": "Note",
- "enable": true,
- "expired": true
}
{- "name": "EMQX-API-KEY-1",
- "api_key": "a4697a5c75a769f6",
- "api_secret": "MzAyMjk3ODMwMDk0NjIzOTUxNjcwNzQ0NzQ3MTE2NDYyMDI",
- "expired_at": "2021-12-05T02:01:34.186Z",
- "created_at": "2021-12-01T00:00:00.000Z",
- "desc": "Note",
- "enable": true,
- "expired": true
}
指定 API 密钥 ID 获取详情
name required | string Example: EMQX-API-KEY-1 ^[A-Za-z]+[A-Za-z0-9-_]*$ |
{- "name": "EMQX-API-KEY-1",
- "api_key": "a4697a5c75a769f6",
- "expired_at": "2021-12-05T02:01:34.186Z",
- "created_at": "2021-12-01T00:00:00.000Z",
- "desc": "Note",
- "enable": true,
- "expired": true
}
指定 API 密钥 ID 进行更新
name required | string Example: EMQX-API-KEY-1 ^[A-Za-z]+[A-Za-z0-9-_]*$ |
(integer or string) or string Default: "infinity" No longer valid datetime | |
desc | string |
enable | boolean Enable/Disable |
expired | boolean Expired |
{- "expired_at": "2021-12-05T02:01:34.186Z",
- "desc": "Note",
- "enable": true,
- "expired": true
}
{- "name": "EMQX-API-KEY-1",
- "api_key": "a4697a5c75a769f6",
- "expired_at": "2021-12-05T02:01:34.186Z",
- "created_at": "2021-12-01T00:00:00.000Z",
- "desc": "Note",
- "enable": true,
- "expired": true
}
列出目前所有被封禁的客户端 ID、用户名和 IP 地址。
page | integer >= 1 Default: 1 Example: page=1 Page number of the results to fetch. |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 Results per page(max 10000) |
{- "data": [
- {
- "as": "username",
- "who": "Banned name",
- "by": "mgmt_api",
- "reason": "Too many requests",
- "at": "2021-10-25T21:48:47+08:00",
- "until": "2021-10-25T21:53:47+08:00"
}
], - "meta": {
- "page": 1,
- "limit": 50,
- "count": 0,
- "hasnext": true
}
}
添加一个客户端 ID、用户名或者 IP 地址到黑名单。
as required | string Enum: "clientid" "username" "peerhost" "clientid_re" "username_re" "peerhost_net" 封禁方式,可以通过客户端 ID、用户名或者 IP 地址等方式进行封禁。 |
who required | string 封禁对象,具体的客户端 ID、用户名或者 IP 地址。 |
by | string 封禁的发起者。 |
reason | string 封禁原因,记录当前对象被封禁的原因。 |
integer or string 封禁的起始时间,格式为 rfc3339,默认为发起操作的时间。 | |
integer or string 封禁的结束时间,格式为 rfc3339,默认值为发起操作的时间 + 1 年。 |
{- "as": "username",
- "who": "Banned name",
- "by": "mgmt_api",
- "reason": "Too many requests",
- "at": "2021-10-25T21:48:47+08:00",
- "until": "2021-10-25T21:53:47+08:00"
}
{- "data": [
- {
- "as": "username",
- "who": "Banned name",
- "by": "mgmt_api",
- "reason": "Too many requests",
- "at": "2021-10-25T21:48:47+08:00",
- "until": "2021-10-25T21:53:47+08:00"
}
]
}
将一个客户端 ID、用户名或者 IP 地址从黑名单中删除。
as required | string Enum: "clientid" "username" "peerhost" "clientid_re" "username_re" "peerhost_net" Example: username 封禁方式,可以通过客户端 ID、用户名或者 IP 地址等方式进行封禁。 |
who required | string Example: Badass 封禁对象,具体的客户端 ID、用户名或者 IP 地址。 |
{- "code": "NOT_FOUND",
- "message": "string"
}