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>