欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

solr7.2.0定时全量和增量更新

程序员文章站 2022-07-02 13:46:24
1、创建 dataimport.properties 文件 ################################################## ## dataimport scheduler properties ## ############################### ......

1、创建 dataimport.properties 文件


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

# to sync or not to sync
# 1 - active; anything else - inactive
# \u8fd9\u91cc\u7684\u914d\u7f6e\u4e0d\u7528\u4fee\u6539
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
# \u4fee\u6539\u6210\u4f60\u6240\u4f7f\u7528\u7684core\uff0c\u6211\u8fd9\u91cc\u662f\u6211\u81ea\u5b9a\u4e49\u7684core\uff1asimple
synccores=xt_pdd

# solr server name or ip address
# [defaults to localhost if empty]
#\u8fd9\u4e2a\u4e00\u822c\u90fd\u662flocalhost\u4e0d\u4f1a\u53d8
server=localhost

# solr server port
# [defaults to 80 if empty]
# \u5b89\u88c5solr\u7684tomcat\u7aef\u53e3\uff0c\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f\u9ed8\u8ba4\u7684\u7aef\u53e3\uff0c\u5c31\u4e0d\u7528\u6539\u4e86\uff0c\u5426\u5219\u6539\u6210\u81ea\u5df1\u7684\u7aef\u53e3\u5c31\u597d\u4e86
port=8088

# application name/context
# [defaults to current servletcontextlistener's context (app) name]
# \u8fd9\u91cc\u9ed8\u8ba4\u4e0d\u6539
webapp=/

# url params [mandatory]
# remainder of url
# \u8fd9\u91cc\u6539\u6210\u4e0b\u9762\u7684\u5f62\u5f0f\uff0csolr\u540c\u6b65\u6570\u636e\u65f6\u8bf7\u6c42\u7684\u94fe\u63a5
params=/dataimport?command=delta-import&clean=false&commit=true
#params=/select?qt=/dataimport&command=delta-import&clean=false&commit=true
#params=/dataimport?command=delta-import&clean=false&commit=true&optimize=false&wt=json&indent=true&entity=forumtopic&verbose=false&debug=false

# schedule interval
# number of minutes between two runs
# [defaults to 30 if empty]
#\u8fd9\u91cc\u662f\u8bbe\u7f6e\u5b9a\u65f6\u4efb\u52a1\u7684\uff0c\u5355\u4f4d\u662f\u5206\u949f\uff0c\u4e5f\u5c31\u662f\u591a\u957f\u65f6\u95f4\u4f60\u68c0\u6d4b\u4e00\u6b21\u6570\u636e\u540c\u6b65\uff0c\u6839\u636e\u9879\u76ee\u9700\u6c42\u4fee\u6539
# \u5f00\u59cb\u6d4b\u8bd5\u7684\u65f6\u5019\u4e3a\u4e86\u65b9\u4fbf\u770b\u5230\u6548\u679c\uff0c\u65f6\u95f4\u53ef\u4ee5\u8bbe\u7f6e\u77ed\u4e00\u70b9
interval=1

# \u91cd\u505a\u7d22\u5f15\u7684\u65f6\u95f4\u95f4\u9694\uff0c\u5355\u4f4d\u5206\u949f\uff0c\u9ed8\u8ba47200\uff0c\u53735\u5929;
# \u4e3a\u7a7a,\u4e3a0,\u6216\u8005\u6ce8\u91ca\u6389:\u8868\u793a\u6c38\u4e0d\u91cd\u505a\u7d22\u5f15
rebuildindexinterval=7200

# \u91cd\u505a\u7d22\u5f15\u7684\u53c2\u6570
rebuildindexparams=/select?qt=/dataimport&command=full-import&clean=true&commit=true

# \u91cd\u505a\u7d22\u5f15\u65f6\u95f4\u95f4\u9694\u7684\u8ba1\u65f6\u5f00\u59cb\u65f6\u95f4\uff0c\u7b2c\u4e00\u6b21\u771f\u6b63\u6267\u884c\u7684\u65f6\u95f4=rebuildindexbegintime+rebuildindexinterval*60*1000\uff1b
# \u4e24\u79cd\u683c\u5f0f\uff1a2012-04-11 03:10:00 \u6216\u8005 03:10:00\uff0c\u540e\u4e00\u79cd\u4f1a\u81ea\u52a8\u8865\u5168\u65e5\u671f\u90e8\u5206\u4e3a\u670d\u52a1\u542f\u52a8\u65f6\u7684\u65e5\u671f
rebuildindexbegintime=03:10:00

2、solr-data-import-scheduler 引入项目

百度网盘下载地址

链接:https://pan.baidu.com/s/1iqi-pwlqcofiiwxusgu_tq 密码:h8so

3、配置web.xml监听

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