solr定時增量索引


參考:官方文檔,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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM