–bigkeys
redis-cli -h <host> -p <port> -n <db> --bigkeys
这条命令会从指定的 Redis DB 中持续采样,实时输出当时得到的 value 占用空间最大的 key 值,并在最后给出各种数据结构的 biggest key 的总结报告:
user $ redis-cli -h myhost -p 12345 --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 ‘idx:同类项‘ with 1 fields [00.00%] Biggest hash found so far ‘idx:格点‘ with 3 fields [00.00%] Biggest hash found so far ‘idx:任意‘ with 14 fields [02.29%] Biggest hash found so far ‘idx:设‘ with 16 fields [02.29%] Biggest hash found so far ‘idx:4‘ with 69 fields [04.45%] Biggest set found so far ‘indexed_word_set‘ with 1482 members [05.93%] Biggest hash found so far ‘idx:c‘ with 159 fields [11.79%] Biggest hash found so far ‘idx:的‘ with 196 fields -------- summary ------- Sampled 1484 keys in the keyspace! Total key length in bytes is 13488 (avg len 9.09) Biggest set found ‘indexed_word_set‘ has 1482 members Biggest hash found ‘idx:的‘ has 196 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) 2 sets with 1710 members (00.13% of keys, avg size 855.00) 1482 hashs with 6731 fields (99.87% of keys, avg size 4.54) 0 zsets with 0 members (00.00% of keys, avg size 0.00)
这条命令给出的 "big key" ,是值得去分析一下的。
原文地址:https://www.cnblogs.com/weifeng1463/p/10427054.html
时间: 2024-11-08 21:33:12