clients 命令

clients 命令查询连接的 MQTT 客户端。

clients list查询全部客户端连接
clients show <ClientId>根据 ClientId 查询客户端
clients kick <ClientId>根据 ClientId 踢出客户端

clients list

查询全部客户端连接:

  1. $ ./bin/emqx_ctl clients list
  2. Connection(mosqsub/43832-airlee.lo, clean_start=true, username=test, peername=127.0.0.1:64896, connected_at=1452929113)
  3. Connection(mosqsub/44011-airlee.lo, clean_start=true, username=test, peername=127.0.0.1:64961, connected_at=1452929275)
  4. ...

返回 Client 对象的属性:

clean_start清除会话标记
username用户名
peername对端 TCP 地址
connected_at客户端连接时间

clients show <ClientId>

根据 ClientId 查询客户端:

  1. $ ./bin/emqx_ctl clients show "mosqsub/43832-airlee.lo"
  2. Connection(mosqsub/43832-airlee.lo, clean_sess=true, username=test, peername=127.0.0.1:64896, connected_at=1452929113)

clients kick <ClientId>

根据 ClientId 踢出客户端:

  1. $ ./bin/emqx_ctl clients kick "clientid"