【问题标题】:Nutch 2 with Cassandra as a storage is not crawling data properly使用 Cassandra 作为存储的 Nutch 2 无法正确抓取数据
【发布时间】:2015-02-19 19:40:30
【问题描述】:

我正在使用 Nutch 2.x,使用 Cassandra 作为存储。目前我只抓取一个网站,数据以字节码格式加载到 Cassandra。 当我在 Nutch 中使用 readdb 命令时,我确实得到了任何有用的爬取数据。

以下是我得到的不同文件和输出的详细信息:

========== 命令运行爬虫 =====================

bin/crawl urls/ crawlDir/ http://localhost:8983/solr/ 3

=========================seed.txt 数据================ ==========

http://www.ft.com

=== 从 cassandra 网页读取数据的 readdb 命令的输出.f 表======

~/Documents/Softwares/apache-nutch-2.3/runtime/local$ bin/nutch readdb -dump data -content
~/Documents/Softwares/apache-nutch-2.3/runtime/local/data$ cat part-r-00000 
http://www.ft.com/  key:    com.ft.www:http/
baseUrl:    null    
status: 4 (status_redir_temp)    
fetchTime:  1426888912463
prevFetchTime:  1424296904936
fetchInterval:  2592000
retriesSinceFetch:  0    
modifiedTime:   0    
prevModifiedTime:   0
protocolStatus: (null)    
parseStatus:    (null)
title:  null
score:  1.0
marker _injmrk_ :   y
marker dist :   0    
reprUrl:    null    
batchId:    1424296906-20007    
metadata _csh_ : 

=============== regex-urlfilter.txt 的内容 ======================

# skip file: ftp: and mailto: urls
-^(file|ftp|mailto):

# skip image and other suffixes we can't yet parse
# for a more extensive coverage use the urlfilter-suffix plugin
-\.(gif|GIF|jpg|JPG|png|PNG|ico|ICO|css|CSS|sit|SIT|eps|EPS|wmf|WMF|zip|ZIP|ppt|PPT|mpg|MPG|xls|XLS|gz|GZ|rpm|RPM|tgz|TGZ|mov|MOV|exe|EXE|jpeg|JPEG|bmp|BMP|js|JS)$

# skip URLs containing certain characters as probable queries, etc.    
-[?*!@=]

# skip URLs with slash-delimited segment that repeats 3+ times, to break loops
-.*(/[^/]+)/[^/]+\1/[^/]+\1/

# accept anything else    
+.

===========困扰我的日志文件内容======================

2015-02-18 13:57:51,253 ERROR store.CassandraStore - 
2015-02-18 13:57:51,253 ERROR store.CassandraStore - [Ljava.lang.StackTraceElement;@653e3e90
2015-02-18 14:01:45,537 INFO  connection.CassandraHostRetryService - Downed Host Retry service started with queue size -1 and retry delay 10s

如果您需要更多信息,请告诉我。 有人可以帮我吗?

提前致谢。 -苏曼特

【问题讨论】:

  • 您可能想编辑您的帖子!你的代码有点难读,我觉得可能需要格式化一下。
  • 要我删除一些内容吗?
  • 我认为你应该check out this link。它可能会帮助您回答您的问题。
  • 完成编辑..希望这是可读格式..

标签: cassandra web-crawler nutch gora


【解决方案1】:

我今天才开始使用 Nutch 和 Cassandra。在抓取期间,我的日志文件中没有收到相同的错误。

您是否仔细检查了您的 nutch-site.xml 和 gora.properties 设置?这就是我目前配置文件的方式。

nutch-site.xml

    <configuration>
    <property>
    <name>http.agent.name</name>
    <value>My Spider</value>
    </property>
    <property> 
       <name>storage.data.store.class</name> 
       <value>org.apache.gora.cassandra.store.CassandraStore</value>
       <description>Default class for storing data</description>
    </property>
</configuration>

gora.properties

#############################
# CassandraStore properties #
#############################
gora.datastore.default=org.apache.gora.cassandra.store.CassandraStore
gora.cassandrastore.servers=localhost:9160

【讨论】:

  • 感谢您的回复。我在两个文件中添加了相同的设置。您能否发布 regex-urlfilter.txt 文件的内容,然后是 seed.txt 文件以及加载到您的 cassandra pages.f 表中的内容?因为我认为我的 regex-urlfilter.txt 中存在跳过链接的问题。你能抓取所有的链接吗?
  • 我的 regexurlfilter.txt 和你的一模一样,我正在测试一个或两个链接,其中一个是 [nutch.apache.org/]。我也没有超过第一级,所以遇到了和你一样的问题,除了我没有在我的日志中得到“ERROR store.CassandraStore”报告。所以我也在查看我的正则表达式设置。我将添加我的 pages.f 表。抱歉,我认为我至少可以让您克服 CassadraStore 错误。
  • 谢谢。现在我也没有收到 Cassandra 错误 :) 不知道它是如何解决的 :P 现在的问题是 Nutch 没有抓取除了 seed.txt 中的链接之外的任何链接。如果你能解决这个问题,请告诉我。另外,如果您需要任何帮助,请告诉我。
  • 克里斯,有什么进展吗?
  • Sumant,今天回来,还没有成功。发布到 Nutch 用户组。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-03-04
  • 2021-03-04
  • 1970-01-01
  • 2019-05-08
  • 1970-01-01
  • 2015-11-22
  • 2014-06-13
相关资源
最近更新 更多