【问题标题】:ElasticSearch and Nutch integrationElasticSearch 和 Nutch 集成
【发布时间】:2016-06-13 04:35:58
【问题描述】:

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

我已尝试遵循此处列出的 Nutch+ES 指南

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

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

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

具体来说,我能够设置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 中没有任何变化。 runtime/local/logs 下的日志显示:

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

这让我相信 ES 根本不需要 nutch 索引任何东西。

整个过程我哪里做错了?我必须指定一些关于 ES 的东西来 nutch 吗?

仅供参考:以下是一些操作系统/工具的详细信息: CentOS 6.7、HBase 1.1.3 弹性搜索 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>

非常感谢大家的帮助!

【问题讨论】:

    标签: elasticsearch nutch bigdata


    【解决方案1】:

    我不知道我是否完全弄清楚了这一点,也不确定以下任何步骤是否有帮助,但最终我成功地将一些页面索引到 ES:

    这就是我所做的:

    我发现root_nutch_folder/src/plugins/中嵌入的ES客户端java是1.4.1版本。我按照 indexer-elastic 文件夹中指定的 howto_upgrade_es.txt 文件将其升级到 1.7.5(匹配我的 ES 本地服务器版本)。但是,我认为这对问题没有帮助,因为是 nutch 没有告诉 ES 索引任何内容,而不是 ES 客户端-服务器通信问题。

    我发现可能影响索引的关键是我的页面实际上没有被抓取,尽管 HBase 的“网页”表中有记录。最初我尝试了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重定向请求。我想我将不得不忍受这个。

    【讨论】:

      【解决方案2】:

      从位于 nutch 文件夹的运行时文件夹中的本地文件夹中尝试 bin/nutch index -all。此外,如果仍然无法正常工作,请尝试使用bin/nutch generate -topN &lt;any_number&gt; 再次生成它,然后使用命令再次获取并解析它们 bin/nutch fetch -all bin/nutch parse -all 最后, bin/nutch updatedb -all 然后使用本地文件夹中的命令重试 bin/nutch index -all

      希望它会有所帮助。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-08-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-07-16
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多