Latest web development tutorials

Redis Client List Command

Redis server

Redis Client List command to return all clients connected to the server information and statistics.

grammar

redis Client List basic command syntax is as follows:

redis 127.0.0.1:6379> CLIENT LIST

Available versions

> = 2.4.0

return value

Command returns a multi-line strings that are formatted according to the following form:

  • Each connected client corresponds to a row (in LF split)
  • Each row consists of a series string of property = value in the form of domains, separated by a space between each domain

The following is the meaning of the domain:

  • addr: client's address and port
  • fd: file descriptor used by the socket
  • age: time in seconds has long connection
  • idle: Idle length of time in seconds
  • flags: client flag
  • db: The client is using the database ID
  • sub: already subscribed to the number of channels
  • psub: The number of patterns have subscribed
  • multi: command is executed in a transaction number
  • qbuf: query buffer length (in bytes, 0 no buffer allocation queries)
  • qbuf-free: Discover the length of the remaining buffer space (bytes, 0 indicates no space left)
  • obl: length of the output buffer (bytes, 0 indicates no allocation output buffer)
  • oll: the number of objects contained in the output list (when the output buffer is no space left, the command reply in the form of a string object is enqueued to this queue)
  • omem: output buffer and the amount of memory occupied by the output list
  • events: Event file descriptor
  • cmd: command last executed

Clients can flag consists of the following components:

  • O: The client is affiliated node MONITOR mode (slave)
  • S: The client is the general mode (normal) subsidiary node
  • M: The client is the master node (master)
  • x: the client is the enforcement branch
  • b: the client is blocked waiting for an event
  • i: client is waiting for VM I / O operations (obsolete)
  • d: a monitored (watched) the key has been modified, EXEC command fails
  • c: In the written reply complete, close the link
  • u: the client is not blocked (unblocked)
  • A: close the connection as quickly as possible
  • N: do not set any flag

File descriptor events can be:

  • r: client socket (in the event loop) is readable (readable)
  • w: client socket (in the event loop) is writable (writeable)

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