步骤1:准备好eclipse、eclipse svn插件、mysql准备好,mysql使用utf-8编码

步骤2:mysql建库,建表:

CREATE DATABASE nutch ;             
CREATE TABLE `webpage` (
`id` varchar(767) NOT NULL,
`headers` blob,
`text` mediumtext DEFAULT NULL,
`status` int(11) DEFAULT NULL,
`markers` blob,
`parseStatus` blob,
`modifiedTime` bigint(20) DEFAULT NULL,
`score` float DEFAULT NULL,
`typ` varchar(32) CHARACTER SET latin1 DEFAULT NULL,
`baseUrl` varchar(767) DEFAULT NULL,
`content` longblob,
`title` varchar(2048) DEFAULT NULL,
`reprUrl` varchar(767) DEFAULT NULL,
`fetchInterval` int(11) DEFAULT NULL,
`prevFetchTime` bigint(20) DEFAULT NULL,
`inlinks` mediumblob,
`prevSignature` blob,
`outlinks` mediumblob,
`fetchTime` bigint(20) DEFAULT NULL,
`retriesSinceFetch` int(11) DEFAULT NULL,
`protocolStatus` blob,
`signature` blob,
`metadata` blob,
PRIMARY KEY (`id`)
) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED
DEFAULT CHARSET=utf8mb4;
`id` varchar(767) NOT NULL 这个在我本机是不能成功的,只能最大设置为100 所以改为:`id` varchar(100) NOT NULL

步骤3:从 https://svn.apache.org/repos/asf/nutch/tags/release-2.1  拉下代码,在本地创建java project。本人因为试验过很多次,所以在此取项目名称为test。

步骤4:加src文件

