如何防止Solr在重启时执行删除索引的提交

时间:2019-05-13 14:28:43

标签: solr lucene freebsd

**更新 据我所知,在主机上完成的删除和重建提交将被缓存,然后在将索引复制到另一台计算机并重新启动solr时,它将以某种方式找到这些缓存的提交并在启动时运行它们。这对我们来说是不利的,因为在重做那些缓存的提交时,solr被压缩了。

如何禁用它?

**原始

我们最近已从Solr 3更改为Solr 8。

索引建立在一台计算机上,然后复制到其他四台计算机上。

这是产品的“静态”列表。大约每周一次,我们删除并重建计算机1上的索引,然后将其复制到其他计算机,然后在这些计算机上重新启动solr。在重建之间,索引不会被修改(添加或删除)。

对于Solr 3,当我们在复制新索引后重新启动Solr时,一切将按预期工作。它只会使用我们复制过来的索引。

现在使用Solr 8,我们发现重新启动其他计算机会导致DirectUpdateHandler2 / LogUpdateProcessorFactory“从索引中删除所有文档”,进行提交并发送删除查询。

在建立索引的机器上永远不会发生这种情况,只有将索引复制到我们的从属机器上。

我们认为在这种情况下不需要复制,因为索引保持静态,因此将索引与其他计算机同步更加简单。

我无法在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文件来启动/停止。我有一个启动它的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

1 个答案:

答案 0 :(得分:1)

执行以下操作可以解决我的问题:

将锁类型更改为无(这对于我的应用程序来说很好)

从每个核心的/ data / index删除了write.lock文件。

禁用UpdateLogging

删除每个核心创建的/ data / tlog文件夹和内容。

我不知道为什么锁类型的东西会给我这样的问题,但是在某些情况下,这会导致索引文件在启动时被删除。最可能基于时间。

tlog / UpdateLogging是导致其他计算机在启动时运行删除和添加查询的原因。

*这只能工作一次!我们能够将所有索引文件复制到另一台机器上,然后重新启动,并且这次没有删除这些段。但是几天后,我们得到了不同的行为。

现在,它将删除所有段文件,然后写入一个segment_1文件。日志没有说明为什么这样做。我不确定该怎么办,再次卡住了!

**最终的解决方案是使用solr备份和还原API来加载新索引。原来,您无法在solr运行时编辑/ data / index文件夹中的文件,这在我们的Solr 3实例中是可能的,但显然在Solr 8中是不可能的。