阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Nutch2.1分布式抓取

134次阅读
没有评论

共计 1064 个字符,预计需要花费 3 分钟才能阅读完成。

在这篇的基础上 http://www.linuxidc.com/Linux/2014-01/95796.htm。

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 打包,配置才能生效。

Nutch 的详细介绍 :请点这里
Nutch 的下载地址 :请点这里

相关阅读

Nutch2.0 完全分布式部署配置 http://www.linuxidc.com/Linux/2012-10/71977.htm

Nutch-2.0 集群配置 http://www.linuxidc.com/Linux/2012-10/71976.htm

Nutch1.7 学习笔记:基本环境搭建及使用 http://www.linuxidc.com/Linux/2013-11/92891.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-20发表,共计1064字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中