欢迎光临
我们一直在努力

solr dataimporter定时任务怎么实现

本篇内容主要讲解“solr dataimporter定时任务怎么实现”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“solr dataimporter定时任务怎么实现”吧!

  1. 下载的包放到tomcat 的solr 应用下。

  2. 包中的dataimport.properties 文件放到server/solr/conf目录下。(conf 目录需要自己新建)

  3. 修改 dataimport.properties 

  4. #################################################
    #                                               #
    #       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=core #改成自己的
    
    #  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=/core/dataimport?command=delta-import&clean=false&commit=true
    
    #  schedule interval
    #  number of minutes between two runs
    #  [defaults to 30 if empty]
    interval=10
  5. 需要在数据库表加一个时间戳字段用来增量更新的时候进宪判断。其他字段亦可。

  6. 导入数据的配置文件中entity 的deltaQuery="。。。 where last_index_time > ${dataimporter.last_index_time}"
  7.   在solr 应用的 web.xml中添加listener

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

到此,相信大家对“solr dataimporter定时任务怎么实现”有了更深的了解,不妨来实际操作一番吧!这里是云搜网网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。