日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

Solr定时重建索引和增量更新

發(fā)布時(shí)間:2023/11/27 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Solr定时重建索引和增量更新 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

新增jar包

新增solr-dataimport-scheduler.jar到所有節(jié)點(diǎn)tomcat\webapps\下solr項(xiàng)目的WEB-INF\lib下
下載地址:

為Solr配置監(jiān)聽器

修改所有節(jié)點(diǎn)tomcat下的solr的web.xml增加如下配置

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

新增配置

在solrhome/conf/中新增名為:dataimport.properties 配置文件
如果是solr-cloud則配置其中1個(gè)solrhome/conf需要添加dataimport.properties配置文件
配置內(nèi)容如下:

#################################################
#                                               #
#       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
#  修改成你所使用的core,我這里是我自定義的core:simple
syncCores=collection1#  solr server name or IP address
#  [defaults to localhost if empty]
#這個(gè)一般都是localhost不會(huì)變
server=localhost#  solr server port
#  [defaults to 80 if empty]
#  安裝solr的tomcat端口,如果你使用的是默認(rèn)的端口,就不用改了,否則改成自己的端口就好了
port=8180#  application name/context
#  [defaults to current ServletContextListener's context (app) name]
#  這里默認(rèn)不改
webapp=solr#  URL params [mandatory]
#  remainder of URL
#  這里改成下面的形式,solr同步數(shù)據(jù)時(shí)請(qǐng)求的鏈接
params=/dataimport?command=delta-import&clean=false&commit=true#  schedule interval
#  number of minutes between two runs
#  [defaults to 30 if empty]
#這里是設(shè)置定時(shí)任務(wù)的,單位是分鐘,也就是多長(zhǎng)時(shí)間你檢測(cè)一次數(shù)據(jù)同步,根據(jù)項(xiàng)目需求修改
#  開始測(cè)試的時(shí)候?yàn)榱朔奖憧吹叫Ч?#xff0c;時(shí)間可以設(shè)置短一點(diǎn)
interval=60#  重做索引的時(shí)間間隔,單位分鐘,默認(rèn)7200,即5天; 
#  為空,為0,或者注釋掉:表示永不重做索引
reBuildIndexInterval=7200#  重做索引的參數(shù)
#reBuildIndexParams=/select?qt=/dataimport&command=full-import&clean=true&commit=true
reBuildIndexParams=/dataimport?command=full-import&clean=true&commit=true#  重做索引時(shí)間間隔的計(jì)時(shí)開始時(shí)間,第一次真正執(zhí)行的時(shí)間=reBuildIndexBeginTime+reBuildIndexInterval*60*1000;
#  兩種格式:2012-04-11 03:10:00 或者  03:10:00,后一種會(huì)自動(dòng)補(bǔ)全日期部分為服務(wù)啟動(dòng)時(shí)的日期
reBuildIndexBeginTime=00:00:00

重啟Solr服務(wù)

總結(jié)

以上是生活随笔為你收集整理的Solr定时重建索引和增量更新的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。