我正在开发我的应用程序搜索引擎。该搜索引擎使用 sphinx 进行全文搜索。
我创建了一个 cron 作业来负责更新索引。目前它设置为每天执行一次。
这是我在这个 cron 中所做的事情。
indexer --all --rotate > sphinx.log
有时整个搜索模块会出现故障,并在客户端应用程序上显示此错误。
Notice (1024): Search query failed: connection to 127.0.0.1:9312 failed (errno=111, msg=Connection refused) [APP/models/behaviors/sphinx.php, line 134]
在 sphinx.log 上我发现了这个错误
FATAL: failed to lock /usr/local/sphinxsearch/delta_users/delta_users.spl: Resource temporarily unavailable, will not index. Try --rotate option.
9312似乎被拒绝连接,可能是因为资源文件被其他进程使用。这仍然是随机行为。
环境部署在Linux(ubuntu)上,应用程序在cakephp上创建。 我正在尝试确定是什么原因导致它停止重新启动 sphinx 服务。我不知道这是 sphinx 配置问题还是某些 I/O 或 mysql 问题。我认为增量索引只会造成一些问题。
提前致谢。
最佳答案
问题实际上是当它旋转所有索引(即主索引和增量索引)时,它会锁定增量索引的资源文件。我将增量索引的轮换与其他负责合并增量索引的 cron 作业一起移动。
indexer delta_users delta_users_type
indexer --merge users delta_users
indexer --merge users_type delta_users_type
并且仅在不同的 cron 上分别轮换主索引
indexer --rotate -- users users_type
而不是
indexer --rotate -- all
因此,Delta 和 Main 索引的单独旋转就是分辨率。
谢谢
关于php - Sphinx 重新启动搜索恶魔问题以重新索引 Delta 索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14536194/