客户名单
语法
CLIENT LIST [TYPE <NORMAL | MASTER | REPLICA | PUBSUB>] [ID client-id [client-id ...]]
- 从以下位置开始可用:
- 2.4.0
- 时间复杂度:
- O(N),其中 N 是客户端连接数
- ACL 类别:
-
@admin,@slow,@dangerous,@connection,
这CLIENT LISTcommand 返回有关客户端的信息和统计信息
Connections Server 的 Connections Server 的 S S Server 的
您可以使用其中一个可选子命令来筛选列表。这TYPE type子命令按客户端的类型过滤列表,其中 type 是以下之一normal,master,replica和pubsub.请注意,被MONITOR命令属于normal类。
这IDfilter 仅返回 ID 与client-id参数。
以下是字段的含义:
id:唯一的 64 位客户端 IDaddr:客户端的地址/端口laddr:客户端连接到的本地地址的地址/端口(绑定地址)fd:套接字对应的文件描述符name:客户端使用CLIENT SETNAMEage:连接的总持续时间(以秒为单位)idle:连接的空闲时间(以秒为单位)flags:客户端标志(见下文)db:当前数据库 IDsub:频道订阅数psub:模式匹配订阅数ssub:分片通道订阅数。Redis 7.0.3 中添加multi:MULTI/EXEC 上下文中的命令数watch:此客户端当前正在监视的键数。Redis 7.4 新增功能qbuf:查询缓冲区长度(0 表示没有待处理的查询)qbuf-free:查询缓冲区的可用空间(0 表示缓冲区已满)argv-mem:下一个命令的不完整参数(已从查询缓冲区中提取)multi-mem:缓冲的 multi 命令耗尽了内存。Redis 7.0 新增功能obl:输出缓冲区长度oll:输出列表长度(当缓冲区已满时,回复将在此列表中排队)omem:输出缓冲区内存使用情况tot-mem:此客户端在其各种缓冲区中消耗的总内存events:文件描述符事件(请参阅下文)cmd:上次播放的命令user:客户端的已验证用户名redir:当前客户端跟踪重定向的客户端 IDresp:客户端 RESP 协议版本。Redis 7.0 新增功能rbp:自客户端连接以来客户端读取缓冲区的峰值大小。Redis 7.0 新增功能rbs:客户端读取缓冲区的当前大小(以字节为单位)。Redis 7.0 新增功能
客户端标志可以是以下各项的组合:
A: connection to be closed ASAP
b: the client is waiting in a blocking operation
c: connection to be closed after writing entire reply
d: a watched keys has been modified - EXEC will fail
e: the client is excluded from the client eviction mechanism
i: the client is waiting for a VM I/O (deprecated)
M: the client is a master
N: no specific flag set
O: the client is a client in MONITOR mode
P: the client is a Pub/Sub subscriber
r: the client is in readonly mode against a cluster node
S: the client is a replica node connection to this instance
u: the client is unblocked
U: the client is connected via a Unix domain socket
x: the client is in a MULTI/EXEC context
t: the client enabled keys tracking in order to perform client side caching
T: the client will not touch the LRU/LFU of the keys it accesses
R: the client tracking target client is invalid
B: the client enabled broadcast tracking mode
文件描述符事件可以是:
r: the client socket is readable (event loop)
w: the client socket is writable (event loop)
笔记
定期添加新字段以进行调试。有些可以被删除 在未来。使用此命令的版本安全 Redis 客户端应解析 相应的输出(即处理正常缺失的字段,跳过 unknown 字段)。
RESP2/RESP3 回复
批量字符串回复:有关客户端连接的信息和统计信息。历史
- 从 Redis 版本 2.8.12 开始:添加了唯一客户端
id田。 - 从 Redis 版本 5.0.0 开始:添加了可选
TYPE滤波器。 - 从 Redis 版本 6.0.0 开始:添加了
user田。 - 从 Redis 版本 6.2.0 开始:添加了
argv-mem,tot-mem,laddr和redirfields 和可选的ID滤波器。 - 从 Redis 版本 7.0.0 开始:添加了
resp,multi-mem,rbs和rbp领域。 - 从 Redis 版本 7.0.3 开始:添加了
ssub田。