Commands for Redis clients
client list
client list
id=4 addr=127.0.0.1:49148 fd=8 name= age=1 idle=1 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=26 qbuf-free=32742 argv-mem=10 obl=0 oll=0 omem=0 tot-mem=61466 events=r cmd=client user=default
id
: 客户端唯一标识addr
: ip:port
fd
: socket fd, 如果是 -1 标识内部clientname
: 客户端名字- 输入缓冲区
qbuf/qbuf-free
: 为客户端分配的缓冲区总量和余量,动态调整,不能超过1G,超过后会关闭客户端;该缓冲区不受 maxmemory
控制,大key或阻塞会迅速占用该区域 - 输出缓冲区
olb/oll/omem
: 保存命令结果并返回给客户端,可以通过 client-output-buffer-limit
来设置,同样不受 maxmemory
控制;olb
: 固定缓冲区长度,oll
: 动态缓冲区长度,omem
: 使用字节数
客户端类型 hard_limit soft_limit soft_seconds
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 4096mb 4096mb 1800
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
- 客户端存活状态
age/idle
: 客户端连接/空闲时间 - 客户端类型
flags
: events
: 文件描述符事件 r/w
cmd
: 最后一个命令
N 普通客户端
M master
S slave
O monitor
x 事务
b blocking
u unblocking
c 回复完整输出后关闭连接
client Name
client setName xxx
client getName
client pause
client pause timeout (ms)
info client
info client
# Clients
connected_clients:1
client_recent_max_input_buffer:8
client_recent_max_output_buffer:0
blocked_clients:0
tracking_clients:0
clients_in_timeout_table:0
info stats
info stats
# Stats
total_connections_received:1
total_commands_processed:0
instantaneous_ops_per_sec:0
total_net_input_bytes:25
total_net_output_bytes:0
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
expired_stale_perc:0.00
expired_time_cap_reached_count:0
expire_cycle_cpu_milliseconds:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0
migrate_cached_sockets:0
slave_expires_tracked_keys:0
active_defrag_hits:0
active_defrag_misses:0
active_defrag_key_hits:0
active_defrag_key_misses:0
tracking_total_keys:0
tracking_total_items:0
tracking_total_prefixes:0
unexpected_error_replies:0
total_reads_processed:1
total_writes_processed:0
io_threaded_reads_processed:0
io_threaded_writes_processed:0
maxclients
config get maxclients
config set maxclients 500
client configuration
timeout: 默认0
maxclients: 可配置
tcp-keepalive: 默认0,可以设置为60,让redis 60s检查一次TCP连接,关闭死连
tcp-backlog: TCP握手后接受连接的队列,受操作系统 `/proc/sys/net/core/somaxconn` 影响
client exception
- 客户端连接池设置不当
- 客户端读写超时:超时时间设置过短/慢查/redis阻塞/网络
- 客户端连接超时:连接超时时间过短/tcp-backlog已满/网络
- LOADING Redis is loading the dataset in memory
- OOM command not allowed when used memory > maxmemory
- 客户端连接数:ERR max number of clients reached
Disclaimer
- License under
CC BY-NC 4.0
- Copyright issue feedback
me#imzye.me
, replace # with @ - Not all the commands and scripts are tested in production environment, use at your own risk
- No privacy information is collected here
Try iOS App