2016-02-29 93 views
1

我有一个关于ElasticSearch和Apache Nutch集成的问题。ElasticSearch和Nutch集成

我试图按照这里

http://www.aossama.com/search-engine-with-apache-nutch-mongodb-and-elasticsearch/

具体列出

https://gist.github.com/xrstf/b48a970098a8e76943b9

https://qbox.io/blog/scraping-the-web-with-nutch-for-elasticsearch

的Nutch的+ ES导游,我是能够建立HDFS + HBase + Nutch并抓取页面列表(我可以确认数据确实已被抓取并且存储在HBase的网页表中)。

我还可以得到ElasticSearch和Kibana没有问题的工作(成功创建新的索引,并插入一些记录,证实Kibana工作)

但是,我不能让他们组合工作。基本上,我后,我做了Nutch的以下命令:

nutch inject <file_containing_url> 
nutch generate -topN 1 
nutch fetch -all 
nutch parse -all 
nutch updatedb -all 

现在,我要编制索引的读入数据到ES,我跟着指南:

nutch index elasticsearch -all 

然而,该命令后,完成执行,ElasticSearch中没有任何更改。在运行时/本地/日志的记录显示:

elastic.ElasticIndexWriter - Processing remaining requests [docs = 0, length = 0, total docs = 0] 

这让我相信ES没有被Nutch的要求指标的任何东西。

我在整个过程中哪里做错了?我必须指定一些有关ES的事情吗?

仅供参考:下面是一些操作系统/工具的详细信息: CentOS 6.7,HBase 1.1.3 ElasticSearch 1.7.5,Nutch 2.3.1。 我已经修改的Nutch-site.xml中包括ES的属性:

<property> 
     <name>plugin.includes</name> 
     <!-- do **NOT** enable the parse-html plugin, if you want proper HTML parsing. Use something like parse-tika! --> 
     <value>protocol-httpclient|urlfilter-regex|parse-(text|tika|js)|index-(basic|anchor|more)|query-(basic|site|url)|response-(json|xml)|summary-basic|scoring-opic|urlnormalizer-(pass|regex|basic)|indexer-elastic</value> 
    </property> 
    <property> 
     <name>elastic.host</name> 
     <value>10.5.140.112</value> <!-- where is ElasticSearch listening --> 
    </property> 
     <property> 
     <name>elastic.cluster</name> 
     <value>nutch</value> 
     </property> 

     <property> 
     <name>elastic.index</name> 
     <value>nutch</value> 
     </property> 

     <property> 
     <name>elastic.port</name> 
     <value>9300</value> 
     </property> 

谢谢大家这么多的帮助!

回答

0

我不知道如果我想通了这一点完全和我不知道如果有下列步骤的帮助,但最终我成功收录一些网页,以ES:

这里就是我所做的:

我发现嵌入在root_nutch_folder/src/plugins /中的ES客户端Java是版本1.4.1。我将它升级到1.7.5(匹配我的ES本地服务器版本),遵循indexer-elastic文件夹中指定的howto_upgrade_es.txt文件。但是,我不认为这有助于解决问题,因为这是nutch并没有告诉ES索引任何东西,而不是ES客户端 - 服务器通信问题。

我发现可能影响索引的关键是我的页面实际上并未被抓取,尽管HBase中的'webpage'表中有记录。最初我尝试http://www.espn.com并做了nutch注射。但是,由于www.espn.com将重定向到espn.go.com,nutch将不会自动执行重定向,因此不会下载HTML内容。然而,nutch日志将始终显示“成功”。即使HBase也会记录有关www.espn.com的信息。

我重新注入'http://espn.go.com/'并重新执行整个过程,现在它已正确地编入ES。

我在线谷歌搜索,发现我需要在nutch-site.xml中设置http.redirect.max,但是,无论我如何设置,nutch仍然不会遵循302重定向请求。我想我必须忍受这一点。