Redis 常用命令
Docker
Pubsub
monitor
监听publish
./redis-cli [-h redis_ip] monitor|grep PUBLISH
info
info stats
查看当前机器状态
# Stats
total_connections_received:3767835997
total_commands_processed:246070831196
instantaneous_ops_per_sec:14174
total_net_input_bytes:38126472731437
total_net_output_bytes:202952900174974
total_net_repl_input_bytes:313026852
total_net_repl_output_bytes:25928095587285
instantaneous_input_kbps:2031.58
instantaneous_output_kbps:12825.28
instantaneous_input_repl_kbps:0.00
instantaneous_output_repl_kbps:1073.20
rejected_connections:0
sync_full:1
sync_partial_ok:1
sync_partial_err:0
expired_keys:359292038
expired_stale_perc:0.06
expired_time_cap_reached_count:90
expire_cycle_cpu_milliseconds:3327402
evicted_keys:984382
evicted_clients:0
total_eviction_exceeded_time:7655645
current_eviction_exceeded_time:0
keyspace_hits:92545878456
keyspace_misses:31063095799
pubsub_channels:12381
pubsub_patterns:54
pubsubshard_channels:0
latest_fork_usec:7683
total_forks:1
migrate_cached_sockets:0
slave_expires_tracked_keys:0
pubsub_channels:表示订阅的channels总数。重复的算一个
pubsub_patterns:表示模糊订阅总次数。重复的算二个,与pubsub_channels统计方式不同
client list
查看pattern订阅信息
此命令过滤掉psub=0的信息,主要应用于查看哪些客户端订阅了模糊匹配
./redis-cli [-h redis_ip] client list |grep -v psub=0
id=3746373812 addr=:47518 laddr=:6379 fd=4545 name= age=139429 idle=0 flags=P db=0 sub=10902 psub=1 ssub=0 multi=-1 qbuf=0 qbuf-free=20474 argv-mem=0 multi-mem=0 rbs=16384 rbp=11765 obl=0 oll=0 omem=0 tot-mem=496424 events=r cmd=psubscribe user=default redir=-1 resp=2