首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Heroku Memcache问题- Dalli::NetworkError: localhost:11211已关闭

Heroku Memcache问题- Dalli::NetworkError: localhost:11211已关闭
EN

Stack Overflow用户
提问于 2012-09-29 10:44:03
回答 1查看 2.3K关注 0票数 2

我最近将Rails升级到了3.2.2,现在我似乎遇到了Memcache相关的问题……有人能帮上忙吗?

我的生产配置:

代码语言:javascript
复制
config.serve_static_assets = true
config.static_cache_control = "public, max-age=2592000"
config.assets.digest = true
config.action_controller.perform_caching = true
config.cache_store = :dalli_store
config.action_dispatch.rack_cache = {
 :metastore    => Dalli::Client.new,
 :entitystore  => 'file:tmp/cache/rack/body',
 :allow_reload => false
}

Dalli gem在捆绑包中

代码语言:javascript
复制
gem 'dalli'

我已经通过herokus GUI添加了memcache插件。

我的Procfile是这样的(也安装了‘瘦’gem ):

代码语言:javascript
复制
web: bundle exec rails server -p $PORT thin -e $RACK_ENV

但是,即使我尝试在控制台中执行简单的缓存维护,我也会收到这些错误:

代码语言:javascript
复制
Loading production environment (Rails 3.2.2)
irb(main):001:0> dc = Dalli::Client.new('localhost:11211')
=> #<Dalli::Client:0x00000007501980 @servers="localhost:11211", @options={}, @ring=nil>
irb(main):002:0> dc.flush_all
localhost:11211 failed (count: 0)
Dalli::NetworkError: localhost:11211 is down:  
    from /app/vendor/bundle/ruby/1.9.1/gems/dalli-2.2.1/lib/dalli/server.rb:47:in `request'
    from /app/vendor/bundle/ruby/1.9.1/gems/dalli-2.2.1/lib/dalli/options.rb:18:in `block in request'
    from /usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
    from /app/vendor/bundle/ruby/1.9.1/gems/dalli-2.2.1/lib/dalli/options.rb:17:in `request'
    from /app/vendor/bundle/ruby/1.9.1/gems/dalli-2.2.1/lib/dalli/client.rb:158:in `block in flush'
    from /app/vendor/bundle/ruby/1.9.1/gems/dalli-2.2.1/lib/dalli/client.rb:158:in `map'
    from /app/vendor/bundle/ruby/1.9.1/gems/dalli-2.2.1/lib/dalli/client.rb:158:in `flush'
    from (irb):2
    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands/console.rb:47:in `start'
    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands/console.rb:8:in `start'
    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

当然,资产服务也在失败:

代码语言:javascript
复制
2012-09-29T02:26:29+00:00 app[web.3]: cache error: No server available
2012-09-29T02:26:29+00:00 app[web.3]: /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:80:in `block in pre_process'
2012-09-29T02:26:29+00:00 app[web.3]: /app/vendor/bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run_machine'
2012-09-29T02:26:29+00:00 app[web.3]: /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/handler/thin.rb:13:in `run'
2012-09-29T02:26:29+00:00 app[web.3]: /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:265:in `start'
2012-09-29T02:26:29+00:00 app[web.3]: /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands/server.rb:70:in `start'

这是我的配置有问题吗?这是Heroku的问题吗?

EN

回答 1

Stack Overflow用户

发布于 2012-09-29 12:54:21

删除它,因为它在默认情况下设置为那些东西...

代码语言:javascript
复制
config.action_dispatch.rack_cache = {
 :metastore    => Dalli::Client.new,
 :entitystore  => 'file:tmp/cache/rack/body',
 :allow_reload => false
}

...once你要确保你的dalli版本有这个最新版本的commit

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12649506

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档