Redis Client List Command
The Redis Client List command is used to return information and statistics about the 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, formatted as follows:
- Each connected client corresponds to one line (separated by LF)
- Each line consists of a series of
attribute=value
fields separated by spaces
Here are the meanings of the fields:
addr
: Client's address and portfd
: File descriptor of the socket in useage
: Connection duration in secondsidle
: Idle duration in secondsflags
: Client flagsdb
: Database ID currently in use by the clientsub
: Number of subscribed channelspsub
: Number of subscribed patternsmulti
: Number of commands executed in a transactionqbuf
: Query buffer length (in bytes, 0 means no query buffer allocated)qbuf-free
: Length of remaining space in the query buffer (in bytes, 0 means no remaining space)obl
: Output buffer length (in bytes, 0 means no output buffer allocated)oll
: Number of objects in the output list (when the output buffer has no remaining space, command replies are queued into this list)omem
: Total memory used by the output buffer and listevents
: File descriptor eventscmd
: The most recent command executed
Client flags can include:
O
: Client is a slave in MONITOR modeS
: Client is a normal slaveM
: Client is a masterx
: Client is executing a transactionb
: Client is waiting for a blocking eventi
: Client is waiting for VM I/O (deprecated)d
: A watched key has been modified, the EXEC command will failc
: Close the connection after writing the complete replyu
: Client is unblockedA
: Close the connection as soon as possibleN
: No flags set
File descriptor events can be:
r
: Client socket is readable (in the event loop)w
: Client socket is writable (in the event loop)
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