简体   繁体   English

当Redis中的内存已满时,为什么数据没有保留在磁盘上?

[英]Why data is not getting persisted on disk when memory is full in redis?

In redis.conf file we have set max memory policy to eviction policy to allkeys-random and allocated 4GB as max memory. 在redis.conf文件中,我们将最大内存策略设置为逐出策略为allkeys-random,并分配了4GB作为最大内存。 We inserted 5 million keys but when we actually checked the dbsize it only showed about 2.5 million only. 我们插入了500万个密钥,但是当我们实际检查dbsize时,它仅显示了大约250万个。

So I have a question, does eviction policy removes keys from only memory or disk? 所以我有一个问题,驱逐策略是否仅从内存或磁盘中删除密钥?

Ideally whenever given maxmemory is full, the keys selected for eviction should be flushed to disk so that they can be retrieved later from disk whenever required. 理想情况下,只要给定的最大内存已满,就应将选择退出的密钥刷新到磁盘,以便以后可以在需要时从磁盘检索它们。

Conf file comments only mentions that keys will be removed, but it doesn't tell if they are removed from only memory or also from disk ie persistant store. Conf文件注释仅提到密钥将被删除,但没有说明密钥是仅从内存中还是从磁盘(即持久性存储)中删除。

Thanks. 谢谢。

Evicted keys are removed from memory. 被逐出的密钥将从内存中删除。 Disk snapshot is not touched. 磁盘快照未触及。 However, values on disk will also be gone when next snapshot is made. 但是,制作下一个快照时,磁盘上的值也将消失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM