nutch2.1分布式抓取

在上一篇的基础上。


1准备环境:hadoop集群、java、mysql数据库,代码可以在eclipse中运行,可以单机模式下插入数据到mysql数据库。
2修改配置文件nutch-site.xml:
<property>
  <name>plugin.folders</name>
  <value>./plugins</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>
在eclipse中选中buil.xml,run as ant,运行runtime,运行成功会产生文件夹runtime。
3 把runtime文件夹上传到hadoop集群中的master服务器(没有验证其他服务器是不是可以),我上传之后的位置是:/home/hadoop/nutch/runtime,设置环境变量:
在/etc/profile中:export NUTCH_HOME=/home/hadoop/nutch/runtime/local  source /etc/profile使得修改起作用。
4应该是把url种子文件上传到hadoop。我的种子文件始终没有成功,这一步略过。
5在/home/hadoop/nutch/runtime/deploy目录下运行:
./bin/nutch crawl  -dir crawl -depth 2 -threads 4 -topN 50

一点心得:nutch2之后不需要把配置文件(conf)分发到集群中的每台机器,但是修改配置文件以后需要重新用ant打包,配置才能生效。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值