search

Home  >  Q&A  >  body text

Redis挂掉,缓存丢失了后续怎么处理?

如果服务器挂了或重启了,缓存丢失了,有什么措施吗?

数据已经持久化了,

类似用redis实现关注功能, 如果缓存丢失,就会影响程序应用逻辑

伊谢尔伦伊谢尔伦2774 days ago1059

reply all(8)I'll reply

  • 天蓬老师

    天蓬老师2017-04-24 09:15:45

    Mainly depends on whether you use redis as a cache or nosql. If it is a cache, it does not matter if you lose it. Just restore and rebuild from somewhere else. If it is nosql, redis has snapshot and aof mechanisms to ensure data persistence. of

    reply
    0
  • PHP中文网

    PHP中文网2017-04-24 09:15:45

    If it is a cache, then the application logic will not be affected if the cache is lost.

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-24 09:15:45

    Recover from aof file

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-24 09:15:45

    Since it is a cache, my understanding is that it doesn’t matter if it is lost.
    If it is some user login data, sessionetc., then the user can only be asked to log in again.
    If it is persisted, you can consider recovering from persistence

    reply
    0
  • 高洛峰

    高洛峰2017-04-24 09:15:45

    It doesn’t matter if the cache is lost but the data has been persisted. In the worst case, you can just rebuild the cache. If it is redis, it can be restored from an aof file. As a cache, it can also be restored using an rdb file. The rdb restore should be faster.

    reply
    0
  • 高洛峰

    高洛峰2017-04-24 09:15:45

    If it hangs, just restart it. The cache can be hanged. It’s just that the system is under greater pressure.

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-24 09:15:45

    Since it has been persisted, there is nothing to worry about. The redis persistence should be an aof or rdb file. You can just restart and restore it. As for the specific earphone operation, there are detailed articles on the Internet for reference.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-24 09:15:45

    Generally, programs with good design will automatically start the recache logic

    reply
    0
  • Cancelreply