solr定时增量索引

2019-03-27 00:49|来源: 网路

参考:官方文档,http://wiki.apache.org/solr/DataImportHandler#Scheduling

googlecode 找到:https://code.google.com/p/solr-dataimport-scheduler/

1.复制solr-4.2.11\solr-4.2.1\dist目录下solr-dataimporthandler-4.2.1.jar 和solr-dataimporthandler-extras-4.2.1.jar到

D:\program\tomcat6\webapps\solr\WEB-INF\lib目录下

2.从https://code.google.com/p/solr-dataimport-scheduler/downloads/list 下载apache-solr-dataimportscheduler-1.0-with-source.jar到

D:\program\tomcat6\webapps\solr\WEB-INF\lib目录下

3.取出apache-solr-dataimportscheduler-1.0-with-source.jar内的dataimport.properties到D:\program\tomcat6\solrapp\solr\conf

conf文件夹是没有的,要新建

4.修改D:\program\tomcat6\webapps\solr\WEB-INF\web.xml,加入

     <listener>
             <listener-class>org.apache.solr.handler.dataimport.scheduler.ApplicationListener</listener-class>
   </listener>

5.修改dataimport.properties内容:

#################################################
#                                               #
#       dataimport scheduler properties         #
#                                               #
#################################################

#  to sync or not to sync
#  1 - active; anything else - inactive
syncEnabled=1

#  which cores to schedule
#  in a multi-core environment you can decide which cores you want syncronized
#  leave empty or comment it out if using single-core deployment
#syncCores=game,resource
syncCores=collection1
#  solr server name or IP address
#  [defaults to localhost if empty]
server=localhost

#  solr server port
#  [defaults to 80 if empty]
port=8080

#  application name/context
#  [defaults to current ServletContextListener's context (app) name]
webapp=solr

#  URL params [mandatory]
#  remainder of URL
params=/dataimport?command=delta-import&clean=false&commit=true

#  schedule interval
#  number of minutes between two runs
#  [defaults to 30 if empty]
interval=1

#  重做索引的时间间隔,单位分钟,默认7200,即1天; 
#  为空,为0,或者注释掉:表示永不重做索引
reBuildIndexInterval=2

#  重做索引的参数
reBuildIndexParams=/dataimport?command=full-import&clean=true&commit=true

#  重做索引时间间隔的计时开始时间,第一次真正执行的时间=reBuildIndexBeginTime+reBuildIndexInterval*60*1000;
#  两种格式:2012-04-11 03:10:00 或者  03:10:00,后一种会自动补全日期部分为服务启动时的日期
reBuildIndexBeginTime=03:10:00


转自:http://www.cnblogs.com/atyou/archive/2013/04/21/3033675

相关问答

更多
  • solr在对数据库表建增量索引时,目前是通过在数据库做一个标志位来区分是否已经建立索引,这样做有些影响效率,每次建索引还附带着更新字段,而且在索引删除时,需要更新字段后才能重新建索引,特麻烦!
  • 增量索引index定义配置如下 #增量索引 index定义 index delta:mysql{ source = delta path = /usr/local/coreseek/var/data/delta/ charset_dictpath = /usr/local/mmseg3/etc/ charset_type = zh_cn.utf-8 }
  • 当您将文档索引到solr时,它将使用相同的 (通常是id)覆盖任何现有的文档。 所以是的,它覆盖了现有的数据。 如果您想更改单个文档的字段,则必须重新索引整个文档,因为solr不支持仅更新字段。 所以,当你删除一个字段时,你将不得不重新索引没有字段的文档。 这将覆盖现有的数据。 不要忘记在最后发送commit 。 使用Solr 4,您可以更新文档的单个字段。 请参阅Atomic_Updates When you index a document to solr, it will ov ...
  • 如果要查找索引的物理磁盘大小,可以按照solrconfig.xml中的定义查看“dataDir”下的“data / index”文件夹。 例如。 在示例索引中,它是example / solr / data / index文件夹。 如果您正在查找文档的数量,那么您可以查看stats.jsp页面或搜索“ : ”。 如果您正在寻找了解内存使用情况,可以从stats.jsp开始 - 并查看文档计数,各种字段缓存大小等。 我担心你需要做更多的研究来了解你的记忆要求,描述应用程序和计划容量。 If you are l ...
  • 你必须在你的dataConfig中使用想要的sql语句中的deletedPkQuery属性,例如 deletedPkQuery="select ID from table where state = 'deleted'" 对你起作用吗? 来源http://wiki.apache.org/solr/DataImportHandler这是一个很好的教程: http : //solr.pl/en/2011/01/03/data-import-handler-%E2%80%93的拆卸, -数据-从索引/ You ...
  • 使用Indexing_Performance和ImproveIndexingSpeed查看SolrPerformanceFactors Check out SolrPerformanceFactors with Indexing_Performance and ImproveIndexingSpeed
  • DIH提供执行Delta导入的功能 。 DIH将保留上次成功构建的时间戳。 因此,如果您的数据库正在维护更新记录的时间戳,则delta查询将考虑在最后一个构建时间戳之后更新的所有记录。 它是为指数增量建立的一种方式。 DIH provides the ability to perform Delta imports. DIH will maintain the timestamp for the last successful builds. SO if your database is maintaini ...
  • 我想你想刷新索引的原因是因为你想要近实时搜索。 实质上,您希望搜索即时反映添加的文档。 在solr中,通常由softCommits或hardCommit通过openSearcher = true进行控制。 在这里阅读更多 https://lucidworks.com/2013/08/23/understanding-transaction-logs-softcommit-and-commit-in-sorlcloud/ 要点是这个 硬承诺是关于耐久性,软承诺是关于可见性 现在,如果我明白你所做的这一切都是为 ...
  • 您无法设置索引节点(据我所知),但您可以在单独的服务器上设置索引器。 为此你需要使用像Solrj这样的东西(有很多不同编程语言的solr客户端可供选择。我的索引是用python编写的,我使用的是mysolr)。 以这种方式索引也比使用DIH更灵活。 You can't set up a node for indexing (as far as I know), but you can set up the indexer on a separate server. For this you need to ...