我一直在尝试让resque和heroku一起工作。我可以成功地让它在开发模式下工作,但是当我尝试推送到heroku时,我得到
Errno::ECONNREFUSED (Connection refused - Unable to connect to Redis on 127.0.0.1:6379):
然后我阅读并关注了http://blog.redistogo.com/2010/07/26/resque-with-redis-to-go/
我将列出的配置放在站点中,但得到以下错误
SocketError (getaddrinfo: nodename nor servname provided, or not known):
我在我的初始化器中输入了/resque.rb
Resque.after_fork = Proc.new { ActiveRecord::Base.establish_connection }
ENV["redis://redistogo:11111111111111111@lab.redistogo.com:9254/"] ||= "redis://heroku_username:heroku_password@host:9254/"
uri = URI.parse(ENV["redis://redistogo:1111111111111111@lab.redistogo.com:9254/"])
Resque.redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
然而,它抛出了上面提到的错误。在我的dev模式下,我也得到了这个错误。
我尝试使用我的heroku用户名(我正在使用heroku的附加组件),将我的密码设置为heroku,并将端口更改为9254。然而,我现在一直收到套接字错误。我做错了什么?
如果能帮上忙,我们将不胜感激。谢谢
更新。
@kevin
我试过了
uri = URI.parse(ENV["my_url_string"] || "redis://localhost:9254/" )
REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
在初始化器/redis.rb中也是如此,但我得到以下错误
Errno::ECONNREFUSED (Connection refused - Unable to connect to Redis on 127.0.0.1:6379):
错误中的数字是否有意义,例如127.0.0.1:6379?我已经检查了我的redis gui应用程序和heroku配置,我的端口号是9254
REDISTOGO_URL => redis://redistogo:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@lab.redistogo.com:9254/
您是否有任何其他配置设置?感谢您的帮助!
最后更新。
我修好了。真让人难以相信!我的完整解决方案是
uri = URI.parse(ENV["REDISTOGO_URL"])
REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
Resque.redis = REDIS
一字不差。它不需要显式地设置url就可以工作,因为我猜heroku已经尝试为我设置它了。
发布于 2012-05-19 17:08:58
我修好了。真让人难以相信!我的完整解决方案是
uri = URI.parse(ENV["REDISTOGO_URL"])
REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
Resque.redis = REDIS
一字不差。它不需要显式地设置url就可以工作,因为我猜heroku已经尝试为我设置它了。
发布于 2015-06-09 12:15:44
我得到了同样的东西,所以,基本上Sidekiq不是从vars那里抓取REDISCLOUD_URL,它是从REDIS_PROVIDER抓取。
heroku config:set REDIS_PROVIDER=REDISCLOUD_URL
它就像一个护身符一样有效。
https://stackoverflow.com/questions/10661026
复制相似问题