我们有一个主从Solr设置并仅针对从站运行实时查询。完全导入(优化)每天凌晨2点在主人身上发生。一个实体每3分钟进行一次Delta进口,另一个实体每小时进行一次,即我们的主crontab就像:
# full-import Lists entity
00 02 * * * curl "http://localhost:8080/solr/List/dataimport?command=full-import&clean=true&optimize=true&entity=Lists" > /dev/null
# delta-import Lists entity
*/5 0-1,4-23 * * * curl "http://localhost:8080/solr/List/dataimport?command=delta-import&entity=Lists" > /dev/null
# delta-import ViewedLists entity
23 0-1,4-23 * * * curl "http://localhost:8080/solr/List/dataimport?command=delta-import&entity=ViewedLists" > /dev/null
以下例外情况每天都会在我们的应用日志中出现几次:
...
org.apache.solr.client.solrj.SolrServerException: Error executing query
at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:95)
at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:118)
...
以及任意查询的类似内容:
08:26:39,430 ERROR SolrUtil:107 - SOLR QUERY (LIST): q=*:*&fq=-list_type:CONTRIBUTING AND is_source_list:false AND is_blocked_on_hpage:false&start=0&rows=8&sort=first_publish_date desc
org.apache.solr.client.solrj.SolrServerException: java.net.SocketException: Connection reset
at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:478)
at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:244)
at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:89)
at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:118)
...
如果我检查solr从服务器上tomcat中的localhost.log文件,则会同时发生以下异常:
Apr 06, 2013 7:16:33 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet default threw exception
java.lang.IllegalStateException
at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:407)
at org.apache.solr.servlet.SolrDispatchFilter.sendError(SolrDispatchFilter.java:389)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:291)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:722)
复制设置如下:
<requestHandler name="/replication" class="solr.ReplicationHandler" >
<lst name="master">
<str name="enable">${enable.master:false}</str>
<str name="replicateAfter">startup</str>
<str name="replicateAfter">commit</str>
<str name="replicateAfter">optimize</str>
<str name="confFiles">solrconfig.xml,data-config.xml,schema.xml,stopwords.txt,synonyms.txt,elevate.xml</str>
</lst>
<lst name="slave">
<str name="enable">${enable.slave:false}</str>
<str name="masterUrl">http://${master.ip}:${master.port}/solr/${solr.core.name}/replication</str>
<str name="pollInterval">00:00:10</str>
</lst>
</requestHandler>
除了完整和delta导入之外,我们还有外部文件字段,每15分钟加载一次。在主服务器和从服务器上都有reloadCache。
导致此异常的原因是什么以及如何修复它?
更新:将pollInterval
从10秒增加到1分钟。仍然看到同样的问题。另外,忘了提到错误是在很短的时间内发生在不同的查询上,所以它不依赖于查询。
更新2 :将增量导入频率降低到每10分钟一次,并减少外部文件字段加载,并将reloadCache减少到每小时一次。尽管异常的频率似乎已经降低,但仍然看到例外情况。