日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

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

發布時間:2023/11/27 生活经验 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Solr定时重建索引和增量更新 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

新增jar包

新增solr-dataimport-scheduler.jar到所有節點tomcat\webapps\下solr項目的WEB-INF\lib下
下載地址:

為Solr配置監聽器

修改所有節點tomcat下的solr的web.xml增加如下配置

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

新增配置

在solrhome/conf/中新增名為:dataimport.properties 配置文件
如果是solr-cloud則配置其中1個solrhome/conf需要添加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
#  修改成你所使用的core,我這里是我自定義的core:simple
syncCores=collection1#  solr server name or IP address
#  [defaults to localhost if empty]
#這個一般都是localhost不會變
server=localhost#  solr server port
#  [defaults to 80 if empty]
#  安裝solr的tomcat端口,如果你使用的是默認的端口,就不用改了,否則改成自己的端口就好了
port=8180#  application name/context
#  [defaults to current ServletContextListener's context (app) name]
#  這里默認不改
webapp=solr#  URL params [mandatory]
#  remainder of URL
#  這里改成下面的形式,solr同步數據時請求的鏈接
params=/dataimport?command=delta-import&clean=false&commit=true#  schedule interval
#  number of minutes between two runs
#  [defaults to 30 if empty]
#這里是設置定時任務的,單位是分鐘,也就是多長時間你檢測一次數據同步,根據項目需求修改
#  開始測試的時候為了方便看到效果,時間可以設置短一點
interval=60#  重做索引的時間間隔,單位分鐘,默認7200,即5天; 
#  為空,為0,或者注釋掉:表示永不重做索引
reBuildIndexInterval=7200#  重做索引的參數
#reBuildIndexParams=/select?qt=/dataimport&command=full-import&clean=true&commit=true
reBuildIndexParams=/dataimport?command=full-import&clean=true&commit=true#  重做索引時間間隔的計時開始時間,第一次真正執行的時間=reBuildIndexBeginTime+reBuildIndexInterval*60*1000;
#  兩種格式:2012-04-11 03:10:00 或者  03:10:00,后一種會自動補全日期部分為服務啟動時的日期
reBuildIndexBeginTime=00:00:00

重啟Solr服務

總結

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

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。