在project explorer下右击项目,选择properties。进入java build path ,在source选项卡,删除src文件夹,选择“Add Folder ”,在这里把conf,src/bin,src/java,src/test,src/testresources,以及src/plugin文件夹下各个插件的src和test也加入进来。最终可以看到如下界面(test为项目名称):
在每个eclipse 项目文件夹下有 .classpath文件,打开 .classpath文件能看到:内容基本是这样的。
<classpathentry kind="src" path="conf"/>
<classpathentry kind="src" path="src/java"/>
<classpathentry kind="src" path="src/test"/>
<classpathentry kind="src" path="src/plugin/protocol-file/src/test"/>
<classpathentry kind="src" path="src/plugin/protocol-httpclient/src/test"/>
<classpathentry kind="src" path="src/plugin/subcollection/src/test"/>
<classpathentry kind="src" path="src/plugin/parse-html/src/test"/>
<classpathentry kind="src" path="src/plugin/urlfilter-automaton/src/test"/>
<classpathentry kind="src" path="src/plugin/parse-html/src/java"/>
<classpathentry kind="src" path="src/plugin/parse-tika/src/test"/>
<classpathentry kind="src" path="src/plugin/lib-http/src/test"/>
<classpathentry kind="src" path="src/plugin/parse-tika/src/java"/>
<classpathentry kind="src" path="src/plugin/urlfilter-regex/src/java"/>
<classpathentry kind="src" path="src/plugin/urlfilter-domain/src/java"/>
<classpathentry kind="src" path="src/plugin/scoring-link/src/java"/>
<classpathentry kind="src" path="src/plugin/index-anchor/src/test"/>
<classpathentry kind="src" path="src/plugin/protocol-http/src/java"/>
<classpathentry kind="src" path="src/plugin/urlnormalizer-regex/src/test"/>
<classpathentry kind="src" path="src/plugin/urlfilter-prefix/src/java"/>
<classpathentry kind="src" path="src/plugin/scoring-opic/src/java"/>
<classpathentry kind="src" path="src/plugin/urlfilter-domain/src/test"/>
<classpathentry kind="src" path="src/plugin/protocol-file/src/java"/>
<classpathentry kind="src" path="src/plugin/urlnormalizer-regex/src/java"/>
<classpathentry kind="src" path="src/plugin/urlfilter-suffix/src/java"/>
<classpathentry kind="src" path="src/plugin/language-identifier/src/java"/>
<classpathentry kind="src" path="src/plugin/lib-regex-filter/src/test"/>
<classpathentry kind="src" path="src/plugin/language-identifier/src/test"/>
<classpathentry kind="src" path="src/plugin/subcollection/src/java"/>
<classpathentry kind="src" path="src/plugin/urlnormalizer-basic/src/test"/>
<classpathentry kind="src" path="src/plugin/index-basic/src/java"/>
<classpathentry kind="src" path="src/plugin/urlnormalizer-pass/src/test"/>
<classpathentry kind="src" path="src/plugin/creativecommons/src/java"/>
<classpathentry kind="src" path="src/bin"/>
<classpathentry kind="src" path="src/plugin/protocol-httpclient/src/java"/>
<classpathentry kind="src" path="src/plugin/tld/src/java"/>
<classpathentry kind="src" path="src/plugin/urlnormalizer-basic/src/java"/>
<classpathentry kind="src" path="src/plugin/index-basic/src/test"/>
<classpathentry kind="src" path="src/plugin/lib-http/src/java"/>
<classpathentry kind="src" path="src/plugin/protocol-ftp/src/java"/>
<classpathentry kind="src" path="src/plugin/index-anchor/src/java"/>
<classpathentry kind="src" path="src/plugin/urlfilter-validator/src/java"/>
<classpathentry kind="src" path="src/plugin/index-more/src/java"/>
<classpathentry kind="src" path="src/plugin/urlfilter-suffix/src/test"/>
<classpathentry kind="src" path="src/plugin/creativecommons/src/test"/>
<classpathentry kind="src" path="src/plugin/microformats-reltag/src/java"/>
<classpathentry kind="src" path="src/plugin/urlfilter-regex/src/test"/>
<classpathentry kind="src" path="src/plugin/lib-regex-filter/src/java"/>
<classpathentry kind="src" path="src/plugin/index-more/src/test"/>
<classpathentry kind="src" path="src/plugin/urlnormalizer-pass/src/java"/>
<classpathentry kind="src" path="src/plugin/urlfilter-automaton/src/java"/>
<classpathentry kind="src" path="src/testresources"/>

步骤5:加入lib包:

切换到Libaries选项卡,“Add Library"->"IvyDE Managed Dependencies"->"Next",选择“Project”,选择ivy\ivy.xml文件。点 Ok。eclipse会自动下载依赖的jar包。

在这个过程中或许会报错,看到错误信息是因为org.restlet.jse包下载不到。解决方法是:ivy\ivy.xml中找到
<dependency org="org.restlet.jse" name="org.restlet" rev="2.0.5" conf="*->default" />
    <dependency org="org.restlet.jse" name="org.restlet.ext.jackson" rev="2.0.5" 

conf="*->default" />

部分,注释掉。在网上手动找到这两个包,放在lib包下,加入到Libaries中。

接着加入plugin文件夹下各个插件的ivy.xml文件。手动一个一个加进去。

步骤6:在"Order and Export"选项卡,将 conf    top

步骤7:数据库配置以及其他配置信息

打开/conf/gora.properties ,删除文件中所有内容,写入mysql配置:
###############################
# MySQL properties            #
###############################
gora.sqlstore.jdbc.driver=com.mysql.jdbc.Driver
gora.sqlstore.jdbc.url=jdbc:mysql://localhost:3306/nutch?createDatabaseIfNotExist=true
gora.sqlstore.jdbc.user=root

gora.sqlstore.jdbc.password=123456

在/conf/gora-sql-mapping.xml 修改  <primarykey column="id" length="240"/>
 /conf/nutch-site.xml输入:

