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 Version
= 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 fields in the form property=value, separated by spaces
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 connected duration in seconds
- idle: the idle duration in seconds
- flags: the client flags
- db: the database ID the client is using
- sub: the number of subscribed channels
- psub: the number of subscribed patterns
- multi: the number of commands executed in the transaction
- qbuf: the query buffer length (in bytes; 0 means no query buffer allocated)
- qbuf-free: the remaining space in the query buffer (in bytes; 0 means no remaining space)
- obl: the output buffer length (in bytes; 0 means no output buffer allocated)
- oll: the number of objects in the output list (when the output buffer has no remaining space, command replies are queued into this list as string objects)
- omem: the total memory used by the output buffer and output list
- events: the file descriptor events
- cmd: the most recently executed command
The client flags can consist of the following parts:
- O: the client is a replica (slave) in MONITOR mode
- S: the client is a replica in normal mode
- M: the client is the 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, the EXEC command will fail
- c: close the connection after the reply is fully written
- u: the client is unblocked
- A: close the connection as quickly as possible
- N: no flag set
The 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