Nutch是一个优秀的开源的数据爬取框架

Nutch是一个优秀的开源的数据爬取框架,我们只需要简单的配置,就可以完成数据爬取,当然,Nutch里面也提供了很灵活的的插件机制,我们随时都可以对它进行二次开发,以满足我们的需求,本篇散仙,先来介绍下,如何在eclipse里面以local模式调试nutch,只有在eclipse里面把它弄清楚了,那么,我们学习起来,才会更加容易,因为,目前大多数人,使用nutch,都是基于命令行的操作,虽然很简单方便,但是想深入定制开发,就很困难,所以,散仙在本篇里,会介绍下nutch基本的调试,以及编译。


 

 

下面进入正题,我们先来看下基本的步骤。

序号 名称 描述 1 安装部署ant 编译nutch编码使用 2 下载nutch源码 必须步骤 3 在nutch源码根目录下,执行ant等待编译完成 构建nutch 4 配置nutch-site.xml 必须步骤 5 ant eclipse 构建eclipse项目 导入eclipse中,调试 6 conf目录置顶 nutch加载时,会读取配置文件 7 执行org.apache.nutch.crawl.Injector注入种子 local调试 8 执行org.apache.nutch.crawl.Generator生成一个抓取列表 local调试 9 执行org.apache.nutch.fetcher.Fetcher生成一个抓取队列 local调试 10 执行org.apache.nutch.parse.ParseSegment执行contet生一个段文件 local调试 11 配置好solr服务 检索服务查询 12 执行org.apache.nutch.indexer.IndexingJob映射solr索引 local调试 13 映射完成后,就可以solr里面执行查询了 校验结果

 


编译完,导入eclipse的中如下图所示,注意conf文件夹置顶:


nutch-site.xml里面的配置如下:

Xml代码 复制代码  收藏代码
  1. <?xml version="1.0"?>  
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>  
  3.   
  4. <!-- Put site-specific property overrides in this file. -->  
  5.   
  6. <configuration>  
  7.   
  8. <property>  
  9.   <name>http.agent.name</name>  
  10.   <value>mynutch</value>  
  11. </property>  
  12.   
  13.   
  14. <property>  
  15.   <name>http.robots.agents</name>  
  16.   <value>*</value>  
  17.   <description>The agent strings we'll look for in robots.txt files,  
  18.   comma-separated, in decreasing order of precedence. You should  
  19.   put the value of http.agent.name as the first agent name, and keep the  
  20.   default * at the end of the list. E.g.: BlurflDev,Blurfl,*  
  21.   </description>  
  22. </property>  
  23.   
  24. <property>  
  25.   <name>plugin.folders</name>  
  26.   <value>./src/plugin</value>  
  27.   <description>Directories where nutch plugins are located.  Each  
  28.   element may be a relative or absolute path.  If absolute, it is used  
  29.   as is.  If relative, it is searched for on the classpath.</description>  
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值