Capistrano部署后如何检测孤立的sidekiq进程? [英] How to detect orphaned sidekiq process after capistrano deploy?

查看:72
本文介绍了Capistrano部署后如何检测孤立的sidekiq进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Rails 4.2应用程序,该应用程序沿着sidekiq进程运行以处理长任务。

We have a Rails 4.2 application that runs alongisde a sidekiq process for long tasks.

以某种方式,在几周前的部署中,有些东西向南移动(capistrano部署进程没有有效地停止它,无法弄清原因),剩下一个孤立的sidekiq进程正在运行,该进程正在与当前进程竞争在redis队列上的工作。由于此过程源已经过时,因此开始在我们的应用程序上给出随机结果(取决于捕获该工作的过程),我们很难解决这个问题。

Somehow, in a deploy a few weeks ago something went south (the capistrano deploy process didn't effectively stopped it, wasn't able to figure out why) and there was left an orphaned sidekiq process running that was competing with the current one for jobs on the redis queue. Because this process source became outdated it started giving random results on our application (depending on which process captured the job) and we got a very hard time until we figured this out..

如何阻止这种情况再次发生?我的意思是,每次部署后我都可以进入VPS并运行 ps aux |。 grep sidekiq 检查是否有多个..但这不实际。

How I can stop this from happenning ever again? I mean, I can ssh into the VPS after every deploy and run ps aux | grep sidekiq to check if there is more than one.. but it's not practical.

推荐答案

使用您的初始化系统可以管理Sidekiq,而不是Capistrano。

Use your init system to manage Sidekiq, not Capistrano.

https://github.com/mperham/sidekiq/wiki/Deployment#running-your-own-process

这篇关于Capistrano部署后如何检测孤立的sidekiq进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