我是靠谱客的博主 笑点低灰狼,这篇文章主要介绍[Bugfix]Error opening new searcher. exceeded limit of maxWarmingSearchers=2, try again later.,现在分享给大家,希望可以做个参考。

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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.impl.ConcurrentUpdateSolrClient.request(ConcurrentUpdateSolrClient.java:354) at org.apache.solr.client.solrj.SolrClient.request(SolrClient.java:1219) at org.apache.solr.update.SolrCmdDistributor.doRequest(SolrCmdDistributor.java:299) at org.apache.solr.update.SolrCmdDistributor.access$000(SolrCmdDistributor.java:53) at org.apache.solr.update.SolrCmdDistributor$1.call(SolrCmdDistributor.java:286) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor$1.run(ExecutorUtil.java:231) 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)

问题:solr 提交报错
场景:客户端使用spring-data-solr save()方法提交数据
查看源码

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
@Override public <S extends T> S save(S entity) { Assert.notNull(entity, "Cannot save 'null' entity."); registerTransactionSynchronisationIfSynchronisationActive(); this.solrOperations.saveBean(entity); //这步commit了 commitIfTransactionSynchronisationIsInactive(); return entity; } private void commitIfTransactionSynchronisationIsInactive() { if (!TransactionSynchronizationManager.isSynchronizationActive()) { this.solrOperations.commit(); } } public static boolean isSynchronizationActive() { return synchronizations.get() != null; } public static void initSynchronization() throws IllegalStateException { if(isSynchronizationActive()) { throw new IllegalStateException("Cannot activate transaction synchronization - already active"); } else { logger.trace("Initializing transaction synchronization"); synchronizations.set(new LinkedHashSet()); } }

结论spring-data-solr在save的时候 如果没有设置事务管理 会直接执行solrClient.commit()方式(硬提交)
解决方案:
方案1:设置事务
方案2:弃用spring-data-solr 改为源生solrj
直接调用solrClient.addBeans(args);
(只add 不提交,提交的动作由solr服务端决定)
配置solrconfig.xml

复制代码
1
2
3
4
5
6
7
8
9
10
11
<!-- softAutoCommit is like autoCommit except it causes a 'soft' commit which only ensures that changes are visible but does not ensure that data is synced to disk. This is faster and more near-realtime friendly than a hard commit. 2分钟提交一次 --> <autoSoftCommit> <maxTime>${solr.autoSoftCommit.maxTime:120000}</maxTime> </autoSoftCommit>

PS:因为没用过spring-data-solr 且项目紧 采用了方案2
有用过spring-data-solr的同学 说下怎么配置事务呢 听说要设置data-source?

最后

以上就是笑点低灰狼最近收集整理的关于[Bugfix]Error opening new searcher. exceeded limit of maxWarmingSearchers=2, try again later.的全部内容,更多相关[Bugfix]Error内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(66)

评论列表共有 0 条评论

立即
投稿
返回
顶部