Redis Client List Command
The Redis Client List command is used to return information and statistics about 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 Versions
>= 2.4.0
Return Value
The command returns a multi-line string, and these strings are formatted in the following form:
- Each connected client corresponds to one line (separated by LF)
- Each line of string consists of a series of fields in the form of `attribute=value`, and each field is separated by a space
The following are the meanings of the fields:
- addr : the client's address and port
- fd : the file descriptor used by the socket
- age : the connection duration in seconds
- idle : the idle duration in seconds
- flags : client flags
- db : the database ID that the client is using
- sub : the number of subscribed channels
- psub : the number of subscribed patterns
- multi : the number of commands executed in a transaction
- qbuf : the length of the query buffer (in bytes, 0 means no query buffer is allocated)
- qbuf-free : the length of the remaining space in the query buffer (in bytes, 0 means no remaining space)
- obl : the length of the output buffer (in bytes, 0 means no output buffer is allocated)
- oll : the number of objects contained in the output list (when there is no free space in the output buffer, command replies are enqueued into this queue in the form of string objects)
- omem : the total memory occupied by the output buffer and the output list
- events : file descriptor events
- cmd : the most recently executed command
Client flags can consist of the following parts:
- O : the client is a slave node in MONITOR mode
- S : the client is a slave node in normal mode
- M : the client is a master node
- x : the client is executing a transaction
- b : the client is waiting for a blocking event
- i : the client is waiting for a VM I/O operation (deprecated)
- d : a watched key has been modified, and the EXEC command will fail
- c : close the connection after the reply is completely written out
- u : the client is 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
- w : the client socket (in the event loop) is writeable
Example
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
Other Extensions