Redis从节点和主节点中key的数量不同是为什么
2016-09-24 16:27
218 查看
原文地址:http://redis.io/topics/faq
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.
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.
相关文章推荐
- Zookeeper集群节点数量为什么要是奇数个?
- Redis实战《红丸出品》1.2 为什么选择Key-Value Store
- redis 最大key和elements数量
- 北斗有 35 颗卫星,而 GPS 有 24 颗卫星,为什么二者数量不同?
- Redis 优势以及与其他key-value存储的不同
- Zookeeper节点数量为什么建议是奇数个
- 在Unix系统中,主存索引节点和辅存索引节点从内容上比较有什么不同,为什么要设置主存索引节点?
- 为什么使用 Redis及其产品定位
- Redis的安装与使用(单节点)
- Redis集群管理之Redis Cluster集群节点增减
- 将JTree的每个节点设置成不同的图标
- Key-Value数据库--redis
- 【JQuery学习笔记二】利用JQuery完成不同的文档和节点操作!
- 通过nginx_lua实现根据请求参数分发道不同后端节点
- 统计文件中某字段不同类别的数量
- MySQL的Replace into 与Insert into ..... on duplicate key update ...真正的不同之处
- 【redis】WRONGTYPE Operation against a key holding
- NoSql之key-value数据库------腾讯CKV海量分布式存储系统(其中有和memcache, redis的对比)
- redis 一二事 - 设置过期时间,以文件夹形式展示key显示缓存数据
- apache和tomcat有什么不同,为什么要整合apache 和tomcat?