Redis集群查找大KEY

用到的是redis提供--bigkeys

只能查询单个主节点,找到所有主节点依次查询即可
随便找个节点运行一下命令,如果是从节点,会告诉你去哪个主节点运行这个命令;
此处告诉我们要去172.19.161.24:6380执行(172.19.161.23:6379是172.19.161.24:6380的从节点)

[root@test ~]# redis-cli -c -h 172.19.161.23 -p 6379 --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).

TYPE returned an error: MOVED 23 172.19.161.24:6380

执行一下,看到那些事数据大的key如果大小不正常就通知存入方解决

[root@test ~]# redis-cli -c -h 172.19.161.24 -p 6380 --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 string found so far 'APP_42_400A00' with 8 bytes
[00.00%] Biggest string found so far 'common:0C8D6' with 57 bytes
[00.00%] Biggest string found so far 'Area_46_01561' with 194 bytes
[00.00%] Biggest string found so far 'Area_2_00A338' with 197 bytes
[00.02%] Biggest string found so far 'Area_1_000A08' with 201 bytes
[00.08%] Biggest string found so far 'Area_1_0023A3' with 202 bytes
[00.29%] Biggest string found so far 'DictCity:0232' with 252 bytes
[00.45%] Biggest string found so far 'DictCity:1138' with 258 bytes
[00.50%] Biggest string found so far 'DictCity:0202' with 289 bytes
[01.01%] Biggest string found so far 'DictCommunityPoint:0549' with 517 bytes
[01.16%] Biggest string found so far 'DictCommunityPoint:0684' with 688 bytes
[03.08%] Biggest string found so far 'DictCity:6129' with 835 bytes
[11.87%] Biggest string found so far 'DictCommunityPoint:1110' with 903 bytes
[16.38%] Biggest string found so far 'DictCommunityPoint:0076' with 1621 bytes
[20.96%] Biggest list   found so far 'addLrrId' with 5 items
[34.27%] Biggest string found so far 'DictCommunityPoint:0014' with 2697 bytes
[79.76%] Biggest list   found so far 'StatusQueue_2_1' with 18 items
[79.92%] Biggest list   found so far 'Notice_166' with 81978 items

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

Sampled 321410 keys in the keyspace!
Total key length in bytes is 8930451 (avg len 27.79)

Biggest string found 'DictCommunityPoint:0014' has 2697 bytes
Biggest   list found 'Notice_166' has 81978 items

321404 strings with 20091056 bytes (100.00% of keys, avg size 62.51)
6 lists with 164024 items (00.00% of keys, avg size 27337.33)
0 sets with 0 members (00.00% of keys, avg size 0.00)
0 hashs with 0 fields (00.00% of keys, avg size 0.00)
0 zsets with 0 members (00.00% of keys, avg size 0.00)
0 streams with 0 entries (00.00% of keys, avg size 0.00)

发表评论

邮箱地址不会被公开。 必填项已用*标注