monit 中进程组的滚动重启
有人对我如何使用 monit 实现进程组的滚动重启有任何建议吗?
提前致谢, 福特尔
Does anyone have any suggestions of how I might go about achieving a rolling restart of a process group using monit?
Thanks in advance,
fturtle
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定你说的是哪个服务器。但我可以为您提供一个 Thin 的示例,它本身支持滚动重启。 (选项
onebyone:true
)因此,对于monit,您可以使用类似的内容,
if ... then exec '/path/to/thin_restart.sh'
和
thin_restart .sh
类似于,thin.yml 的内容类似于,
还有其他方法可以根据 pid 微调此重新启动。您可以使用 pid 监视文件,并根据条件仅重新启动那些瘦进程。
例如,
另一种方法是使用 monit 提供的组。
扩展上面的例子。
因此,现在您可以执行以下操作来重新启动全部:
或者要实现某种滚动重新启动,先重新启动奇数,然后重新启动偶数。
仅重新启动奇数:
并重新启动偶数:
I'm not sure for which server you are talking about. But I can provide you an example for thin which supports rolling restart itself. (option
onebyone: true
)So for monit you can use something like,
if ... then exec '/path/to/thin_restart.sh'
And
thin_restart.sh
would be something like,And contents of thin.yml would look like,
There are other ways to fine tune this restarts based on pid. You can monitor files with pids and restart only those thin process based on conditions.
e.g.
The other way would be of using groups which monit provides.
Extending above example.
So now you can do following to restart all:
or to achieve sort of rolling restart, restart odd ones then even.
To restart only odd ones:
and to restart even: