Redis监控命令详解

喜夏-厌秋 提交于 2020-08-05 07:52:47

bigkeys

redis-client.exe --bigkeys

PS D:\RedisCache> .\redis-cli.exe --bigkeys

# Scanning the entire keyspace to find biggest keys as well as
# average sizes per key type.  You can use -i 0.1 to sleep 0.1 sec
# per 100 SCAN commands (not usually needed).

[00.00%] Biggest hash   found so far 'bigkeys1' with 7135 fields
[00.00%] Biggest hash   found so far 'bigkeys2' with 2555363 fields

-------- summary -------

Sampled 17 keys in the keyspace!
Total key length in bytes is 268 (avg len 15.76)

Biggest   hash found 'bigkeys2' has 2555363 fields

0 strings with 0 bytes (00.00% of keys, avg size 0.00)
0 lists with 0 items (00.00% of keys, avg size 0.00)
0 sets with 0 members (00.00% of keys, avg size 0.00)
17 hashs with 4161049 fields (100.00% of keys, avg size 244767.59)
0 zsets with 0 members (00.00% of keys, avg size 0.00)
PS D:\RedisCache>

统计当前redis中所有key值数量大小,大小百分比。

stat

redis-client.exe --stat

PS D:\RedisCache> .\redis-cli.exe --stat
------- data ------ --------------------- load -------------------- - child -
keys       mem      clients blocked requests            connections
17         5.15G    21      0       29103966 (+0)       187117
17         5.15G    21      0       29103968 (+2)       187117
17         5.15G    21      0       29103972 (+4)       187117
PS D:\RedisCache>

实时查看redis的keys(key数量)、mem(内存占用大小)、clients(客户端连接数)、blocked(锁定数)、requests(请求总数)、connections(连接总次数)。

这些统计信息复位使用config resetstat

CONFIG RESETSTAT

redis-client.exe config resetstat

PS D:\RedisCache> .\redis-cli.exe --stat
------- data ------ --------------------- load -------------------- - child -
keys       mem      clients blocked requests            connections
17         5.17G    25      0       29288926 (+0)       187507
17         5.17G    25      0       29288930 (+4)       187507
17         5.17G    25      0       29288932 (+2)       187507
PS D:\RedisCache> .\redis-cli.exe config resetstat
OK
PS D:\RedisCache> .\redis-cli.exe --stat
------- data ------ --------------------- load -------------------- - child -
keys       mem      clients blocked requests            connections
17         5.17G    25      0       13 (+0)             1
17         5.17G    25      0       15 (+2)             1
17         5.17G    25      0       18 (+3)             1
PS D:\RedisCache>

 

monitor

redis-client.exe monitor

PS D:\RedisCache> .\redis-cli.exe monitor
OK
1516846835.728873 [0 127.0.0.1:19718] "PING"
1516846847.994341 [0 127.0.0.1:44386] "HEXISTS" "KeyArea" "KEY39f644f8-748d-4347-bc7f-5a3907440a3
8"
1516846848.478710 [0 127.0.0.1:44386] "HEXISTS" "KeyArea" "KEYdf28d620-2f24-41a7-81a9-ff6d337caf9
2"
1516846848.728707 [0 127.0.0.1:52656] "PING"
PS D:\RedisCache>

实时查看redis客户端命令信息

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!