监听器

GET /api/v4/listeners

返回集群下的所有监听器信息。

Path Parameters:

**Success Response Body (JSON):

NameTypeDescription
codeInteger0
dataArray of Objects各节点的监听器列表
data[0].nodeString节点名称
data[0].listenersArray of Objects监听器列表
data[0].listeners[0].acceptorsIntegerAcceptor 进程数量
data[0].listeners[0].listen_onString监听端口
data[0].listeners[0].protocolString插件描述
data[0].listeners[0].current_connsInteger插件是否启动
data[0].listeners[0].max_connsInteger允许建立的最大连接数量
data[0].listeners[0].shutdown_countArray of Objects连接关闭原因及计数

常见 shutdown_count

NameTypeDescription
normalInteger正常关闭的连接数量,仅在计数大于 0 时返回
kickedInteger被手动踢除的连接数量,仅在计数大于 0 时返回
discardedInteger由于 Clean SessionClean Starttrue 而被丢弃的连接数量
takeoveredInteger由于 Clean SessionClean Startfalse 而被接管的连接数量

Examples:

  1. $ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/listeners"
  2. {"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):

NameTypeDescription
codeInteger0
dataArray of Objects各节点的监听器列表
data[0].acceptorsIntegerAcceptor 进程数量
data[0].listen_onString监听端口
data[0].protocolString插件描述
data[0].current_connsInteger插件是否启动
data[0].max_connsInteger允许建立的最大连接数量
data[0].shutdown_countArray of Objects连接关闭原因及计数

Examples:

  1. $ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/nodes/emqx@127.0.0.1/listeners"
  2. {"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}