Sphinx找不到索引文件的解决办法

Sphinx某些时候会找不到搜索结果,使用seach命令进行搜索时发现有如下错误:

 

index 'xxx': search error: failed to open /data/html/index/xxx.sph: No such file or directory

 

到该目录下发现出现很多名为xxx.new.sph, xxx.new.spa, xxx.new.spm等文件,

而sphinx配置文件中写的索引路径为/data/html/index/xxx。

 

可以确定是search寻找的是xxx.sph文件,而indexer或searchd将索引文件命名为xxx.new.sph造成无法检索。

 

这个问题出现的原因和indexer rotate工作方式有关,具体可以参考http://www.sphinxsearch.com/forum/view.html?id=274。

原因引用如下:

解决方式为:

searchd --stop # 先停掉searchd,注意如果采用kill的方式,要保证/var/log/searchd.pid文件的一致性

index --all # 重建所有索引,可以看到xxx.sph文件又回来了

searchd # 启动searchd服务

index --all --rotate # 试试用rotate命令重建索引

 

posted @ 2010-05-18 10:59  javawebsoa  Views(402)  Comments(0Edit  收藏  举报