【轉】Solr5.3.1定時增量添加索引和重做索引

來源:互聯網
上載者:User

標籤:

  本文轉自:https://code.google.com/p/solr-dataimport-scheduler/

Solr Data Import Hander Scheduler 說明:
Solr官方提供了很強大的Data Import Request Handler,同時提供了一個簡單的 Scheduler,Url:http://wiki.apache.org/solr/DataImportHandler
樣本中的 Scheduler 只支援累加式更新,不支援定期重做索引,因此我做了一個簡單的封裝,增加了重做索引的定時器.
(原定時器作者是:Marko Bonaci, 在此表示感謝!)The original Scheduling source by Marko Bonaci, Thank him!

使用說明
  將 apache-solr-dataimportscheduler-1.0.jar 和solr內建的 apache-solr-dataimporthandler-.jar, apache-solr-dataimporthandler-extras-.jar 放到solr.war的lib目錄下面
修改solr.war中WEB-INF/web.xml, 在servlet節點前面增加:

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

  將apache-solr-dataimportscheduler-.jar 中 dataimport.properties 取出並根據實際情況修改,然後放到 solr.home/conf (不是solr.home/core/conf) 目錄下面
  重啟tomcat或者jboss 即可

  dataimport.properties 配置項說明

##################################################                                               ##       dataimport scheduler properties         ##                                               ###################################################  to sync or not to sync#  1 - active; anything else - inactivesyncEnabled=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 deploymentsyncCores=core1,core2#  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 URLparams=/dataimport?command=delta-import&clean=false&commit=true#  schedule interval#  number of minutes between two runs#  [defaults to 30 if empty]interval=1#  重做索引的時間間隔,單位分鐘,預設7200,即5天; #  為空白,為0,或者注釋掉:表示永不重做索引reBuildIndexInterval=7200#  重做索引的參數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

 

【轉】Solr5.3.1定時增量添加索引和重做索引

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.