Home  >  Q&A  >  body text

缓存 - 关于REDIS持久化

设置持久化后,如果内存满了,REDIS是怎么处理的?比如内存8G,硬盘也会只保存8G的东西吗?开始我认为不是以为内存满了会把一些冷数据继续打到硬盘,最近听一朋友说实际不是这样的。到底打到硬盘没呢?

ringa_leeringa_lee2759 days ago805

reply all(3)I'll reply

  • 阿神

    阿神2017-04-24 09:15:27

    Persistence should have nothing to do with whether the memory is full. When the memory usage reaches the maxmemory value, Redis will use the maxmemory-policy configuration rule to recycle memory: http://www.redis.cn/topics/lru-cache.html
    For more information about persistence, please refer to: http: //www.redis.cn/topics/persistence.html.

    reply
    0
  • 怪我咯

    怪我咯2017-04-24 09:15:27

    No, there are two ways to persist: one is to copy the current library and the other is to record commands. The former is used by default, and the latter is used in actual use

    reply
    0
  • 迷茫

    迷茫2017-04-24 09:15:27

    Two ways.
    1. RDB persistence file (binary compressed file) (enabled by default), RDB will block the redis thread when executing persistence.

    2. AOF persistent write command (after being enabled, it takes priority over RDB).

    reply
    0
  • Cancelreply