使用monitored over monit有什么好处 [英] what is the advantage of using supervisord over monit

查看:118
本文介绍了使用monitored over monit有什么好处的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个自定义设置,其中运行了几个守护程序(Web应用程序+后台任务).我正在寻找一种服务,该服务可帮助我们监视那些守护程序,如果它们的资源消耗超过某个级别,则重新启动它们.

We have a custom setup which has several daemons (web apps + background tasks) running. I am looking at using a service which helps us to monitor those daemons and restart them if their resource consumption exceeds over a level.

对于任何一种何时比另一种更好的见解,我将不胜感激.据我了解,monit启动了一个新流程,而主管启动了一个子流程.这种方法的优缺点是什么?

I will appreciate any insight on when one is better over the other. As I understand monit spins up a new process while supervisord starts a sub process. What is the pros and cons of this approach ?

我还将使用新贵来监视监控或监视自身. Webapp部署将使用capistrano完成.

I will also be using upstart to monitor monit or supervisord itself. The webapp deployment will be done using capistrano.

谢谢

推荐答案

我没有使用过monit,但是supervisor存在一些重大缺陷.

I haven't used monit but there are some significant flaws with supervisord.

  1. 程序应在前台运行

这意味着您不能只执行/etc/init.d/apache2 start.多数情况下,您只能写一个衬纸,例如源/etc/apache2/envvars&& exec/usr/sbin/apache2 -DFOREGROUND",但有时您需要自己的包装脚本.包装脚本的问题在于,您最终有两个进程,一个父进程和一个子进程.看到下一个缺陷...

This means you can't just execute /etc/init.d/apache2 start. Most times you can just write a one liner e.g. "source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND" but sometimes you need your own wrapper script. The problem with wrapper scripts is that you end up with two processes, a parent and child. See the the next flaw...

  1. supervisord不管理子进程

如果您的程序启动子进程,则主管将不会检测到该进程.如果父进程死亡(或者如果使用supervisorctl重新启动),则子进程将继续运行,但将被初始化进程采用"并保持运行状态.这可能会阻止以后调用程序运行或消耗其他资源.应该使用最近的配置选项stopasgroup和killasgroup修复此问题,但对我不起作用.

If your program starts child process, supervisord wont detect this. If the parent process dies (or if it's restarted using supervisorctl) the child processes keep running but will be "adopted" by the init process and stay running. This might prevent future invocations of your program running or consume additional resources. The recent config options stopasgroup and killasgroup are supposed to fix this, but didn't work for me.

  1. supervisord没有依赖项管理-请参见#122

我最近用qlproxy设置了鱿鱼. qlproxyd需要先启动,否则乌贼可能会失败.即使这两个程序都在有监督的情况下进行管理,也无法确保这一点.我需要为鱿鱼编写一个启动脚本,以使其等待qlproxyd进程.添加启动脚本会导致缺陷2中所述的孤立过程问题.

I recently setup squid with qlproxy. qlproxyd needs to start first otherwise squid can fail. Even though both programs were managed with supervisord there was no way to ensure this. I needed to write a start script for squid that made it wait for the qlproxyd process. Adding the start script resulted in the orphaned process problem described in flaw 2

  1. supervisord不允许您控制两次重试之间的延迟时间

有时某个进程无法启动(或崩溃),这是因为它可能无法访问另一个资源,这可能是由于网络抖动造成的.可以将Supervisor设置为多次重新启动该过程.在重新启动之间,该过程将进入"BACKOFF"状态,但是没有文档或控制该退出的持续时间.

Sometimes when a process fails to start (or crashes), it's because it can't get access to another resource, possibly due to a network wobble. Supervisor can be set to restart the process a number of times. Between restarts the process will enter a "BACKOFF" state but there's no documentation or control over the duration of the backoff.

在其国防主管中,有80%的时间确实满足了我们的需求.配置合理,文档也不错.

In its defence supervisor does meet our needs 80% of the time. The configuration is sensible and documentation pretty good.

这篇关于使用monitored over monit有什么好处的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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