Redis with Resque and Rails: ERR command not allowed when used memory > 'maxmemory'

前端 未结 2 1036
灰色年华
灰色年华 2021-02-04 00:47

When using redis, it gives me the error:

ERR command not allowed when used memory > \'maxmemory\'

The info command reveals:

         


        
相关标签:
2条回答
  • 2021-02-04 01:07

    This message is returned when maxmemory limit has been reached. You can check what the current limit is by using the following command:

    redis 127.0.0.1:6379> config get maxmemory
    1) "maxmemory"
    2) "128000000"
    

    The result is in bytes.

    Please note an empty Redis instance uses about 710KB of memory (on Linux), so if you plan to store only 1MB of useful data and enforce this limit, then you need to set 1734K in maxmemory parameter. In the configuration file, the maxmemory setting is in bytes, except if you use a K,M,G suffix.

    Redis stores everything in memory (it never spills data on the disk), so all the content of your Resque queues has to fit. A few MB seem very low for a Resque engine.

    You did not specify which Heroku option you selected, but my understanding is Redis To Go "nano" option (the free one) limit is 5 MB.

    0 讨论(0)
  • 2021-02-04 01:24

    Great answer by Didier, these are just the steps to increase it:

    redis-cli
    127.0.0.1:6379> config get maxmemory
    1) "maxmemory"
    2) "67108864" # (67mb) this will be different in your case
    

    This is how to change it:

    127.0.0.1:6379> config set maxmemory 100mb
    OK
    127.0.0.1:6379> config set maxmemory-policy allkeys-lru
    OK
    127.0.0.1:6379> config get maxmemory
    1) "maxmemory"
    2) "104857600"
    
    0 讨论(0)
提交回复
热议问题