How to debug the error “OOM command not allowed when used memory > 'maxmemory'” in Redis?

前端 未结 7 1455
囚心锁ツ
囚心锁ツ 2020-12-28 13:58

I\'m getting \"OOM command not allowed\" when trying to set a key, maxmemory is set to 500M with maxmemory-policy \"volatile-lru\", I\'m setting T

相关标签:
7条回答
  • 2020-12-28 14:20

    For such a problem, consider increasing your maxmemory in redis.conf file. It helped me.

    like maxmemory was 21000000 for me then I changed it to 31000000. Hope it helps.

    0 讨论(0)
  • 2020-12-28 14:31

    TO debug this issue, need to check that what action you performed on the redis-cli manually or somewhere from the code.

    1. It might be possible you ran keys * and you have very less memory to accommodate memory consumed by this command. This leads to throttling to cache service.
    2. In code, your changes might impact key insertion and duplicate or unique data in the db and this leads to overall memory exceed in the system.
    0 讨论(0)
  • 2020-12-28 14:36

    My problem was that old data wasn't being released and it caused the redis db to get jammed up quickly. in Python, I cleared the cache server by running

    red = redis.StrictRedis(...)
    red.flushdb()
    

    And then, limted the ttl to 24h by saving the file with "ex":

    red.set(<FILENAME>, png, ex=(60*60*24))
    
    0 讨论(0)
  • 2020-12-28 14:37

    Any chance you changed the number of databases? If you use a very large number then the initial memory usage may be high

    0 讨论(0)
  • 2020-12-28 14:38

    In our case, maxmemory was set to a high amount, then someone on the team changed it to a lower amount after data had already been stored.

    0 讨论(0)
  • 2020-12-28 14:40

    Redis' maxmemory volatile-lru policy can fail to free enough memory if the maxmemory limit is already used by the non-volatile keys.

    0 讨论(0)
提交回复
热议问题