nutch 1.2 hadoop 错误解决Stopping at depth=0 - no more URLs t==

 

 

 

 

Stopping at depth=0 - no more URLs to fetch
 

看了好多版本的lnutch-1.2/conf/crawl-urlfilter.txt修改

从国内的:

 

 

urls/url.txt 或# accept hosts in MY.DOMAIN.NAME

+^http://([a-z0-9]*\.)*163.com/

 者是urls/urllist.txt

 

http://www.163.com/
 

 

到国外的appache

 

# accept hosts in MY.DOMAIN.NAME
+^http://([a-z0-9]*\.)*appache.com/
 

 

urls/url.txt 或者是urls/urllist.txt

 

http://www.appache.com/

 

 

看到有人说:nutch0.9 的url.txt要改成两个相同地址,只有一个nutch会忽然掉第一个地址,所以就没了。

也照做了,还是没有办法。

http://www.cnblogs.com/ansen/articles/2055778.html )

最后出现一个想法,因为hadoop的每个机器上的代码都要一致的。

之前已经配好了hadoop,已经启动了。

再配置crawl-urlfilter.txt的时候,我没有scp到其他的linux下。所以我尝试着把crawl-urlfilter.txt文件scp到其他的linux机器对应目录上。再次 

hdfs  urls/url.txt里的内容是:

 

http://www.163.com/
http://www.163.com
http://www.163.com/
http://www.163.com/
 

 

$ nutch crawl  urls -dir crawl -depth 3 -topN 10
 果然不再出现上述错误了。

但是出现了Stopping at depth= - no more URLs to fetch的错误,显然上面没能解决问题。

Generator: 0 records selected for fetching, exiting ...
Stopping at depth=1 - no more URLs to fetch.
 

 

 

我考虑是不是crawl-urlfilter.txt是不配置错了,另一方便也由于自己正则表达式不太了解。所以决定搜索下crawl-urlfilter.txt。。
在google中搜索“crawl-urlfilter.txt nutch” ,发现了一篇文章,
crawl-urlfilter.txt 和 regex-urlfilter.txt 的不同http://hi.baidu.com/kaffens/blog/item/769bb32ac4ec8628d52af17a.html 
指出需要配置: urlfilter.regex.file 以覆盖默认的 nutch-default.xml 内的 urlfilter.regex.fil值。
故复制 nutch-default.xml关于 urlfilter.regex.fil这一段(搜索即可定位到)写入 nutch-site.xml文件下
$vi nutch-site.xml
 
在<configuration> </configuration>之间写入下面内容
<property>
<name>urlfilter.regex.file</name>
<value>crawl-urlfilter.txt</value>
<description>Name of file on CLASSPATH containing regular expressions
used by urlfilter-regex (RegexURLFilter) plugin.</description>
</property>
 
另外避免动态网站被屏蔽,修改crawl-urlfilter.txt 中
 写道
# skip URLs containing certain characters as probable queries, etc.
+[?*!@=]
 
(-改+) 
见 http://a280606790.iteye.com/blog/833607 

再重新搜索。
$ nutch crawl  urls -dir crawl -depth 3 -topN 10
完成后用命令:
bin/nutch readdb crawl/crawldb -dump tmp/entiredump
bin/hadoop dfs -copyToLocal tmp/entiredump /home/lf/output/entiredump
less /nutch/search/output/entiredump/*

   注意crawl 必须要和nutch 搜索时的 -dir crawl目录保持一致
如果能看到内容,说明搜索成功
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值