Redis查看当前连接数 & 客户端连接信息
【 redis-cli命令行使用:info clients可以查看当前的redis连接数: 】
127.0.0.1:6379> info clients
# Clients
connected_clients:4
cluster_connections:0
maxclients:6
client_recent_max_input_buffer:56
client_recent_max_output_buffer:0
blocked_clients:0
tracking_clients:0
clients_in_timeout_table:0
【 redis查看详细连接: 】
127.0.0.1:6379> CLIENT LIST
id=3 addr=192.168.1.6:60249 laddr=192.168.1.66:6379 fd=7 name= age=1276 idle=4 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 argv-mem=0 obl=0 oll=0 omem=0 tot-mem=20504 events=r cmd=info user=default redir=-1
id=7 addr=192.168.1.6:60268 laddr=192.168.1.66:6379 fd=10 name= age=1264 idle=1264 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 argv-mem=0 obl=0 oll=0 omem=0 tot-mem=20536 events=r cmd=scan user=default redir=-1
id=8 addr=192.168.1.6:60269 laddr=192.168.1.66:6379 fd=9 name= age=1263 idle=860 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 argv-mem=0 obl=0 oll=0 omem=0 tot-mem=20528 events=r cmd=zrange user=default redir=-1
id=9 addr=127.0.0.1:45660 laddr=127.0.0.1:6379 fd=8 name= age=1133 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=26 qbuf-free=40928 argv-mem=10 obl=0 oll=0 omem=0 tot-mem=61466 events=r cmd=client user=default redir=-1
【 redis-cli命令控制行中获取客户端信息命令 】
CLIENT LIST 获取客户端列表
CLIENT SETNAME 设置当前连接点redis的名称
CLIENT GETNAME 查看当前连接的名称
CLIENT KILL ip:port 杀死指定连接