logo icon
VerneMQ 会话管理

创建时间:2024-08-17 12:19:20
vmq-admin session show vmq-admin session show --help $ vmq-admin session show --node --is_online --client_id=client1 --limit=100 +---------+--------------+ |is_online| node | +---------+--------------+ | true |dev2@127.0.0.1| +---------+--------------+ 1. 列出客户端和订阅 $ vmq-admin session show --topic --client_id +---------+-----------------+ |client_id| topic | +---------+-----------------+ | client2 |some/other/topic1| | client1 |some/other/topic2| | client1 | some/topic | +---------+-----------------+ 1. 仅列出订阅该主题的客户端:some/topic $ vmq-admin session show --topic --client_id --topic=some/topic +---------+----------+ |client_id| topic | +---------+----------+ | client1 |some/topic| +---------+----------+ 1. 执行正则表达式搜索来查询主题的子集: $ vmq-admin session show --topic --client_id --topic=~some/other/.* +---------+-----------------+ |client_id| topic | +---------+-----------------+ | client2 |some/other/topic1| | client1 |some/other/topic | +---------+-----------------+ 1. 要确定持久会话的队列 (clean_session=false) 是何时创建的,以及客户端最后一次连接的时间,可以使用 and 列出 POSIX 时间戳(以微秒为单位):--queue_started_at--session_started_at $ vmq-admin session show --client_id=client1 --queue_started_at --session_started_at +----------------+------------------+ |queue_started_at|session_started_at| +----------------+------------------+ | 1549379963575 | 1549379974905 | +----------------+------------------+ 1. 管理会话 要断开客户端连接并清理存储消息并删除订阅,可以调用: $ vmq-admin session disconnect client-id=client1 --cleanup 1. 要重新授权客户端的订阅,请发出以下命令: $ vmq-admin session reauthorize username=username client-id=client1 Unchanged