<property>
<name>http.agent.name</name>
<value>Your Nutch Spider</value>
</property>
<property>
<name>http.accept.language</name>
<value>ja-jp, en-us,en-gb,en;q=0.7,*;q=0.3</value>
<description>Value of the “Accept-Language” request header field.
This allows selecting non-English language as default one to retrieve.
It is a useful setting for search engines build for certain national group.
</description>
</property>
<property>
<name>parser.character.encoding.default</name>
<value>utf-8</value>
<description>The character encoding to fall back to when no other information
is available</description>
</property>
<property>
  <name>plugin.includes</name>
 <value>protocol-httpclient|protocol-http|urlfilter-regex|parse-(html|tika)|index-(basic|anchor)|urlnormalizer-(pass|regex|basic)|scoring-opic</value>
 <description>Regular expression naming plugin directory names to
  include.  Any plugin not matching this expression is excluded.
  In any case you need at least include the nutch-extensionpoints plugin. By
  default Nutch includes crawling just HTML and plain text via HTTP,
  and basic indexing and search plugins. In order to use HTTPS please enable 
  protocol-httpclient, but be aware of possible intermittent problems with the 
  underlying commons-httpclient library.
  </description>
</property>
<property>
<name>storage.data.store.class</name>
<value>org.apache.gora.sql.store.SqlStore</value>
<description>The Gora DataStore class for storing and retrieving data.
Currently the following stores are available: ….
</description>
</property>
<property>
  <name>plugin.folders</name>
  <value>./src/plugin</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> 
在根目录下的build.xml中找到如下代码
  1. <target name="resolve-default" depends="clean-lib, init" description="--> resolve and retrieve dependencies with ivy">
  2. <ivy:resolve file="${ivy.file}" conf="default" log="download-only" />
  3. <ivy:retrieve pattern="${build.lib.dir}/[artifact]-[revision].[ext]" symlink="false" log="quiet" />
  4. <antcall target="copy-libs" />
  5. </target>

将pattern="${build.lib.dir}/[artifact]-[revision].[ext]"替换为pattern="${build.lib.dir}/[artifact]-[type]-[revision].[ext]"

步骤8:配置抓取url

在test项目下创建文件夹urls,在urls下创建文件seeds.txt ,写你要抓取的网站。我写的是http://www.163.com。

步骤9:运行org.apache.nutch.crawl.Crawler

打开Crawler文件,“Run As” -> “Run Configurations” ,在“Arguments”选项卡的“Program Arguments”,输入   “urls -depth 3 -topN 5”,点"Run"。哈哈,报错了吧。报错信息类似于“ Failed to set permissions of path: \tmp\hadoop-Administrator\mapred\staging\Administrator1712398257\.  ”的错误。这是hadoop的一个问题。解决方法是,修改/hadoop-1.0.2/src/core/org/apache/hadoop/fs/FileUtil.java里面的checkReturnValue,注释掉即可。当然最简单的办法是在网上找一个修改过的包,替换一下FileUtil.class。
再次运行,哈哈 执行成功到此结束。
祝各位好运吧。

参考资料:

http://cosmo1987.iteye.com/blog/1826971
http://nlp.solutions.asia/?p=180
http://wiki.apache.org/nutch/RunNutchInEclipse 

遇到的问题:
1 报 Exception in thread "main" java.lang.RuntimeException: job failed: name=parse, jobid=job_local_0004
根据在网上查到的问题可能很多首先 nutch-default.xml 中配置 <name>plugin.folders</name><value>./src/plugin</value>
  其次查找 hadoop.log文件。

