重新索引后如何优雅地重新启动 Sphinx 搜索守护进程
我已使用 /usr/local/sphinx/bin/indexer --all --rotate 重新索引了 Sphinx 搜索,并将原始索引输出文件重命名为其他文件。仅更改传递给 $sphinx->Query($query, $index);
的索引参数不会返回任何结果。
我怀疑守护进程不知道新索引文件的存在。所以我再次运行
sudo /usr/local/sphinx/bin/searchd
尝试重新启动它。但它抛出了
致命:无法锁定pid文件'/usr/local/sphinx/var/log/searchd.pid':资源暂时不可用(searchd已经在运行?)
我不得不杀死
搜索守护进程的 2 个进程并再次启动它以从新的索引文件中抓取。有没有一种优雅的方式来重新启动它?
I've reindexed my Sphinx search with /usr/local/sphinx/bin/indexer --all --rotate
and renamed my original index output files to something else. Simply changing the index argument passed to $sphinx->Query($query, $index);
returns no results.
I suspected the daemon doesn't know the new index files exist. So I ran
sudo /usr/local/sphinx/bin/searchd
again to try to restart it. But it threw
FATAL: failed to lock pid file '/usr/local/sphinx/var/log/searchd.pid': Resource temporarily unavailable (searchd already running?)
I had to kill
the 2 processes of the search daemon and start it again to grab from the new index files. Is there a graceful way to restart it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我知道这是一个迟到的答案,但只是让你知道,要“重新启动”Sphinx,你需要停止它然后启动它(如两个不同的进程)。
要停止它,请调用
searchd --stop
,然后使用searchd
再次启动它。I know this is a late answer, but just so you know, to 'restart' Sphinx, you need to stop it then start it (as in, two distinct processes).
To stop it, call
searchd --stop
then just start it again withsearchd
.您需要在新索引上调用索引器来创建它,然后 --rotate 来更新它。
所以它会像
然后当你只想更新索引时
这将创建每个索引的临时副本并在完成后替换旧的。
有关实际情况的更多信息,请参阅 http://sphinxsearch.com/docs /manual-0.9.9.html#ref-indexer
关于您遇到的另一个错误
如果
没有返回结果,则删除 /usr/local/sphinx/var/log/searchd.pid
并再次开始搜索
You'll need to call indexer on the new index to create it and then --rotate to update it.
So it would be something like
And then when you just want to update your indexes
This will create a temporary copy of each index and replace the old ones when finished.
For more info on what actually happens see http://sphinxsearch.com/docs/manual-0.9.9.html#ref-indexer
On the other error your getting
Do
if it returns no results, then remove /usr/local/sphinx/var/log/searchd.pid
and start searchd again
searchd --stop
命令似乎存在问题,无法停止某些 Sphinx 实例上的守护进程。尝试:
service sphinxsearch stop
请参阅:https: //bugs.launchpad.net/ubuntu/+source/sphinxsearch/+bug/990395
It seems there is an issue with the
searchd --stop
command failing to stop the daemon on some instances of Sphinx.Try:
service sphinxsearch stop
See: https://bugs.launchpad.net/ubuntu/+source/sphinxsearch/+bug/990395
service searchd start
在 CentOS 上为我工作service searchd start
worked for me on CentOS