在开发模式下,Sidekiq运行得非常好。现在我要在生产环境中使用它,所有的作业都只是停留在排队状态,并且从未被执行。请问有谁能指引我解决这个问题的方向?
在开发模式下,Sidekiq运行得非常好。现在我要在生产环境中使用它,所有的作业都只是停留在排队状态,并且从未被执行。请问有谁能指引我解决这个问题的方向?
ps aux | grep sidekiq
如果不行的话,先尝试在前台运行sidekiq并检查输出。
bundle exec sidekiq -e production
在很多情况下,这是因为我没有在config/sidekiq.yml
中正确声明了该特定服务的队列。
提醒大家注意一下,我来到这个页面是为了找出我的Rails Sidkiq作业为什么没有从“enqueued”状态转移。
tail -f /var/www/yourappname/current/log/staging.log
确保您的应用程序 sidekiq 进程正在运行
$ ps aux | grep sidekiq
server 26813 0.0 0.0 14228 1084 pts/11 S+ 11:27 0:00 grep --color=auto sidekiq
server 27936 0.3 0.6 1178904 153240 ? Sl Apr17 46:02 sidekiq 5.2.7 app1 [0 of 10 busy]
capistrano-sidekiq
可以让你的生活更轻松:$ cap production sidekiq:start
00:00 sidekiq:start
01 $HOME/.rbenv/bin/rbenv exec bundle exec sidekiq --index 0 --pidfile /var/www/app2/shared/tmp/pids/sidekiq-0.pid --environment produ…
✔ 01 server@103.n.nnn.nnn 0.400s
并且app2进程将被激活。现在,请再次检查。
$ ps aux | grep sidekiq
server 25857 8.6 7.6 3073532 1870244 ? Sl 11:15 1:02 sidekiq 5.2.8 app2 [0 of 10 busy]
server 26813 0.0 0.0 14228 1084 pts/11 S+ 11:27 0:00 grep --color=auto sidekiq
server 27936 0.3 0.6 1178904 153240 ? Sl Apr17 46:02 sidekiq 5.2.7 app1 [0 of 10 busy]
使用 capistrano-sidekiq
gem 解决了我们的问题