带有 Resque 和 Rails 的 Redis:使用内存时不允许使用 ERR 命令 >'最大内存' [英] Redis with Resque and Rails: ERR command not allowed when used memory > 'maxmemory'

查看:45
本文介绍了带有 Resque 和 Rails 的 Redis:使用内存时不允许使用 ERR 命令 >'最大内存'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用redis的时候报错:

When using redis, it gives me the error:

ERR command not allowed when used memory > 'maxmemory'

info 命令显示:

redis 127.0.0.1:6379> info
redis_version:2.4.10
redis_git_sha1:00000000
redis_git_dirty:0
arch_bits:64
multiplexing_api:kqueue
gcc_version:4.2.1
process_id:1881
uptime_in_seconds:116
uptime_in_days:0
lru_clock:1222663
used_cpu_sys:0.04
used_cpu_user:0.04
used_cpu_sys_children:0.00
used_cpu_user_children:0.00
connected_clients:1
connected_slaves:0
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0
used_memory:930912
used_memory_human:909.09K
used_memory_rss:1269760
used_memory_peak:931408
used_memory_peak_human:909.58K
mem_fragmentation_ratio:1.36
mem_allocator:libc
loading:0
aof_enabled:0
changes_since_last_save:4
bgsave_in_progress:0
last_save_time:1333432389
bgrewriteaof_in_progress:0
total_connections_received:1
total_commands_processed:2
expired_keys:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0
vm_enabled:0
role:master

used_memory 是否高?我是一个完整的 redis 菜鸟.如果是这样,这个问题是如何发生的,我应该如何从这里开始?同样的错误都发生在生产(Heroku)中,因此非常感谢任何帮助.谢谢.

Is the used_memory high? I'm a complete redis noob. If so, how does this problem occur and how should I proceed from here? This same error is all occurring in production (Heroku), so any help is greatly appreciated. Thank you.

推荐答案

当达到 maxmemory 限制时返回此消息.您可以使用以下命令检查当前限制是多少:

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"

结果以字节为单位.

请注意,一个空的 Redis 实例使用大约 710KB 的内存(在 Linux 上),因此如果您计划仅存储 1MB 的有用数据并强制执行此限制,那么您需要在 maxmemory 参数中设置 1734K.在配置文件中,maxmemory 设置以字节为单位,除非您使用 K,M,G 后缀.

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 将所有内容都存储在内存中(它永远不会将数据溢出到磁盘上),因此您的 Resque 队列的所有内容都必须适合.对于 Resque 引擎来说,几 MB 似乎很低.

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.

您没有指定您选择了哪个 Heroku 选项,但我的理解是 Redis To Go "nano" 选项(免费的)限制为 5 MB.

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.

这篇关于带有 Resque 和 Rails 的 Redis:使用内存时不允许使用 ERR 命令 >'最大内存'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