我有一个带有maxmemory_human 6.05 G和used_memory_human的Redis集群:4.62M
我想用dump数据加强这个used_memory_human,所以我会有2G的used_memory_human
我怎么能这样做?
答案 0 :(得分:2)
有一个内置的调试命令。
debug populate 2000000 testkey 1000
这将创建200万个1kb字符串密钥。
> debug populate 2000000 testkey 1000
OK
(2.52s)
> scan 0
1) "65536"
2) 1) "testkey:1637732"
2) "testkey:510112"
3) "testkey:1313139"
4) "testkey:34729"
5) "testkey:734989"
6) "testkey:996052"
7) "testkey:223126"
8) "testkey:1578003"
9) "testkey:1335698"
10) "testkey:1151100"
> info memory
# Memory
used_memory:2185489192
used_memory_human:2.04G
used_memory_rss:2247540736
used_memory_rss_human:2.09G
used_memory_peak:2185571088
used_memory_peak_human:2.04G
答案 1 :(得分:1)
eval "for i=0,(1024*1024*20) do redis.call('set','testData:'..i,'1234567890') end" 0
used_memory_human:1.81克
eval "for i=0,(1024*1024*20) do redis.call('del','testData:'..i) end" 0
used_memory_human:574.41K