Redis Client List command
Redis Server
The Redis Client List command is used to return information and statistics of all clients connected to the server.
Syntax
The basic syntax of the Redis Client List command is as follows:
redis 127.0.0.1:6379> CLIENT LIST
Available version
>= 2.4.0
Return value
The command returns multiple lines of strings, which are formatted as follows:
-
Each connected client corresponds to a line (separated by LF)
-
Each line of string is composed of a series of fields in the form of attribute=value, separated by spaces
The following are the meanings of the fields:
-
addr : Address and port of the client
-
fd : File descriptor used by the socket
-
age : Connected time in seconds
-
idle : Idle time in seconds
-
flags : Client flag
-
db : Database ID used by the client
-
sub : Number of subscribed channels
-
psub : Number of subscribed patterns
-
multi : Number of commands executed in the transaction
-
qbuf : Length of the query buffer (in bytes, 0 indicates that no query buffer has been allocated)
-
qbuf-free : Length of the remaining space in the query buffer (in bytes, 0 indicates no remaining space)
-
obl : Length of the output buffer (in bytes, 0 indicates that no output buffer has been allocated)
-
oll : Number of objects contained in the output list (when there is no remaining space in the output buffer, the command response will be enqueued in this queue in the form of a string object)
-
omem : Total memory used by the output buffer and output list
-
events : File descriptor events
-
cmd : The last executed command
The client flag can be composed of the following parts:
-
O : The client is an auxiliary node (slave) in the MONITOR mode.
-
S : The client is an auxiliary node in the general mode (normal).
-
M : The client is the master node (master)
-
x : The client is executing a transaction
-
b : The client is waiting for a blocking event
-
i : The client is waiting for VM I/O Operation (deprecated)
-
d : A watched key has been modified, the EXEC command will fail
-
c : Close the connection after the reply is fully written
-
u : The client is not blocked (unblocked)
-
A : Close the connection as soon as possible
-
N : No flags set
File descriptor events can be:
-
r : The client socket (in the event loop) is readable (readable)
-
w : The client socket (in the event loop) is writable (writeable)
Online Examples
redis 127.0.0.1:6379> CLIENT LIST
addr=127.0.0.1:43143 fd=6 age=183 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=client
addr=127.0.0.1:43163 fd=5 age=35 idle=15 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=ping
addr=127.0.0.1:43167 fd=7 age=24 idle=6 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=get
Redis Server