solr 增加索引,出现找不到段文件

在 solr 应用的 slave 机上频繁地提交文档做索引,偶尔出现找不到段文件的错误,一星期 到 二星期一次,其它两台相同的应用又不会。

提交文档时的错误:

org.apache.solr.common.SolrException: Internal Server Error

Internal Server Error

request: http://localhost:8080/solr/update?wt=javabin&version=2.2
at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:343)
at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:183)
at org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateRequest.java:217)
at com.chenlb.solr.indexing.SolrIndexServer$PostThread.run(SolrIndexServer.java:275)
...

tomcat 的日志

2009-8-24 9:26:01 org.apache.solr.common.SolrException log
严重: java.io.FileNotFoundException: /data/solr/data/index/segments_1x0u (No such file or directory)
at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:212)
at org.apache.lucene.store.FSDirectory$FSIndexInput$Descriptor.<init>(FSDirectory.java:552)
at org.apache.lucene.store.FSDirectory$FSIndexInput.<init>(FSDirectory.java:582)
at org.apache.lucene.store.FSDirectory.openInput(FSDirectory.java:488)
at org.apache.lucene.store.FSDirectory.openInput(FSDirectory.java:482)
...

查看索引内容的段文件是 segments_1x0o,还报的是 segments_1x0u 文件才是段文件。

已经做好了拉索引与提交文档索引不会同时进行的控制。

为什么会索引记录的段文件名不正确呢?这个问题现在难回答,也可能拉索引的时候传输的问题?“控制”做索引的程序不好?

还没找到有说服力的答案,那也得解决这问题。


1、关闭 tomcat(或停止 tomcat 的solr实例)。
2、删除索引目录,同时也删除快照。清空 logs/snapshot.current 文件的内容,用 echo "" > logs/snapshot.current
3、启动 tomcat (或启动 tomcat 的solr实例)
4、手动从主机上拉一份索引,并安装。

bin/snappuller -v
....
bin/snapinstaller -v
....

原文地址:https://www.cnblogs.com/wycg1984/p/1578783.html