Home  >  Q&A  >  body text

redis会在一段时间内丢失数据,为什么?

我通过sadd写入set中一些数据,但是过个一两天数据就会丢失?
没有设置logfile,所以日志暂时看不到。
初学redis,还不太懂。

巴扎黑巴扎黑2733 days ago880

reply all(4)I'll reply

  • 天蓬老师

    天蓬老师2017-04-25 09:04:27

    Check if the memory is not enough. If the memory is not enough, redis will recycle the memory. The specific strategy is as follows:
    volatile-lru: Select from the data set (server.db[i].expires) with an expiration time set The least recently used data is eliminated
    volatile-ttl: Select the data to be expired from the data set (server.db[i].expires) with an expiration time set.
    volatile-random: From the data set with an expiration time set (server.db[i].expires) Server.db[i].expires) arbitrarily select data to eliminate
    allkeys-lru: Select the least recently used data from the data set (server.db[i].dict) to eliminate
    allkeys-random: Select from the data set (server .db[i].dict) to eliminate any selected data
    no-enviction (eviction): prohibit the eviction of data

    reply
    0
  • ringa_lee

    ringa_lee2017-04-25 09:04:27

    Is certain data lost or all redis data lost?

    If it is all, there may be a task to clear redis regularly.
    If there is only a part of the data in the set, it may only be deleted manually.

    Only the key type has expiration time. Collection no.

    Look at the log.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-25 09:04:27

    There should be an expiration date, I don’t know much about it

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-25 09:04:27

    http://huangyunbin.iteye.com/blog/1894583

    reply
    0
  • Cancelreply