ubuntu下nutch-1.2配置

1、下载nutch1.2到指定一个目录下,并打开eclipse新建一个java工程。并选择"Create project 
from existing source",指向nutch目录。

 

2、下一步操作,切换到"Libraries"选择"Add Class Folder..." 按钮,从列表中选择"conf",继续操作:切换到"Order and Export"找到"conf",把它移到顶。

 

3、到"Source"将output folder设置为Nutch /bin/tmp_build,点击finish完成导入。

4、 配置文件:nutch-default.xml,nutch-site.xml,crawl-urlfilter.txt。
1) nutch-default.xml
修改此处:
<property>
  <name>plugin.folders</name>
  <value>./src/plugin</value> 
  <description>Directories where nutch plugins are located.  Each
  element may be a relative or absolute path.  If absolute, it is used
  as is.  If relative, it is searched for on the classpath.</description>
</property>

 

2)nutch-site.xml

在<configuration></configuration>中添加:

 

<property>

        <name>http.agent.name</name>

        <value>my nutch agent</value>

    </property>

    <property>

        <name>http.agent.version</name>

        <value>1.0</value>

 </property>

 

3)crawl-urlfilter.txt

删除:MY.DOMAIN.NAME

添加:+^http://([a-z0-9]*/.)*qq.com/

在nutch目录新建weburls.txt,并添加入口地址:http://www.qq.com

 

5、执行抓取

运行crawl 可执行类
       配置运行环境:
       Program arguments:
      bin/nutch crawl weburls.txt -dir localweb -depth 50 -topN 100 -threads 2

       VM arguments:
       -Dhadoop.log.dir=logs -Dhadoop.log.file=hadoop.log

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值