我一直試圖讓Resque(與Resque服務器)& RedisToGo在Heroku(雪松)一段時間的工作了,但我一直運行到這個錯誤:Resque,Resque服務器上RedisToGo與Heroku的
Redis::CannotConnectError (Error connecting to Redis on 127.0.0.1:6379 (ECONNREFUSED)):
它在本地工作,我可以在我的應用程序Heroku的控制檯中訪問redis。
我Procfile有:
web: bundle exec thin start -p $PORT -e $RACK_ENV
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
resque: env TERM_CHILD=1 RESQUE_TERM_TIMEOUT=10 bundle exec rake resque:work
我的Gemfile有:
gem 'redis'
#Background queue
gem 'resque', '~> 1.22.0', :require => "resque/server"
的lib /任務/ resque.rake:
require 'resque/tasks'
task "resque:setup" => :environment do
ENV['QUEUE'] = '*'
end
desc "Alias for resque:work (To run workers on Heroku)"
task "jobs:work" => "resque:work"
的routes.rb:
mount Resque::Server.new, :at => "/resque"
初始化: redis.rb:
uri = URI.parse(ENV["REDISTOGO_URL"])
REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
Resque.redis = REDIS
resque.rb:
Dir["#{Rails.root}/app/workers/*.rb"].each { |file| require file }
Resque.after_fork = Proc.new { ActiveRecord::Base.establish_connection }
然後在我的應用程序/工人目錄我有類似myjob.rb
我覺得我」米在這裏的圈子,任何想法?
你能否確認你安裝了RedisToGo插件。檢查'heroku config'的輸出,並確保你有一個REDISTOGO_URL的條目 – Jonathan
你知道了嗎?我有同樣的問題。 – Kohanz