Visualizzare i client connessi in Redis

Mattepuffo's logo
Visualizzare i client connessi in Redis

Visualizzare i client connessi in Redis

Redis ha determinati strumenti per visualizzare informazioni sui client connessi.

Oggi vediamo come visualizzare quelli connessi, con diversi campi; la descrizine la potete vedere qua sotto (ripresa dalla documentazione ufficiale):

    id: an unique 64-bit client ID (introduced in Redis 2.8.12).
    addr: address/port of the client
    fd: file descriptor corresponding to the socket
    age: total duration of the connection in seconds
    idle: idle time of the connection in seconds
    flags: client flags (see below)
    db: current database ID
    sub: number of channel subscriptions
    psub: number of pattern matching subscriptions
    multi: number of commands in a MULTI/EXEC context
    qbuf: query buffer length (0 means no query pending)
    qbuf-free: free space of the query buffer (0 means the buffer is full)
    obl: output buffer length
    oll: output list length (replies are queued in this list when the buffer is full)
    omem: output buffer memory usage
    events: file descriptor events (see below)
    cmd: last command played

I flags che può assumere sono questi:

O: the client is a slave in MONITOR mode
S: the client is a normal slave server
M: the client is a master
x: the client is in a MULTI/EXEC context
b: the client is waiting in a blocking operation
i: the client is waiting for a VM I/O (deprecated)
d: a watched keys has been modified - EXEC will fail
c: connection to be closed after writing entire reply
u: the client is unblocked
U: the client is connected via a Unix domain socket
r: the client is in readonly mode against a cluster node
A: connection to be closed ASAP
N: no specific flag set

Detto questo vediamo un esempio:

$ redis-cli CLIENt LIST
id=36437 addr=127.0.0.1:45158 fd=6 name= age=0
 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

Enjoy!


Condividi

Commentami!