如何防止 Solr 在重新启动时执行删除索引的提交
How to Prevent Solr from doing commit on restart that deletes the index
**更新
据我所知,在主机上完成的删除和重建提交被缓存,然后当索引被复制到另一台机器并重新启动 solr 时,它会以某种方式在某处找到那些缓存的提交并在启动时运行它们。这对我们不利,因为 solr 在重做那些缓存的提交时被清理了。
如何禁用它?
**原创
我们最近从 Solr 3 更改为 Solr 8。
索引是在一台机器上建立的,然后复制到另外4台机器上。
这是一个 'static' 产品列表。大约每周一次,我们删除并重建机器 1 上的索引并复制到其他机器,然后在这些机器上重新启动 solr。在重建之间未修改(添加或删除)索引。
对于 Solr 3,当我们在复制新索引后重新启动 Solr 时,一切都会按我们预期的那样运行。它只会使用我们复制的索引。
现在使用 Solr 8,我们发现重新启动其他机器会导致 DirectUpdateHandler2/LogUpdateProcessorFactory 到 "REMOVE ALL DOCUMENTS FROM INDEX",执行提交并发送删除查询。
这永远不会发生在建立索引的机器上,只有我们的从属机器上才会发生索引被复制到的机器。
我们认为在我们的案例中不需要复制,因为索引保持静态,而且我们将索引同步到其他机器更简单。
我无法找到 solrconfig.xml 中需要更改的内容以防止它在启动时发送 deleteByQuery。似乎只有在我们上次重建索引后已经过去了足够长的时间后才会这样做。
配置中为空:
<updateHandler class="solr.DirectUpdateHandler2">
</updateHandler>
**这没有什么不同
我刚刚添加了这个希望它会有所作为:
<deletionPolicy class="solr.SolrDeletionPolicy">
<!-- The number of commit points to be kept -->
<str name="maxCommitsToKeep">1</str>
<!-- The number of optimized commit points to be kept -->
<str name="maxOptimizedCommitsToKeep">0</str>
<!--
Delete all commit points once they have reached the given age.
Supports DateMathParser syntax e.g.
-->
<!--
<str name="maxCommitAge">30MINUTES</str>
<str name="maxCommitAge">1DAY</str>
-->
</deletionPolicy>
Solr 是 运行 本地的,而不是云模式。我不使用 /bin/solr 文件来 start/stop。我有一个 rc.d 启动它。
这里是相关的solr日志。看起来它执行了一个删除查询然后将它们添加回去但索引文件夹保持为空?
INFO (searcherExecutor-11-thread-1-processing-x:core0) [ x:core0] o.a.s.c.SolrCore [core0] Registered new searcher Searcher@42dff6af[core0] main{ExitableDirectoryReader(UninvertingDirectoryReader(Uninverting(_6j(8.0.0):C26532:[diagnostics={java.runtime.version=1.8.0_202-b08, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os=FreeBSD, os.arch=amd64, os.version=12.0-RELEASE-p3, source=flush, timestamp=1557748786052}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_6k(8.0.0):C27135:[diagnostics={java.runtime.version=1.8.0_202-b08, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os=FreeBSD, os.arch=amd64, os.version=12.0-RELEASE-p3, source=flush, timestamp=1557748821980}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_6l(8.0.0):C25295:[diagnostics={java.runtime.version=1.8.0_202-b08, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os=FreeBSD, os.arch=amd64, os.version=12.0-RELEASE-p3, source=flush, timestamp=1557748857211}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_6m(8.0.0):C18995:[diagnostics={java.runtime.version=1.8.0_202-b08, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os=FreeBSD, os.arch=amd64, os.version=12.0-RELEASE-p3, source=flush, timestamp=1557748884975}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}])))}
INFO (qtp349420578-20) [ x:core0] o.a.s.u.DirectUpdateHandler2 [core0] REMOVING ALL DOCUMENTS FROM INDEX
INFO (qtp349420578-20) [ x:core0] o.a.s.u.DirectUpdateHandler2 start commit{,optimize=false,openSearcher=true,waitSearcher=true,expungeDeletes=false,softCommit=false,prepareCommit=false}
INFO (qtp349420578-20) [ x:core0] o.a.s.u.SolrIndexWriter Calling setCommitData with IW:org.apache.solr.update.SolrIndexWriter@29a2d524 commitCommandVersion:0
INFO (qtp349420578-20) [ x:core0] o.a.s.s.SolrIndexSearcher Opening [Searcher@2613a525[core0] main]
INFO (qtp349420578-20) [ x:core0] o.a.s.u.DirectUpdateHandler2 end_commit_flush
INFO (searcherExecutor-11-thread-1-processing-x:core0) [ x:core0] o.a.s.c.QuerySenderListener QuerySenderListener sending requests to Searcher@2613a525[core0] main{ExitableDirectoryReader(UninvertingDirectoryReader())}
INFO (searcherExecutor-11-thread-1-processing-x:core0) [ x:core0] o.a.s.c.QuerySenderListener QuerySenderListener done.
INFO (searcherExecutor-11-thread-1-processing-x:core0) [ x:core0] o.a.s.c.SolrCore [core0] Registered new searcher Searcher@2613a525[core0] main{ExitableDirectoryReader(UninvertingDirectoryReader())}
INFO (qtp349420578-20) [ x:core0] o.a.s.u.p.LogUpdateProcessorFactory [core0] webapp=/solr path=/update params={commit=true}{deleteByQuery=*:*,commit=} 0 145
INFO (qtp349420578-14) [ x:core1] o.a.s.u.DirectUpdateHandler2 [core1] REMOVING ALL DOCUMENTS FROM INDEX
INFO (qtp349420578-14) [ x:core1] o.a.s.u.DirectUpdateHandler2 start commit{,optimize=false,openSearcher=true,waitSearcher=true,expungeDeletes=false,softCommit=false,prepareCommit=false}
INFO (qtp349420578-14) [ x:core1] o.a.s.u.SolrIndexWriter Calling setCommitData with IW:org.apache.solr.update.SolrIndexWriter@42e13429 commitCommandVersion:0
INFO (qtp349420578-14) [ x:core1] o.a.s.s.SolrIndexSearcher Opening [Searcher@3dc3e12[core1] main]
INFO (qtp349420578-14) [ x:core1] o.a.s.u.DirectUpdateHandler2 end_commit_flush
INFO (searcherExecutor-10-thread-1-processing-x:core1) [ x:core1] o.a.s.c.QuerySenderListener QuerySenderListener sending requests to Searcher@3dc3e12[core1] main{ExitableDirectoryReader(UninvertingDirectoryReader())}
INFO (searcherExecutor-10-thread-1-processing-x:core1) [ x:core1] o.a.s.c.QuerySenderListener QuerySenderListener done.
INFO (searcherExecutor-10-thread-1-processing-x:core1) [ x:core1] o.a.s.c.SolrCore [core1] Registered new searcher Searcher@3dc3e12[core1] main{ExitableDirectoryReader(UninvertingDirectoryReader())}
INFO (qtp349420578-14) [ x:core1] o.a.s.u.p.LogUpdateProcessorFactory [core1] webapp=/solr path=/update params={commit=true}{deleteByQuery=*:*,commit=} 0 24
INFO (qtp349420578-16) [ x:core0] o.a.s.u.DirectUpdateHandler2 start commit{,optimize=false,openSearcher=true,waitSearcher=true,expungeDeletes=false,softCommit=false,prepareCommit=false}
INFO (qtp349420578-16) [ x:core0] o.a.s.u.SolrIndexWriter Calling setCommitData with IW:org.apache.solr.update.SolrIndexWriter@29a2d524 commitCommandVersion:0
INFO (qtp349420578-16) [ x:core0] o.a.s.s.SolrIndexSearcher Opening [Searcher@8c5c9e1[core0] main]
INFO (qtp349420578-16) [ x:core0] o.a.s.u.DirectUpdateHandler2 end_commit_flush
INFO (searcherExecutor-11-thread-1-processing-x:core0) [ x:core0] o.a.s.c.QuerySenderListener QuerySenderListener sending requests to Searcher@8c5c9e1[core0] main{ExitableDirectoryReader(UninvertingDirectoryReader(Uninverting(_70(8.0.0):C60051:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, mergeMaxNumSegments=-1, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=merge, mergeFactor=10, os.version=12.0-RELEASE-p3, timestamp=1557766812128}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_6o(8.0.0):C6151:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766730928}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_6q(8.0.0):C6010:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766748246}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_6z(8.0.0):C6622:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766821254}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_71(8.0.0):C5449:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766829833}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_72(8.0.0):C5439:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766837529}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_73(8.0.0):C5187:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766845144}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_74(8.0.0):C3048:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766849549}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}])))}
INFO (searcherExecutor-11-thread-1-processing-x:core0) [ x:core0] o.a.s.c.QuerySenderListener QuerySenderListener done.
INFO (searcherExecutor-11-thread-1-processing-x:core0) [ x:core0] o.a.s.c.SolrCore [core0] Registered new searcher Searcher@8c5c9e1[core0] main{ExitableDirectoryReader(UninvertingDirectoryReader(Uninverting(_70(8.0.0):C60051:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, mergeMaxNumSegments=-1, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=merge, mergeFactor=10, os.version=12.0-RELEASE-p3, timestamp=1557766812128}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_6o(8.0.0):C6151:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766730928}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_6q(8.0.0):C6010:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766748246}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_6z(8.0.0):C6622:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766821254}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_71(8.0.0):C5449:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766829833}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_72(8.0.0):C5439:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766837529}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_73(8.0.0):C5187:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766845144}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_74(8.0.0):C3048:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766849549}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}])))}
INFO (qtp349420578-16) [ x:core0] o.a.s.u.p.LogUpdateProcessorFactory [core0] webapp=/solr path=/update params={commit=true}{add=[1, 3, 4, 5, 6, 7, 8, 12, 13, 17, ... (97957 adds)],commit=} 0 140797
INFO (qtp349420578-20) [ x:core1] o.a.s.u.DirectUpdateHandler2 start commit{,optimize=false,openSearcher=true,waitSearcher=true,expungeDeletes=false,softCommit=false,prepareCommit=false}
INFO (qtp349420578-20) [ x:core1] o.a.s.u.SolrIndexWriter Calling setCommitData with IW:org.apache.solr.update.SolrIndexWriter@42e13429 commitCommandVersion:0
INFO (qtp349420578-20) [ x:core1] o.a.s.s.SolrIndexSearcher Opening [Searcher@4f2f2289[core1] main]
INFO (qtp349420578-20) [ x:core1] o.a.s.u.DirectUpdateHandler2 end_commit_flush
INFO (searcherExecutor-10-thread-1-processing-x:core1) [ x:core1] o.a.s.c.QuerySenderListener QuerySenderListener sending requests to Searcher@4f2f2289[core1] main{ExitableDirectoryReader(UninvertingDirectoryReader(Uninverting(_1e(8.0.0):C6778:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766860399}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_1f(8.0.0):C6493:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766868779}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_1g(8.0.0):C5931:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766877352}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_1h(8.0.0):C2786:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766881149}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}])))}
INFO (searcherExecutor-10-thread-1-processing-x:core1) [ x:core1] o.a.s.c.QuerySenderListener QuerySenderListener done.
INFO (searcherExecutor-10-thread-1-processing-x:core1) [ x:core1] o.a.s.c.SolrCore [core1] Registered new searcher Searcher@4f2f2289[core1] main{ExitableDirectoryReader(UninvertingDirectoryReader(Uninverting(_1e(8.0.0):C6778:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766860399}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_1f(8.0.0):C6493:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766868779}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_1g(8.0.0):C5931:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766877352}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_1h(8.0.0):C2786:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766881149}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}])))}
INFO (qtp349420578-20) [ x:core1] o.a.s.u.p.LogUpdateProcessorFactory [core1] webapp=/solr path=/update params={commit=true}{add=[378, 462, 616, 649, 819, 849, 857, 869, 880, 968, ... (21988 adds)],commit=} 0 29390
执行以下操作解决了我的问题:
将锁类型更改为 none(这对我的应用程序来说没问题)
为每个核心从 /data/index 中删除了 write.lock 文件。
禁用更新日志记录
删除了为每个内核创建的 /data/tlog 文件夹和内容。
我不知道为什么 locktype 的东西给我这样的问题,但在某些情况下它会导致索引文件在启动时被删除。最有可能基于时间。
tlog/UpdateLogging 是导致其他机器 运行 在启动时删除和添加查询的原因。
*这只有效一次!我们能够将所有索引文件复制到另一台机器并重新启动,这次它没有删除段。但几天后,我们得到了不同的行为。
现在,它删除所有段文件,然后写入一个segments_1文件。日志没有说明为什么要这样做。不知道怎么办,又卡住了!
**最终解决方案是使用 solr backup and restore API 加载新索引。原来你不能编辑或修改 /data/index 文件夹中的文件,而 solr 是 运行ning,这在我们的 Solr 3 实例中是可能的,但显然在 Solr 8 中不是。
**更新 据我所知,在主机上完成的删除和重建提交被缓存,然后当索引被复制到另一台机器并重新启动 solr 时,它会以某种方式在某处找到那些缓存的提交并在启动时运行它们。这对我们不利,因为 solr 在重做那些缓存的提交时被清理了。
如何禁用它?
**原创
我们最近从 Solr 3 更改为 Solr 8。
索引是在一台机器上建立的,然后复制到另外4台机器上。
这是一个 'static' 产品列表。大约每周一次,我们删除并重建机器 1 上的索引并复制到其他机器,然后在这些机器上重新启动 solr。在重建之间未修改(添加或删除)索引。
对于 Solr 3,当我们在复制新索引后重新启动 Solr 时,一切都会按我们预期的那样运行。它只会使用我们复制的索引。
现在使用 Solr 8,我们发现重新启动其他机器会导致 DirectUpdateHandler2/LogUpdateProcessorFactory 到 "REMOVE ALL DOCUMENTS FROM INDEX",执行提交并发送删除查询。
这永远不会发生在建立索引的机器上,只有我们的从属机器上才会发生索引被复制到的机器。
我们认为在我们的案例中不需要复制,因为索引保持静态,而且我们将索引同步到其他机器更简单。
我无法找到 solrconfig.xml 中需要更改的内容以防止它在启动时发送 deleteByQuery。似乎只有在我们上次重建索引后已经过去了足够长的时间后才会这样做。
配置中为空:
<updateHandler class="solr.DirectUpdateHandler2">
</updateHandler>
**这没有什么不同 我刚刚添加了这个希望它会有所作为:
<deletionPolicy class="solr.SolrDeletionPolicy">
<!-- The number of commit points to be kept -->
<str name="maxCommitsToKeep">1</str>
<!-- The number of optimized commit points to be kept -->
<str name="maxOptimizedCommitsToKeep">0</str>
<!--
Delete all commit points once they have reached the given age.
Supports DateMathParser syntax e.g.
-->
<!--
<str name="maxCommitAge">30MINUTES</str>
<str name="maxCommitAge">1DAY</str>
-->
</deletionPolicy>
Solr 是 运行 本地的,而不是云模式。我不使用 /bin/solr 文件来 start/stop。我有一个 rc.d 启动它。
这里是相关的solr日志。看起来它执行了一个删除查询然后将它们添加回去但索引文件夹保持为空?
INFO (searcherExecutor-11-thread-1-processing-x:core0) [ x:core0] o.a.s.c.SolrCore [core0] Registered new searcher Searcher@42dff6af[core0] main{ExitableDirectoryReader(UninvertingDirectoryReader(Uninverting(_6j(8.0.0):C26532:[diagnostics={java.runtime.version=1.8.0_202-b08, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os=FreeBSD, os.arch=amd64, os.version=12.0-RELEASE-p3, source=flush, timestamp=1557748786052}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_6k(8.0.0):C27135:[diagnostics={java.runtime.version=1.8.0_202-b08, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os=FreeBSD, os.arch=amd64, os.version=12.0-RELEASE-p3, source=flush, timestamp=1557748821980}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_6l(8.0.0):C25295:[diagnostics={java.runtime.version=1.8.0_202-b08, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os=FreeBSD, os.arch=amd64, os.version=12.0-RELEASE-p3, source=flush, timestamp=1557748857211}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_6m(8.0.0):C18995:[diagnostics={java.runtime.version=1.8.0_202-b08, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os=FreeBSD, os.arch=amd64, os.version=12.0-RELEASE-p3, source=flush, timestamp=1557748884975}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}])))}
INFO (qtp349420578-20) [ x:core0] o.a.s.u.DirectUpdateHandler2 [core0] REMOVING ALL DOCUMENTS FROM INDEX
INFO (qtp349420578-20) [ x:core0] o.a.s.u.DirectUpdateHandler2 start commit{,optimize=false,openSearcher=true,waitSearcher=true,expungeDeletes=false,softCommit=false,prepareCommit=false}
INFO (qtp349420578-20) [ x:core0] o.a.s.u.SolrIndexWriter Calling setCommitData with IW:org.apache.solr.update.SolrIndexWriter@29a2d524 commitCommandVersion:0
INFO (qtp349420578-20) [ x:core0] o.a.s.s.SolrIndexSearcher Opening [Searcher@2613a525[core0] main]
INFO (qtp349420578-20) [ x:core0] o.a.s.u.DirectUpdateHandler2 end_commit_flush
INFO (searcherExecutor-11-thread-1-processing-x:core0) [ x:core0] o.a.s.c.QuerySenderListener QuerySenderListener sending requests to Searcher@2613a525[core0] main{ExitableDirectoryReader(UninvertingDirectoryReader())}
INFO (searcherExecutor-11-thread-1-processing-x:core0) [ x:core0] o.a.s.c.QuerySenderListener QuerySenderListener done.
INFO (searcherExecutor-11-thread-1-processing-x:core0) [ x:core0] o.a.s.c.SolrCore [core0] Registered new searcher Searcher@2613a525[core0] main{ExitableDirectoryReader(UninvertingDirectoryReader())}
INFO (qtp349420578-20) [ x:core0] o.a.s.u.p.LogUpdateProcessorFactory [core0] webapp=/solr path=/update params={commit=true}{deleteByQuery=*:*,commit=} 0 145
INFO (qtp349420578-14) [ x:core1] o.a.s.u.DirectUpdateHandler2 [core1] REMOVING ALL DOCUMENTS FROM INDEX
INFO (qtp349420578-14) [ x:core1] o.a.s.u.DirectUpdateHandler2 start commit{,optimize=false,openSearcher=true,waitSearcher=true,expungeDeletes=false,softCommit=false,prepareCommit=false}
INFO (qtp349420578-14) [ x:core1] o.a.s.u.SolrIndexWriter Calling setCommitData with IW:org.apache.solr.update.SolrIndexWriter@42e13429 commitCommandVersion:0
INFO (qtp349420578-14) [ x:core1] o.a.s.s.SolrIndexSearcher Opening [Searcher@3dc3e12[core1] main]
INFO (qtp349420578-14) [ x:core1] o.a.s.u.DirectUpdateHandler2 end_commit_flush
INFO (searcherExecutor-10-thread-1-processing-x:core1) [ x:core1] o.a.s.c.QuerySenderListener QuerySenderListener sending requests to Searcher@3dc3e12[core1] main{ExitableDirectoryReader(UninvertingDirectoryReader())}
INFO (searcherExecutor-10-thread-1-processing-x:core1) [ x:core1] o.a.s.c.QuerySenderListener QuerySenderListener done.
INFO (searcherExecutor-10-thread-1-processing-x:core1) [ x:core1] o.a.s.c.SolrCore [core1] Registered new searcher Searcher@3dc3e12[core1] main{ExitableDirectoryReader(UninvertingDirectoryReader())}
INFO (qtp349420578-14) [ x:core1] o.a.s.u.p.LogUpdateProcessorFactory [core1] webapp=/solr path=/update params={commit=true}{deleteByQuery=*:*,commit=} 0 24
INFO (qtp349420578-16) [ x:core0] o.a.s.u.DirectUpdateHandler2 start commit{,optimize=false,openSearcher=true,waitSearcher=true,expungeDeletes=false,softCommit=false,prepareCommit=false}
INFO (qtp349420578-16) [ x:core0] o.a.s.u.SolrIndexWriter Calling setCommitData with IW:org.apache.solr.update.SolrIndexWriter@29a2d524 commitCommandVersion:0
INFO (qtp349420578-16) [ x:core0] o.a.s.s.SolrIndexSearcher Opening [Searcher@8c5c9e1[core0] main]
INFO (qtp349420578-16) [ x:core0] o.a.s.u.DirectUpdateHandler2 end_commit_flush
INFO (searcherExecutor-11-thread-1-processing-x:core0) [ x:core0] o.a.s.c.QuerySenderListener QuerySenderListener sending requests to Searcher@8c5c9e1[core0] main{ExitableDirectoryReader(UninvertingDirectoryReader(Uninverting(_70(8.0.0):C60051:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, mergeMaxNumSegments=-1, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=merge, mergeFactor=10, os.version=12.0-RELEASE-p3, timestamp=1557766812128}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_6o(8.0.0):C6151:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766730928}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_6q(8.0.0):C6010:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766748246}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_6z(8.0.0):C6622:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766821254}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_71(8.0.0):C5449:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766829833}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_72(8.0.0):C5439:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766837529}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_73(8.0.0):C5187:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766845144}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_74(8.0.0):C3048:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766849549}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}])))}
INFO (searcherExecutor-11-thread-1-processing-x:core0) [ x:core0] o.a.s.c.QuerySenderListener QuerySenderListener done.
INFO (searcherExecutor-11-thread-1-processing-x:core0) [ x:core0] o.a.s.c.SolrCore [core0] Registered new searcher Searcher@8c5c9e1[core0] main{ExitableDirectoryReader(UninvertingDirectoryReader(Uninverting(_70(8.0.0):C60051:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, mergeMaxNumSegments=-1, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=merge, mergeFactor=10, os.version=12.0-RELEASE-p3, timestamp=1557766812128}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_6o(8.0.0):C6151:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766730928}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_6q(8.0.0):C6010:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766748246}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_6z(8.0.0):C6622:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766821254}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_71(8.0.0):C5449:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766829833}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_72(8.0.0):C5439:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766837529}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_73(8.0.0):C5187:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766845144}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_74(8.0.0):C3048:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766849549}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}])))}
INFO (qtp349420578-16) [ x:core0] o.a.s.u.p.LogUpdateProcessorFactory [core0] webapp=/solr path=/update params={commit=true}{add=[1, 3, 4, 5, 6, 7, 8, 12, 13, 17, ... (97957 adds)],commit=} 0 140797
INFO (qtp349420578-20) [ x:core1] o.a.s.u.DirectUpdateHandler2 start commit{,optimize=false,openSearcher=true,waitSearcher=true,expungeDeletes=false,softCommit=false,prepareCommit=false}
INFO (qtp349420578-20) [ x:core1] o.a.s.u.SolrIndexWriter Calling setCommitData with IW:org.apache.solr.update.SolrIndexWriter@42e13429 commitCommandVersion:0
INFO (qtp349420578-20) [ x:core1] o.a.s.s.SolrIndexSearcher Opening [Searcher@4f2f2289[core1] main]
INFO (qtp349420578-20) [ x:core1] o.a.s.u.DirectUpdateHandler2 end_commit_flush
INFO (searcherExecutor-10-thread-1-processing-x:core1) [ x:core1] o.a.s.c.QuerySenderListener QuerySenderListener sending requests to Searcher@4f2f2289[core1] main{ExitableDirectoryReader(UninvertingDirectoryReader(Uninverting(_1e(8.0.0):C6778:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766860399}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_1f(8.0.0):C6493:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766868779}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_1g(8.0.0):C5931:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766877352}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_1h(8.0.0):C2786:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766881149}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}])))}
INFO (searcherExecutor-10-thread-1-processing-x:core1) [ x:core1] o.a.s.c.QuerySenderListener QuerySenderListener done.
INFO (searcherExecutor-10-thread-1-processing-x:core1) [ x:core1] o.a.s.c.SolrCore [core1] Registered new searcher Searcher@4f2f2289[core1] main{ExitableDirectoryReader(UninvertingDirectoryReader(Uninverting(_1e(8.0.0):C6778:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766860399}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_1f(8.0.0):C6493:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766868779}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_1g(8.0.0):C5931:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766877352}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}]) Uninverting(_1h(8.0.0):C2786:[diagnostics={os=FreeBSD, java.vendor=Oracle Corporation, java.version=1.8.0_202, java.vm.version=25.202-b08, lucene.version=8.0.0, os.arch=amd64, java.runtime.version=1.8.0_202-b08, source=flush, os.version=12.0-RELEASE-p3, timestamp=1557766881149}]:[attributes={Lucene50StoredFieldsFormat.mode=BEST_SPEED}])))}
INFO (qtp349420578-20) [ x:core1] o.a.s.u.p.LogUpdateProcessorFactory [core1] webapp=/solr path=/update params={commit=true}{add=[378, 462, 616, 649, 819, 849, 857, 869, 880, 968, ... (21988 adds)],commit=} 0 29390
执行以下操作解决了我的问题:
将锁类型更改为 none(这对我的应用程序来说没问题)
为每个核心从 /data/index 中删除了 write.lock 文件。
禁用更新日志记录
删除了为每个内核创建的 /data/tlog 文件夹和内容。
我不知道为什么 locktype 的东西给我这样的问题,但在某些情况下它会导致索引文件在启动时被删除。最有可能基于时间。
tlog/UpdateLogging 是导致其他机器 运行 在启动时删除和添加查询的原因。
*这只有效一次!我们能够将所有索引文件复制到另一台机器并重新启动,这次它没有删除段。但几天后,我们得到了不同的行为。
现在,它删除所有段文件,然后写入一个segments_1文件。日志没有说明为什么要这样做。不知道怎么办,又卡住了!
**最终解决方案是使用 solr backup and restore API 加载新索引。原来你不能编辑或修改 /data/index 文件夹中的文件,而 solr 是 运行ning,这在我们的 Solr 3 实例中是可能的,但显然在 Solr 8 中不是。