Solr自动提交和自动优化? [英] Solr autocommit and autooptimize?

查看:1145
本文介绍了Solr自动提交和自动优化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很快就会将我的网站上传到VPS。它是使用与MySql集成的 Solr 的分类广告网站。



Solr会在每次放置或删除新分类时更新。



我需要一种方法让 commit() optimize()自动化,例如每3小时左右一次。



如何做到这一点?

解决方案

/ div>

您可以设置一个定期执行对Solr REST接口的远程调用的cron任务,例如:

  curl'http://< SOLR_INSTANCE_URL> / update?opt​​imize = true'

查找更多信息更新Solr索引此处



引用 Solr教程


提交可能是一个昂贵的操作
,因此最好对批次中的一个索引进行许多更改,然后发送
commit命令在结尾。还有
也是一个优化命令,使
与提交相同,除了
将所有索引段合并为
单段,使其更快到
搜索并删除任何已删除的
文档。


UPDATE:
此外,可以在solrconfig.xml(在 UpdateHandler 部分中)启用自动提交功能:

 < autoCommit> 
< maxDocs> 10000< / maxDocs> <! - 在自动提交触发之前的最大未引用文档 - >
< maxTime> 86000< / maxTime> <! - 在触发自动提交之前添加文档之后的最大时间(以MS为单位)>
< / autoCommit>


I will be uploading my website to a VPS soon. It is a classifieds website which uses Solr integrated with MySql.

Solr is updated whenever a new classified is put or deleted.

I need a way to make the commit() and optimize() be automated, for example once every 3 hours or so.

How can I do this? (Details Please) When is it ideal to optimize?

Thanks

解决方案

You could set up a cron task that periodically executes a remote call to the Solr REST interface, e.g:

curl 'http://<SOLR_INSTANCE_URL>/update?optimize=true'

Find further info on updating the Solr index here.

Quoting the Solr tutorial:

Commit can be an expensive operation so it's best to make many changes to an index in a batch and then send the commit command at the end. There is also an optimize command that does the same thing as commit, in addition to merging all index segments into a single segment, making it faster to search and causing any deleted documents to be removed.

UPDATE: Besides, the auto-commit feature can be enabled in solrconfig.xml (within the UpdateHandler section):

<autoCommit>
      <maxDocs>10000</maxDocs> <!-- maximum uncommited docs before autocommit triggered -->
      <maxTime>86000</maxTime> <!-- maximum time (in MS) after adding a doc before an autocommit is triggered -->
</autoCommit>

这篇关于Solr自动提交和自动优化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