Heroku崩溃(似乎是Sidekiq/Redis)

Heroku崩溃(似乎是Sidekiq/Redis),redis,ruby-on-rails-5,sidekiq,Redis,Ruby On Rails 5,Sidekiq,在Heroku上启动应用程序时,我遇到以下问题: 2018-02-20T23:55:19.456182+00:00 heroku[worker.1]: Starting process with command `bundle exec sidekiq -e production -C config/sidekiq.yml` 2018-02-20T23:55:20.180974+00:00 heroku[worker.1]: State changed from starting to up 2

在Heroku上启动应用程序时,我遇到以下问题:

2018-02-20T23:55:19.456182+00:00 heroku[worker.1]: Starting process with command `bundle exec sidekiq -e production -C config/sidekiq.yml`
2018-02-20T23:55:20.180974+00:00 heroku[worker.1]: State changed from starting to up
2018-02-20T23:55:23.590432+00:00 app[worker.1]: 4 TID-78no8 INFO: Booting Sidekiq 4.2.10 with redis options {:url=>"redis://h:REDACTED@ec2-34-252-234-97.eu-west-1.compute
.amazonaws.com:27639"}
2018-02-20T23:55:24.455410+00:00 heroku[worker.1]: Process exited with status 1
2018-02-20T23:55:24.466303+00:00 heroku[worker.1]: State changed from up to crashed
2018-02-20T23:55:24.271262+00:00 app[worker.1]: I, [2018-02-20T23:55:24.271106 #4]  INFO -- : DB Connection Pool size for Sidekiq Server before disconnect is: 1
2018-02-20T23:55:24.274465+00:00 app[worker.1]: could not connect to server: No such file or directory
2018-02-20T23:55:24.274469+00:00 app[worker.1]:         Is the server running locally and accepting
2018-02-20T23:55:24.274471+00:00 app[worker.1]:         connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
redis似乎有问题,但无法找出问题所在

sidekiq.yml

development:
  :concurrency: 5
production:
  :concurrency: 20
:queues:
  - default
  - mailers
Procfile

web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -e production -C config/sidekiq.yml
配置变量

REDIS_URL   redis://h:pe........stuff.here..........9fa3@ec2-34-252-234-97.eu-west-1.compute.amazonaws.com:27639
Redis.rb

$redis = Redis.new(url: ENV["REDIS_URL"])

仔细阅读错误:

服务器是否在本地运行并接受 Unix域套接字上的连接“/var/run/postgresql/.s.PGSQL.5432”


您的数据库配置错误。

什么类型的初始错误消息将my sidekiq.rb initializer文件更改为:

if Rails.env.production?
  Sidekiq.configure_client do |config|
    config.redis = { url: ENV['REDIS_URL'], size: 1}
  end
  Sidekiq.configure_server do |config|
    config.redis = { url: ENV['REDIS_URL']}
  end
end

谢谢你,迈克。发现了一个类似的线索,但没有真正的帮助。当我在我的应用程序上运行控制台时,我可以查询数据库。我猜数据库可以正确配置,但不同服务之间的一些访问不能正常工作?好的Heroku文档提到了这个问题,它似乎是一个“$path”问题。我对这类问题知之甚少,但会进一步研究。好的,修复了。我按照上面的线程删除了sidekiq配置中的块。现在我得到了一些错误“ERR max number of clients reacted”(达到的最大客户数),并在这里得到了您的解释迈克:它是否仍然像2012年写的那样有效?网络上有关于这方面的好教程吗?我将在这方面写一个新问题。你是如何解决这个问题的?我遇到了同样的问题。我的问题来自Sidekiq初始化文件。我在网上学习了一个教程,其中提供了“错误”代码。我现在正在回答我的问题,你可以试试……我实际上刚刚找到了答案——未来的任何人,这篇文章都解决了我的问题。这是一个不错的数据库配置。哦,是的,这可能是Redis的问题。但就我而言,Redis还行。(在我发现问题在于Sidekiq初始值设定项之前,我对Redis进行了所有可能的调整…)很有趣。我在一个PS db上遇到了同样的错误,它已经运行了一年多没有问题了,所以我知道配置没有错