如何让Redis从Heroku开始?

我已经在Heroku上添加了Redistogo nano附加组件,并且我已经在控制台中成功测试了它。 但是,当我的应用程序尝试与Redis连接时,我收到以下错误:

Heroku日志文件:

 2011-10-12T08:19:50+00:00 app[web.1]: Errno::ECONNREFUSED (Connection refused - Unable to connect to Redis on 127.0.0.1:6379): 2011-10-12T08:19:50+00:00 app[web.1]: app/controllers/sessions_controller.rb:14:in `create' 

为什么要尝试在localhost上访问Redis?

config / initializers文件夹中的我的Redis.rb有这个,这几乎肯定是问题所在。

 #What's pasted below is pasted ad verbatim. I don't know what to change the values to. uri = URI.parse(ENV["REDISTOGO_URL"]) REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password) 

你在使用Resque吗? 如果是这样,你需要告诉Resque使用哪个Redis。

 Resque.redis = REDIS 

如果没有,那么您发布的代码不会设置您的REDIS连接。

试试这个:

 heroku config --long | grep REDIS 

看看你的REDISTOGO_URL是什么。 你可能会意外地设置它。