nutch2.1在windows平台上使用eclipsedebug 存储在mysql的搭建过程相关推荐

  1. x264代码剖析(一):图文详解x264在Windows平台上的搭建

    x264代码剖析(一):图文详解x264在Windows平台上的搭建 X264源码下载地址:http://ftp.videolan.org/pub/videolan/x264/ 平台:win7 PC. ...

  2. 细数 Windows 平台上的 NoSQL 数据库

    从可查询的分布式解决方案,如MongoDB,到简单的分布式Key/Value存储解决方案,如Cassandra.此外,还有Riak,Tokyo Cabinet,Voldemort,CouchDB和Re ...

  3. (转)在Windows平台上安装Node.js及NPM模块管理

    本文转载自:http://www.cnblogs.com/seanlv/archive/2011/11/22/2258716.html 之前9月份的时候我写了一篇关于如何在Windows平台上手工管理 ...

  4. python文件名有空格_python 解决Windows平台上路径有空格的问题

    最近在采集windows上中间件的时候,遇到了文件路径有空格的问题. 例如:Aapche的安装路径为D:\Program Files\Apache Software Foundation\Apache ...

  5. 在Windows平台上安装Node.js及NPM模块管理

    1. 下载Node.js官方Windows版程序:http://nodejs.org/#download     从0.6.1开始,Node.js在Windows平台上提供了两种安装方式,一是.MSI ...

  6. 标准配置的Windows平台上潜在可用屏幕区域

    经常在windows开发网站的朋友,在开始设计网站时,最需要知道的就是一个图片的大小和尺寸.我本人也是在windows上玩弄了几年的,虽然没有什么正规的证书之类的,但是自己对windows的东西,一些 ...

  7. 在Windows平台上安装Dubbox框架

    在Windows平台上安装Dubbox框架 一.分布式系统概述 分布式处理方式越来越受到业界的青睐--计算机系统正在经历一场前所未有的从集中式向分布式架构的变革.分布式系统是一个硬件或软件组件分布在不 ...

  8. Windows平台上安装搭建iPhone/iPad的开发环境

    很多朋友希望在体验或学习iphone开发,但是iphone开发环境一般需要 安装在mac计算机下mac os中. 这给许多朋友带来了额外成本投入. 网上已经有各种破解方法,在非苹果电脑上安装iphon ...

  9. 管家婆 源码 php,在windows平台上构建本身的PHP

    这是一篇翻译的文章,原文拜见:https://wiki.php.net/internals/windows/stepbystepbuild 趁便提一句,wiki.php.net有很多出色的内容,想深切 ...

最新文章

  1. 通过 Jersey Http请求头,Http响应头,客户端 API 调用 REST 风格的 Web 服务
  2. 网络工程师必懂的专业术语
  3. knn的python代码_KNN-python代码实现
  4. 获取一段html的内容简介
  5. 0083-Nocomachns定理
  6. 针对JDK 14提议的另外六个JEP
  7. [css] sass是怎么定义变量的?
  8. 领域应用 | 大众点评搜索基于知识图谱的深度学习排序实践
  9. python改文件后缀名_python 批量修改文件后缀名(示例)
  10. 【MATLAB】MATLAB 2017A 软件安装
  11. java文档生成器_最好用的数据库文档生成工具
  12. vs 2019 创建rdl报表
  13. 为什么不居中(CellRangeAddress),关于excel导出合并单元格
  14. Mac清理系统用什么软件?
  15. 电力电子转战数字IC——我的IC笔试(2022.10.14更新)
  16. 盘点:当今十大备份应用软件(转)
  17. strcmp函数的两种实现
  18. 中国农科院基因组所刘永鑫组诚聘博士后/海外联培博士/客座研究生
  19. android .reset(),Android驱动笔记(13)——PMIC reset介绍
  20. Python由来以及用途

热门文章

  1. OpenGL学习之路(二)
  2. 同意按钮,倒计时10秒,同意按钮变为可提交的
  3. HDU 4635(强连通分量分解
  4. 用cookie实现叶卡的记忆功能
  5. AllTray-将办法最小化到琐细托盘
  6. JavaScript计算两个日期相差天数/分钟/小时
  7. java将字符串转换成可执行代码
  8. SpringBoot启动报错java.nio.charset.MalformedInputException: Input length = 2解决方案
  9. flutter中的异步机制Future
  10. o.s.b.d.LoggingFailureAnalysisReporter