2017-04-13 4 views
0

내가 사용 Heroku가 노동자에 Sidekiq을 초기화하기 위해 노력하고있어 초기화하는 없습니다 :근무 Heroku가 + Sidekiq + 포스트 그레스 + Rediscloud

if Rails.env.production? 

    Sidekiq.configure_client do |config| 
    config.redis = { url: ENV['REDISCLOUD_URL'], size: 2 } 
    end 

    Sidekiq.configure_server do |config| 
    config.redis = { url: ENV['REDISCLOUD_URL'], size: 10 } 

    Rails.application.config.after_initialize do 
     Rails.logger.info("DB Connection Pool size for Sidekiq Server before disconnect is: #{ActiveRecord::Base.connection.pool.instance_variable_get('@size')}") 
     ActiveRecord::Base.connection_pool.disconnect! 

     ActiveSupport.on_load(:active_record) do 
     config = Rails.application.config.database_configuration[Rails.env] 
     config['reaping_frequency'] = ENV['DATABASE_REAP_FREQ'] || 10 # seconds 
     # config['pool'] = ENV['WORKER_DB_POOL_SIZE'] || Sidekiq.options[:concurrency] 
     config['pool'] = 8 
     ActiveRecord::Base.establish_connection(config) 

     Rails.logger.info("DB Connection Pool size for Sidekiq Server is now: #{ActiveRecord::Base.connection.pool.instance_variable_get('@size')}") 
     end 
    end 
    end 

end 

을하지만 난 내 로그에 다음 얻을 :

2017-04-12T22:33:20.435939+00:00 heroku[worker.1]: State changed from crashed to starting 
2017-04-12T22:33:23.510593+00:00 heroku[worker.1]: Starting process with command `bundle exec sidekiq -e production -C config/sidekiq.yml` 
2017-04-12T22:33:24.049032+00:00 heroku[worker.1]: State changed from starting to up 
2017-04-12T22:33:26.528756+00:00 app[worker.1]: 4 TID-otpsq87bc INFO: Booting Sidekiq 4.2.10 with redis options {:url=>"redis://rediscloud:[email protected]:14870", :size=>20} 
2017-04-12T22:33:27.606408+00:00 heroku[worker.1]: State changed from up to crashed 
2017-04-12T22:33:27.590348+00:00 heroku[worker.1]: Process exited with status 1 
2017-04-12T22:33:27.506096+00:00 app[worker.1]: I, [2017-04-12T22:33:27.505980 #4] INFO -- : DB Connection Pool size for Sidekiq Server before disconnect is: 5 
2017-04-12T22:33:27.509172+00:00 app[worker.1]: could not connect to server: Connection refused 
2017-04-12T22:33:27.509174+00:00 app[worker.1]:  Is the server running on host "localhost" (127.0.0.1) and accepting 
2017-04-12T22:33:27.509175+00:00 app[worker.1]:  TCP/IP connections on port 5432? 

합니까를 누구가 잘못된 생각을 갖고 있니?

답변

0

localhost : 5432에서 Postgres를 찾고 있습니다.

0

나는 Heroku에서 Sidekiq를 실행하려고 할 때 동일한 문제가있었습니다. database.yml에 production: 밑에 url: <%= ENV['DATABASE_URL'] %>을 추가하여 수정했습니다.