监听器
GET /api/v4/listeners
返回集群下的所有监听器信息。
Path Parameters: 无
Success Response Body (JSON):**
Name | Type | Description |
---|---|---|
code | Integer | 0 |
data | Array of Objects | 各节点的监听器列表 |
data[0].node | String | 节点名称 |
data[0].listeners | Array of Objects | 监听器列表 |
data[0].listeners[0].acceptors | Integer | Acceptor 进程数量 |
data[0].listeners[0].listen_on | String | 监听端口 |
data[0].listeners[0].protocol | String | 插件描述 |
data[0].listeners[0].current_conns | Integer | 插件是否启动 |
data[0].listeners[0].max_conns | Integer | 允许建立的最大连接数量 |
data[0].listeners[0].shutdown_count | Array of Objects | 连接关闭原因及计数 |
常见 shutdown_count
Name | Type | Description |
---|---|---|
normal | Integer | 正常关闭的连接数量,仅在计数大于 0 时返回 |
kicked | Integer | 被手动踢除的连接数量,仅在计数大于 0 时返回 |
discarded | Integer | 由于 Clean Session 或 Clean Start 为 true 而被丢弃的连接数量 |
takeovered | Integer | 由于 Clean Session 或 Clean Start 为 false 而被接管的连接数量 |
Examples:
$ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/listeners"
{"data":[{"node":"emqx@127.0.0.1","listeners":[{"shutdown_count":[],"protocol":"mqtt:ssl","max_conns":102400,"listen_on":"8883","current_conns":0,"acceptors":16},{"shutdown_count":[],"protocol":"mqtt:tcp","max_conns":1024000,"listen_on":"0.0.0.0:1883","current_conns":13,"acceptors":8},{"shutdown_count":[],"protocol":"mqtt:tcp","max_conns":1024000,"listen_on":"127.0.0.1:11883","current_conns":0,"acceptors":4},{"shutdown_count":[],"protocol":"http:dashboard","max_conns":512,"listen_on":"18083","current_conns":0,"acceptors":4},{"shutdown_count":[],"protocol":"http:management","max_conns":512,"listen_on":"8081","current_conns":1,"acceptors":2},{"shutdown_count":[],"protocol":"https:dashboard","max_conns":512,"listen_on":"18084","current_conns":0,"acceptors":2},{"shutdown_count":[],"protocol":"mqtt:ws:8083","max_conns":102400,"listen_on":"8083","current_conns":1,"acceptors":4},{"shutdown_count":[],"protocol":"mqtt:wss:8084","max_conns":16,"listen_on":"8084","current_conns":0,"acceptors":4}]}],"code":0}
GET /api/v4/nodes/{node}/listeners
类似 GET /api/v4/listeners,返回指定节点的监听器信息。
Path Parameters: 无
Success Response Body (JSON):**
Name | Type | Description |
---|---|---|
code | Integer | 0 |
data | Array of Objects | 各节点的监听器列表 |
data[0].acceptors | Integer | Acceptor 进程数量 |
data[0].listen_on | String | 监听端口 |
data[0].protocol | String | 插件描述 |
data[0].current_conns | Integer | 插件是否启动 |
data[0].max_conns | Integer | 允许建立的最大连接数量 |
data[0].shutdown_count | Array of Objects | 连接关闭原因及计数 |
Examples:
$ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/nodes/emqx@127.0.0.1/listeners"
{"data":[{"shutdown_count":[],"protocol":"mqtt:ssl","max_conns":102400,"listen_on":"8883","current_conns":0,"acceptors":16},{"shutdown_count":[],"protocol":"mqtt:tcp","max_conns":1024000,"listen_on":"0.0.0.0:1883","current_conns":13,"acceptors":8},{"shutdown_count":[],"protocol":"mqtt:tcp","max_conns":1024000,"listen_on":"127.0.0.1:11883","current_conns":0,"acceptors":4},{"shutdown_count":[],"protocol":"http:dashboard","max_conns":512,"listen_on":"18083","current_conns":0,"acceptors":4},{"shutdown_count":[],"protocol":"http:management","max_conns":512,"listen_on":"8081","current_conns":1,"acceptors":2},{"shutdown_count":[],"protocol":"https:dashboard","max_conns":512,"listen_on":"18084","current_conns":0,"acceptors":2},{"shutdown_count":[],"protocol":"mqtt:ws:8083","max_conns":102400,"listen_on":"8083","current_conns":1,"acceptors":4},{"shutdown_count":[],"protocol":"mqtt:wss:8084","max_conns":16,"listen_on":"8084","current_conns":0,"acceptors":4}],"code":0}