简体   繁体   English

如何在Solr上优化大索引

[英]How to optimize large index on solr

our index is rising relatively fast, by adding 2000-3000 documents a day. 我们的索引每天增加2000-3000个文档,因此增长相对较快。 We are running an optimize every night. 我们每天晚上都在进行优化。

The point is, that Solr needs double disc space while optimizing. 关键是,Solr在优化时需要两倍的磁盘空间。 Actually the index has an size of 44GB, which works on an 100GB partition - for the next few months. 实际上,该索引的大小为44GB,可在接下来的几个月中在100GB的分区上工作。

The point is, that 50% of the disk space are unused for 90% of the day and only needed during optimize. 关键是,90%的一天中有50%的磁盘空间未使用,只有在优化期间才需要。

Next thing: we have to add more space on that partition periodical - which is always a painful discussion with the guys from the storage department (because we have more than one index...). 下一件事:我们必须在该分区期刊上增加更多空间-与存储部门的人员进行的讨论总是很痛苦的(因为我们有多个索引...)。

So the question is: is there a way to optimize an index without blocking additional 100% of the index size on disk? 所以问题是:有没有一种方法可以优化索引而不阻塞磁盘上额外100%的索引大小?

I know, that multi-cores an distributed search is an option - but this is only an "fall back" solution, because for that we need to change the application basically. 我知道,多核分布式搜索是一个选择-但这仅是“后备”解决方案,因为为此,我们需要基本上更改应用程序。

Thank you! 谢谢!

There is continous merging going on under the hood in Lucene. 在Lucene的引擎盖下不断进行合并。 Read up on the Merge Factor which can be set in the solrconfig.xml. 阅读可以在solrconfig.xml中设置的合并因子 If you tweak this setting you probably wont have to optimize at all. 如果您调整此设置,则可能根本不必进行优化。

You can try partial optimize by passing maxSegment parameter. 您可以通过传递maxSegment参数来尝试部分优化。 This will reduce the index to that specified number. 这会将索引减小到指定的数字。 I suggest you do in batches (eg if there are 50 segments first reduce to 30 then to 15 and so on). 我建议您分批处理(例如,如果有50个段,首先减小到30,然后减小到15,依此类推)。 Here's the url: 这是网址:

host:port/solr/CORE_NAME/update?optimize=true&maxSegments=(Enter the number of segments you want to reduce to. Ignore the parentheses)&waitFlush=false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM