`
lovejuan1314
  • 浏览: 337473 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Nutch-0.9 研究 Whole-web Crawling<一>

阅读更多

## ### [b]Whole-web: Boostrapping the Web Database[/b]
wget http://www.alliedquotes.com/mirrors/apache/lucene/nutch/nutch-0.9.tar.gz
## unzip
tar xzvf nutch-0.9.tar.gz
mv nutch-0.9 nutch
cd nutch
## 得到一个url list 文件
wget http://rdf.dmoz.org/rdf/content.rdf.u8.gz
## 解压文件
gunzip content.rdf.u8.gz
##创建目录dmoz存放url list
mkdir dmoz
## 
bin/nutch org.apache.nutch.tools.DmozParser content.rdf.u8 -subset 5000 > dmoz/urls
##注入链接
bin/nutch inject crawl/crawldb dmoz
## 编辑nutch-site文件加入一下内容
vi conf/nutch-site.xml


<property>
  <name>http.agent.name</name>
  <value>*</value>
  <description>HTTP 'User-Agent' request header. MUST NOT be empty - 
  please set this to a single word uniquely related to your organization.

  NOTE: You should also check other related properties:

  http.robots.agents
  http.agent.description
  http.agent.url
  http.agent.email
  http.agent.version

  and set their values appropriately.

  </description>
</property>

<property>
  <name>http.agent.description</name>
  <value>test</value>
  <description>Further description of our bot- this text is used in
  the User-Agent header.  It appears in parenthesis after the agent name.
  </description>
</property>

<property>
  <name>http.agent.url</name>
  <value>test</value>
  <description>A URL to advertise in the User-Agent header.  This will 
   appear in parenthesis after the agent name. Custom dictates that this
   should be a URL of a page explaining the purpose and behavior of this
   crawler.
  </description>
</property>

<property>
  <name>http.agent.email</name>
  <value>test.com</value>
  <description>An email address to advertise in the HTTP 'From' request
   header and User-Agent header. A good practice is to mangle this
   address (e.g. 'info at example dot com') to avoid spamming.
  </description>
</property>



#### [b]Whole-web: Fetching[/b]
##
bin/nutch generate crawl/crawldb crawl/segments
s1=`ls -d crawl/segments/2* | tail -1`
echo $s1
bin/nutch fetch $s1
bin/nutch updatedb crawl/crawldb $s1

##
s2=`ls -d crawl/segments/2* | tail -1`
echo $s2

bin/nutch fetch $s2
bin/nutch updatedb crawl/crawldb $s2

##
s3=`ls -d crawl/segments/2* | tail -1`
echo $s3

bin/nutch fetch $s3
bin/nutch updatedb crawl/crawldb $s3

#### [b]Whole-web: Indexing[/b]

bin/nutch invertlinks crawl/linkdb crawl/segments/*

bin/nutch index crawl/indexes crawl/crawldb crawl/linkdb crawl/segments/*

### 安装tomcat6
wget http://apache.imghat.com/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.tar.gz

tar xzvf apache-tomcat-6.0.20.tar.gz

mv apache-tomcat-6.0.20 /usr/share/tomcat6

#### Searching

bin/nutch org.apache.nutch.searcher.NutchBean apache

cp nutch*.war /usr/share/tomcat6/webapps/nutch.war

## 启动tomcat
/usr/share/tomcat6/bin/catalina.sh start





注意:
关于Nutch-0.9一定要使用tomcat6,我用yum安装的是tomcat5,用命令行可以搜出结果,可是在tomcat的web页面下一直显示搜不到结果,换tomcat6后一切正常.

还有需要注意的几点:

第一: 需要配置/usr/share/tomcat6/webapps/nutch/WEB-INF/classes/nutch-site.xml

<!-- HTTP properties -->
<property>
  <name>http.agent.name</name>
  <value>*</value>
  <description></description>
</property>
<!-- file properties -->
<property>
  <name>searcher.dir</name>
  <value>/root/nutch/crawl</value>
  <description></description>
</property> 


第二:
org.apache.jasper.JasperException: /search.jsp(151,22) Attribute value  language + "/include/header.html" is quoted with " which must be escaped when used within the value
//这个错误需要编辑 seach.jsp cached.jsp  explain.jsp  anchors.jsp

将
<jsp:include page="<%= language + "/include/header.html"%>"/>
替换为
<jsp:include page="<%= language + \"/include/header.html\"%>"/>

<i18n:message key="page">
  <i18n:messageArg value="<%=details.getValue("url")%>"/>
</i18n:message>

替换为
<i18n:message key="page">
  <% String detailsStr=details.getValue("url");%>
  <i18n:messageArg value="<%=detailsStr%>"/>
</i18n:message>



最后,该文大部分步骤来源于http://lucene.apache.org/nutch/tutorial8.html 0.8文档的,其中针对0.9的做了少量改动.

运行结果:




更新: nutch-1.0已经更新了这几个jsp.. 只要确保nutch-default.xml和nutch-site.xml配置正确就可以了..

  • 大小: 125.9 KB
0
0
分享到:
评论

相关推荐

    Eclipse中编译Nutch-0.9

    Eclipse 编译 Nutch-0.9

    AnyFo – Nutch 冰破银针

    1.6 Tomcat中启动搜索站台 1. 将Nutch.war包考到Tomcat的webapps下。...&lt;value&gt;E:\nutch-0.9\crawl&lt;/value&gt; &lt;/property&gt; 2. 启动Tomcat,输入http://127.0.0.1:8080/nutch-0.9 3. 可以进行查询了。

    nutch-0.9 环境搭建所需最小cygwin

    参考文章 http://blog.csdn.net/handyhuang/article/details/7421553

    apache-nutch-1.6-bin.tar.gz最新版

    在e盘下面出现nutch-0.9文件夹说明解压成功了.然后环境变量设置为NUTCH_JAVA_HOME=C:\Program Files\Java\jdk1.5.0(也就是说跟JAVA_HOME是相同的).测试nutch是否安装成功,只需要执行以下命令: $cd D:/Downloads/...

    apache-nutch-2.3.1-src.tar.gz

    apache-nutch-2.3.1-src.tar.gz

    nutch配置nutch-default.xml

    nutch配置nutch-default.xml

    apache-nutch-1.3-src.tar.gz_nutch_nutch-1.3.tar.gz

    apache-nutch-1.3 的源码包,需要的可以看下

    apache-nutch-2.2.1(Eclipse直接运行版)001

    apache-nutch-2.2.1(Eclipse直接运行版)今天刚做的,发现有很多坑,分享给大家实验,JDK1.7 Win10。我分享的两个压缩卷一起下载才可以用,资源限制太小了 002地址:...

    apache-nutch-1.4

    Nutch是一个由Java实现的,刚刚诞生开放源代码(open-source)的web搜索引擎。Nutch目前最新的版本为version1.4。这个为nutch的最新版 1.4。

    apache-nutch-1.16.rar 已编译好的版本,可以直接导入eclipse、idea

    已编译好的版本,可以直接导入eclipse、idea。Nutch 是一个开源Java 实现的搜索引擎。它提供了我们运行自己的搜索引擎所需的全部工具。包括全文搜索和Web爬虫。

    apache-nutch-1.4-bin.tar.gz

    Nutch 是一个开源Java 实现的搜索引擎。这里是它的安装包。

    nutch-1.2.part06

    nutch Nutch是一个由Java实现的,刚刚诞生开放源代码(open-source)的web搜索引擎。 尽管Web搜索是漫游Internet的基本要求, 但是现有web搜索引擎的数目却在下降。 并且这很有可能进一步演变成为一个公司垄断了几乎...

    apache-nutch-1.5.1-bin.tar.gz

    Nutch是一款刚刚诞生的完整的开源搜索引擎系统,可以结合数据库进行索引,能快速构建所需系统。Nutch 是基于Lucene的,Lucene为 Nutch 提供了文本索引和搜索的API,所以它使用Lucene作为索引和检索的模块。Nutch的...

    apache-nutch-1.7-src.tar.gz

    一个开源Java 实现的搜索引擎nutch

    nutch-1.0part1

    Nutch 是一个开源Java 实现的搜索引擎。它提供了我们运行自己的搜索引擎所需的全部工具。包括全文搜索和Web爬虫。

    nutch-param-set

    nutch-param-setnutch-param-setnutch-param-setnutch-param-set

    nutch-1.5.1源码

    Nutch 是一个开源Java 实现的搜索引擎。它提供了我们运行自己的搜索引擎所需的全部工具。包括全文搜索和Web爬虫。包含nutch-1.5.1的源码

    nutch-1.9 源码

    好用的爬虫工具,刚发布不久的新版本 nutch是网络搜索及信息提取中使用得最广泛的网络爬虫工具 仅仅使用简单的配置就可以实现强大的爬取信息功能

    apache-nutch-2.3.1-src

    apache-nutch-2.3.1-src.tar ,网络爬虫的源码, 用ivy2管理, ant runtime 编译 apache-nutch-2.3.1-src.tar ,网络爬虫的源码, 用ivy2管理, ant runtime 编译

    Eclipse中编译Nutch-1.0

    Eclipse 中编译 Nutch-1.0 运行源代码

Global site tag (gtag.js) - Google Analytics