原文地址:http://redis.io/topics/faq
My slave claims to have a different number of keys compared to its master, why?
If you use keys with limited time to live (Redis expires) this is normal behavior. This is what happens:
- The master generates an RDB file on the first synchronization with the slave.
- The RDB file will not include keys already expired in the master, but that are still in memory.
- However these keys are still in the memory of the Redis master, even if logically expired. They'll not be considered as existing, but the memory will be reclaimed later, both incrementally and explicitly on access. However while these keys are not logical part of the dataset, they are advertised in INFO output and by the DBSIZE command.
- When the slave reads the RDB file generated by the master, this set of keys will not be loaded.
As a result of this, it is common for users with many keys with an expire set to see less keys in the slaves, because of this artifact, but there is no actual logical difference in the instances content.
本文探讨了在Redis使用带有时限的键时,主从实例间出现键数量差异的原因。当主节点首次与从节点同步时,会生成不包含已过期但未释放内存的键的RDB文件,导致从节点加载后键数量少于主节点。
173万+

被折叠的 条评论
为什么被折叠?



