All deleted more than 95% of may keys using DEL command. The database dump file after save and bgsave is still the same as before delete. I also noticed the memory (used_memory_human:160.96M) is still as high save before. I have only 7669 keys left.
所有使用DEL命令删除了超过95%的may键。 save和bgsave之后的数据库转储文件仍然与删除前相同。我也注意到内存(used_memory_human:160.96M)仍然保存得很高。我只剩下7669把钥匙了。
Keyspace
db1:keys=7669,expires=145,avg_ttl=13314857
How to compact the memory and database after deleting the keys?
删除密钥后如何压缩内存和数据库?
2 个解决方案
#1
The size of the RDB and used_memory
are the actual amount of data you have in Redis. That means that the remaining 7669 keys take up this space - whether it is just one big key hiding among them, a few large ones or maybe all keys are about 0.05MB each.
RDB和used_memory的大小是Redis中的实际数据量。这意味着剩余的7669键占用了这个空间 - 无论它只是隐藏在它们中的一个大键,一些大键还是所有键都大约0.05MB。
#2
It sounds like you are trying to find which keys are taking the most memory in your database.
听起来您正在尝试查找哪些密钥占用了数据库中最多的内存。
This command may help you
这个命令可以帮到你
redis-cli -h hostname -p portnumber --bigkeys
redis-cli -h hostname -p portnumber --bigkeys
or redis-cli --bigkeys
if you are using the default host and port number.
或redis-cli --bigkeys如果您使用的是默认主机和端口号。
It will go through the DB and report the largest keys that it finds. It can be time consuming for large DBs with many keys but 8k keys it should run very quickly.
它将通过数据库并报告它找到的最大密钥。对于具有许多键但是8k键的大型DB来说,它应该非常耗时,它应该非常快速地运行。
#1
The size of the RDB and used_memory
are the actual amount of data you have in Redis. That means that the remaining 7669 keys take up this space - whether it is just one big key hiding among them, a few large ones or maybe all keys are about 0.05MB each.
RDB和used_memory的大小是Redis中的实际数据量。这意味着剩余的7669键占用了这个空间 - 无论它只是隐藏在它们中的一个大键,一些大键还是所有键都大约0.05MB。
#2
It sounds like you are trying to find which keys are taking the most memory in your database.
听起来您正在尝试查找哪些密钥占用了数据库中最多的内存。
This command may help you
这个命令可以帮到你
redis-cli -h hostname -p portnumber --bigkeys
redis-cli -h hostname -p portnumber --bigkeys
or redis-cli --bigkeys
if you are using the default host and port number.
或redis-cli --bigkeys如果您使用的是默认主机和端口号。
It will go through the DB and report the largest keys that it finds. It can be time consuming for large DBs with many keys but 8k keys it should run very quickly.
它将通过数据库并报告它找到的最大密钥。对于具有许多键但是8k键的大型DB来说,它应该非常耗时,它应该非常快速地运行。