简体   繁体   English

Monit无法重新启动sidekiq

[英]Monit failing to restart sidekiq

I'm trying to get monit to restart my sidekiq service on CentOS server. 我正在尝试监视以在CentOS服务器上重新启动我的sidekiq服务。 After trying multiple solutions out there, I'm stumped, still failing to start the service. 在尝试了多种解决方案之后,我很困惑,仍然无法启动该服务。

My sidekiq file from monit.d: 我来自monit.d的sidekiq文件:

check process sidekiq
  with pidfile /var/www/App/tmp/pids/sidekiq.pid
  start program = "/bin/bash -l -c 'sudo cd /var/www/App && bundle exec sidekiq --index 0 --pidfile /var/www/App/tmp/pids/sidekiq.pid --environment production --logfile /var/www/App/log/sidekiq.log --daemon'" as uid deploy and gid deploy
  stop program = "/bin/bash -l -c 'cd /var/www/App && bundle exec sidekiqctl stop /var/www/App/tmp/pids/sidekiq.pid 10'" as uid deploy and gid deploy
  if totalmem is greater than 512 MB for 2 cycles then restart
  if 3 restarts within 5 cycles then timeout

If I run start program command manually, it starts the sidekiq fine but the monit doesn't seem to do anything. 如果我手动运行启动程序命令,它将启动sidekiq正常,但monit似乎无能为力。 Just comes up with: 只是想出了:

[BST Oct  6 11:51:17] error    : 'sidekiq' process is not running
[BST Oct  6 11:51:17] info     : 'sidekiq' trying to restart
[BST Oct  6 11:51:17] info     : 'sidekiq' start: /bin/bash
[BST Oct  6 11:52:47] error    : 'sidekiq' failed to start

So it is including file fine, but somehow doesn't manage to start the service from the script. 因此,它包括文件,但以某种方式无法从脚本启动服务。

What can it be? 会是什么 Some permissions issue of sorts? 一些权限问题?

You need to update to the latest Monit version (5.14). 您需要更新到最新的Monit版本(5.14)。 Remove your current monit installation and follow these instructions: 删除当前的monit安装并按照以下说明进行操作:

https://rtcamp.com/tutorials/monitoring/monit/ https://rtcamp.com/tutorials/monitoring/monit/

Hope it helps! 希望能帮助到你!

PS: Found the solution here: https://bitbucket.org/tildeslash/monit/issues/109/failed-to-stop-always-after-60-seconds PS:在这里找到解决方案: https : //bitbucket.org/tildeslash/monit/issues/109/failed-to-stop-always-after-60-seconds

according to Debugging monit 根据调试监控

I found i need set PATH. 我发现我需要设置PATH。

my start program: 我的启动程序:

/bin/bash -c 'cd /home/vagrant/apps/skylark/current; / bin / bash -c'cd / home / vagrant / apps / skylark / current; PATH=/home/vagrant/.rbenv/shims:/home/vagrant/.rbenv/bin:$PATH bundle exec sidekiq -d -e production -C -P /home/vagrant/apps/skylark/shared/tmp/pids/sidekiq.pid -L /home/vagrant/apps/skylark/shared/log/sidekiq.log' PATH = / home / vagrant / .rbenv / shims:/home/vagrant/.rbenv/bin:$ PATH包执行exec sidekiq -d -e production -C -P / home / vagrant / apps / skylark / shared / tmp / pids /sidekiq.pid -L /home/vagrant/apps/skylark/shared/log/sidekiq.log'

i think the issue is with your user. 我认为问题出在您的用户身上。 You need to execute using deploy user. 您需要使用部署用户执行。

check process sidekiq
  with pidfile /var/www/App/tmp/pids/sidekiq.pid
  start program = "/bin/su - deploy -c 'sudo cd /var/www/App && bundle exec sidekiq --index 0 --pidfile /var/www/App/tmp/pids/sidekiq.pid --environment production --logfile /var/www/App/log/sidekiq.log --daemon'" as uid deploy and gid deploy
  stop program = "/bin/su - deploy -c 'cd /var/www/App && bundle exec sidekiqctl stop /var/www/App/tmp/pids/sidekiq.pid 10'" as uid deploy and gid deploy
  if totalmem is greater than 512 MB for 2 cycles then restart
  if 3 restarts within 5 cycles then timeout

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM