使用hbase刷solr数据时,可能是因为使用了多线程提交solr,导致后台报错,但solr中的记录并没有添加失败。
代码如下:
solrTemplate.saveBean(object);
solrTemplate.softCommit();
错误如下:
org.springframework.data.solr.UncategorizedSolrException: Error from server at http://192.168.110.196:8983/solr/harvewifi: Error opening new searcher. exceeded limit of maxWarmingSearchers=2, try again later.; nested exception is org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://192.168.110.196:8983/solr/harvewifi: Error opening new searcher. exceeded limit of maxWarmingSearchers=2, try again later.
at org.springframework.data.solr.core.SolrTemplate.execute(SolrTemplate.java:172)
at org.springframework.data.solr.core.SolrTemplate.softCommit(SolrTemplate.java:533)
at cn.com.idea.harvewifi.web.aspect.SolrAddIndexAspect.buildSolrIndex(SolrAddIndexAspect.java:658)
at cn.com.idea.harvewifi.web.aspect.SolrAddIndexAspect.addIndex(SolrAddIndexAspect.java:683)
at cn.com.idea.harvewifi.web.aspect.SolrAddIndexAspect.addObjectIndex(SolrAddIndexAspect.java:90)
at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:620)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:602)
at org.springframework.aop.aspectj.AspectJAfterReturningAdvice.afterReturning(AspectJAfterReturningAdvice.java:62)
at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:53)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
at com.sun.proxy.$Proxy193.addIndex(Unknown Source)
at cn.com.idea.harvewifi.web.service.impl.RefreshDataServiceImpl$1.run(RefreshDataServiceImpl.java:113)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://192.168.110.196:8983/solr/harvewifi: Error opening new searcher. exceeded limit of maxWarmingSearchers=2, try again later.
at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:577)
at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:241)
at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:230)
at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:149)
at org.apache.solr.client.solrj.SolrClient.commit(SolrClient.java:522)
at org.apache.solr.client.solrj.SolrClient.commit(SolrClient.java:544)
at org.springframework.data.solr.core.SolrTemplate$13.doInSolr(SolrTemplate.java:536)
at org.springframework.data.solr.core.SolrTemplate$13.doInSolr(SolrTemplate.java:533)
at org.springframework.data.solr.core.SolrTemplate.execute(SolrTemplate.java:168)
... 20 more
解决方案:
修改harvewifi/conf/solrconfig.xml
中的maxWarmingSearchers配置,由2调高,如10
<maxWarmingSearchers>10</maxWarmingSearchers>