当我在开发模式下执行命令时,使用以下命令可以正常工作
bundle exec sidekiq -C config/sidekiq.yml
但是当我添加生产标志以及如下命令时
bundle exec sidekiq -e production -C config/sidekiq.yml
Sidekiq 无法启动且长错误消息如下所示
/home/ubuntu/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/home/ubuntu/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli.rb:27:in `dispatch'
/home/ubuntu/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/home/ubuntu/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli.rb:18:in `start'
/home/ubuntu/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/exe/bundle:30:in `block in <top (required)>'
/home/ubuntu/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/home/ubuntu/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/exe/bundle:22:in `<top (required)>'
/home/ubuntu/.rbenv/versions/2.5.3/bin/bundle:23:in `load'
/home/ubuntu/.rbenv/versions/2.5.3/bin/bundle:23:in `<main>'
/home/ubuntu/.rbenv/versions/2.5.3/bin/ruby_executable_hooks:24:in `eval'
/home/ubuntu/.rbenv/versions/2.5.3/bin/ruby_executable_hooks:24:in `<main>'
我在具有 ubuntu 18.4 OS 版本的 AWS-EC2 实例上运行这些命令。
文件 config/sidekiq.yml 的内容-
:verbose: false
:concurrency: 10
:pidfile: tmp/pids/sidekiq.pid
:queues:
- [critical, 2]
- default
- low
production:
:concurrency: 25
staging:
:concurrency: 15
文件 config/initialzers/sidekiq.rb 的内容
Sidekiq.configure_server do |config|
config.redis = { url: 'redis://127.0.0.1:6379' }
end
Sidekiq.configure_client do |config|
config.redis = { url: 'redis://127.0.0.1:6379' }
end
文件 config/redis.yml 的内容
development: 'redis://127.0.0.1:6379'
test: 'redis://127.0.0.1:6379'
production: 'redis://127.0.0.1:6379'