如果 Sphinx 搜索未运行,如何重新启动
我想编写一个 cron 作业来检查 sphinx 搜索是否正在运行。如果没有运行,它将重新启动。我该怎么做?我假设我必须使用 search.pid(它有进程 ID)和一些 bash 脚本。
谢谢
I want to write a cron job which will check if sphinx search is running or not. If not running, it will restart. How can I do this? I am assuming I will have to use the search.pid( which has the process id) and some bash script.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
提示:使用为此设计的服务,例如: http://mmonit.com/monit/
这将需要为您照顾细节。
sphinx 的现成插件可用
http://capitate.rubyforge.org/recipes/sphinx-monit.html
(否则 - 是的,检查 pidfile 以查找 searchd 的预期 pid。检查 searchd 是否确实在该 pid 上运行。如果未找到 pid 文件 - 或 searchd 未运行,如果失败,请向管理员发送一封听起来惊慌失措的电子邮件)
Tip: use a service designed for this, eg: http://mmonit.com/monit/
It will take care of the gritty details for you.
Ready to use plugins for sphinx are available
http://capitate.rubyforge.org/recipes/sphinx-monit.html
(otherwise - yes, inspect the pidfile to find the expected pid of searchd. Check if searchd is actully running on that pid. If the pid file is not found - or searchd is not running, start it. If that fails, send the administator a panicky sounding email)