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定时任务怎么实现”有了更深的了解,不妨来实际操作一番吧!这里是蜗牛博客网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:niceseo99@gmail.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

评论

有免费节点资源,我们会通知你!加入纸飞机订阅群

×
天气预报查看日历分享网页手机扫码留言评论电报频道链接