`
deepfuture
  • 浏览: 4375450 次
  • 性别: Icon_minigender_1
  • 来自: 湛江
博客专栏
073ec2a9-85b7-3ebf-a3bb-c6361e6c6f64
SQLite源码剖析
浏览量:79862
1591c4b8-62f1-3d3e-9551-25c77465da96
WIN32汇编语言学习应用...
浏览量:69454
F5390db6-59dd-338f-ba18-4e93943ff06a
神奇的perl
浏览量:102784
Dac44363-8a80-3836-99aa-f7b7780fa6e2
lucene等搜索引擎解析...
浏览量:283970
Ec49a563-4109-3c69-9c83-8f6d068ba113
深入lucene3.5源码...
浏览量:14910
9b99bfc2-19c2-3346-9100-7f8879c731ce
VB.NET并行与分布式编...
浏览量:66977
B1db2af3-06b3-35bb-ac08-59ff2d1324b4
silverlight 5...
浏览量:31807
4a56b548-ab3d-35af-a984-e0781d142c23
算法下午茶系列
浏览量:45791
社区版块
存档分类
最新评论
阅读更多

Nutch 的配置文件几乎覆盖了Nutch 所有的功能。以前在网上看到过一个关于Nutch-default.XML 配置项解释,地址我没收藏,和本文配合起来看,会更好一些。这里我也不打算对其配置文件中的每一项做解释,如果在下面的解释里找不到想要的内容,请发表评论,我会回复的。

<property>
<name>http.max.delays</name>
<value>20</value>
<description>The number of times a thread will delay when trying to
fetch a page. Each time it finds that a host is busy, it will wait
fetcher.server.delay. After http.max.delays attepts, it will give
up on the page for now.</description>
</property>

爬虫的网络延时线程等待时间,以秒计时 , 默认的配时间是3秒,视网络状况而定。如果在爬虫运行的时候发现服务器返回了主机忙消息,则等待时间由fetcher.server.delay 决定,所以在网络状况不太好的情况下fetcher.server.delay 也设置稍大一点的值较好,此外还有一个http.timeout 也和网络状况有关系。

<property>
<name>http.content.limit</name>
<value>65536</value>
<description>The length limit for downloaded content, in bytes.
If this value is nonnegative (>=0), content longer than it will be truncated;
otherwise, no truncation at all.
</description>
</property>

描述爬虫抓取的文档内容长度的配置项。原来的值是 65536 , 也就是说抓取到的一个文档截取 65KB左右,超过部分将被忽略,对于抓取特定内容的搜索引擎需要修改此项,比如XML文档。

<property>
<name>db.default.fetch.interval</name>
<value>30</value>
<description>The default number of days between re-fetches of a page.
</description>
</property>

这个功能对定期自动爬取需求的开发有用,设置多少天重新爬一个页面。

<property>
<name>fetcher.server.delay</name>
<value>5.0</value>
<description>The number of seconds the fetcher will delay between
successive requests to the same server.</description>
</property>

<property>
<name>fetcher.threads.fetch</name>
<value>10</value>
<description>The number of FetcherThreads the fetcher should use.
This is also determines the maximum number of requests that are
made at once (each FetcherThread handles one connection).</description>
</property>

<property>
<name>fetcher.threads.per.host</name>
<value>1</value>
<description>This number is the maximum number of threads that
should be allowed to access a host at one time.</description>
</property>

<property>
<name>fetcher.verbose</name>
<value>false</value>
<description>If true, fetcher will log more verbosely.</description>
</property>

 

这几个是爬虫线程的配置项,看名称就容易理解。

<property>
<name>parser.threads.parse</name>
<value>10</value>
<description>Number of ParserThreads ParseSegment should use.</description>
</property>

解析爬取到的文档线程数, 和爬虫线程对应,因为爬虫主要的处理类是有很多地方使用到了同步,所以此配置项和爬虫线程保持一直对处理有好处。

<property>
<name>fs.default.name</name>
<value>local</value>
<description>The name of the default file system. Either the
literal string "local" or a host:port for NDFS.</description>
</property>


分布式文件系统 使用的配置项,默认的是 local 表示 使用本地文件系统,如果使用 host:port 的形式表示使用分布式文件系统NDFS,此处的文件系统地址是 nameserver ,也就是通过 bin/nutch namenode xxxx启动的 主机地址和端口号。

<property>
<name>ndfs.name.dir</name>
<value>/tmp/nutch/ndfs/name</value>
<description>Determines where on the local filesystem the NDFS name node
should store the name table.</description>
</property>

分布式文件系统namenode 使用的 的存放数据的目录 ,Namenode 会使用此项,另外在启动 namenode 或datanode的时候也可以加上 路径作为参数也可以生效。

<property>
<name>ndfs.data.dir</name>
<value>/tmp/nutch/ndfs/data</value>
<description>Determines where on the local filesystem an NDFS data node
should store its blocks.</description>
</property>

分布式文件系统ndatanode 使用的 的存放数据的目录 ,datanode 会使用此项,另外在启动 datanode的时候也可以加上 路径作为参数也可以生效。

<property>
<name>indexer.max.tokens</name>
<value>10000</value>
<description>
The maximum number of tokens that will be indexed for a single field
in a document. This limits the amount of memory required for
indexing, so that collections with very large files will not crash
the indexing process by running out of memory.

Note that this effectively truncates large documents, excluding
from the index tokens that occur further in the document. If you
know your source documents are large, be sure to set this value
high enough to accomodate the expected size. If you set it to
Integer.MAX_VALUE, then the only limit is your memory, but you
should anticipate an OutOfMemoryError.
</description>
</property>

这个配置项的功能是限制索引的时候每个文档的单个字段最大10000个Tokens,也就是说在采用默认的一元分词的 情况下,最大的文档字数限制是10000,如果采用其他中文非一元分词系统,则索引的单个文档单个字段将会超过10000个,对内存有影响。

<property>
<name>indexer.mergeFactor</name>
<value>200</value>
<description>The factor that determines the frequency of Lucene segment
merges. This must not be less than 2, higher values increase indexing
speed but lead to increased RAM usage, and increase the number of
open file handles (which may lead to "Too many open files" errors).
NOTE: the "segments" here have nothing to do with Nutch segments, they
are a low-level data unit used by Lucene.
</description>
</property>

合并因子,在建立索引的时候用到,表示索引200个文档的时候回写到存储设备。

<property>
<name>indexer.minMergeDocs</name>
<value>50</value>
<description>This number determines the minimum number of Lucene
Documents buffered in memory between Lucene segment merges. Larger
values increase indexing speed and increase RAM usage.
</description>
</property>


这个配置项对内存影响巨大,功能是在建立索引的时候最小的合并文档数量,这个值设置太小一个会影响索引速度,另外一个在需要索引的文档数量很大的时候会出现 Too Many Open files 的错误,这个时候需要调整此配置项,有试验表明1000的时候会有比较快的索引速度,但我把此项值调整到10000 , 索引的时候最高内存占用到1.8G,索引创建速度是25page/sec , 并且多次索引的时候有一个衰减。不过对查询的相应时间有很大提升,如果内存足够的话修改较大的值比较好。

<property>
<name>indexer.maxMergeDocs</name>
<value>50</value>
<description>This number determines the maximum number of Lucene
Documents to be merged into a new Lucene segment. Larger values
increase indexing speed and reduce the number of Lucene segments,
which reduces the number of open file handles; however, this also
increases RAM usage during indexing.
</description>
</property>

这个好像不需要设置,因为默认的值是 Integer.MAX_VALUE , 不会比这个更大了。

<property>
<name>searcher.summary.context</name>
<value>5</value>
<description>
The number of context terms to display preceding and following
matching terms in a hit summary.
</description>
</property>

这个比较有用,在前面的文章里有介绍。

<property>
<name>searcher.summary.length</name>
<value>20</value>
<description>
The total number of terms to display in a hit summary.
</description>
</property>

在前面的文章里也有介绍。

 


<property>
<name>plugin.folders</name>
<value>plugins</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>

<property>
<name>plugin.includes</name>
<value>protocol-httpclient|urlfilter-regex|parse-(text|html|rss)|index-more|query-(basic|site|url)</value>
<description>Regular expression naming plugin directory names to
include. Any plugin not matching this expression is excluded. By
default Nutch includes crawling just HTML and plain text via HTTP,
and basic indexing and search plugins.
</description>
</property>

这两个是配置 插件功能 的配置项 ,plugin.folders制定插件加载路径,plugin.includes表示需要加载的插件列表,关于插件后面会专门做介绍。

 

<property>
<name>parser.character.encoding.default</name>
<value>windows-1252</value>
<description>The character encoding to fall back to when no other information
is available</description>
</property>

解析文档的时候使用的默认编码windows-1252 好像比较少用到的一种编码,我不太熟悉。

<property>
<name>parser.html.impl</name>
<value>neko</value>
<description>HTML Parser implementation. Currently the following keywords
are recognized: "neko" uses NekoHTML, "tagsoup" uses TagSoup.
</description>
</property>

制定解析HTML文档的时候使用的解析器, NEKO功能比较强大,后面会有专门的文章介绍Neko 从HTML到 TEXT以及html片断的解析等功能做介绍。


<property>
<name>extension.clustering.hits-to-cluster</name>
<value>100</value>
<description>Number of snippets retrieved for the clustering extension
if clustering extension is available and user requested results
to be clustered.</description>
</property>

聚合功能,对搜索结果有聚合需求的应用可能会用到。

<property>
<name>extension.ontology.extension-name</name>
<value></value>
<description>Use the specified online ontology extension. If empty,
the first available extension will be used. The "name" here refers to an 'id'
attribute of the 'implementation' element in the plugin descriptor XML
file.</description>
</property>


人工智能,这个功能在我以后的开发过程中会逐步深入,等我有相关的经验以后在给大家介绍。◎_◎

<property>
<name>query.url.boost</name>
<value>4.0</value>
<description> Used as a boost for url field in Lucene query.
</description>
</property>

<property>
<name>query.anchor.boost</name>
<value>2.0</value>
<description> Used as a boost for anchor field in Lucene query.
</description>
</property>


<property>
<name>query.title.boost</name>
<value>1.5</value>
<description> Used as a boost for title field in Lucene query.
</description>
</property>

<property>
<name>query.host.boost</name>
<value>2.0</value>
<description> Used as a boost for host field in Lucene query.
</description>
</property>

<property>
<name>query.phrase.boost</name>
<value>1.0</value>
<description> Used as a boost for phrase in Lucene query.
Multiplied by boost for field phrase is matched in.
</description>
</property>

以上的几个关于搜索结果排序的分值计算因子在以后的搜索结果排序会专门做介绍,这几个项对垂直搜索的用处不太大。

<property>
<name>lang.analyze.max.length</name>
<value>2048</value>
<description> The maximum bytes of data to uses to indentify
the language (0 means full content analysis).
The larger is this value, the better is the analysis, but the
slowest it is.
</description>
</property>

和语言有关系,分词的时候会用到,不过我没用过这个配置项。

还有几个重要的配置项在 nutch-site.xml里面配置。

<property>
<name>searcher.dir</name>
<value>C:\</value>
</property>
可以有两种方式 ,如果指向的目录下面有 search-servers.txt 文件 ,那么优先处理 search-servers.txt文件中的内容 ,并解析其中复合
hostname port
格式的内容(即分布式查询请求),解析到后就想该服务器发送查询请求,如果没有则查找 segements 目录 ,segments 是本地索引文件。
如果两个都没有找到,她就要报错了。
search-servers.txt
内容很简单 例如:
127.0.0.1 9999
不过需要注意的是 ,这个 9999的端口 启动的 是查询服务器 ,是用 bin/nutch server 9999 的命令启动的,
和 namenode 启动比较相似 ,我当初接触的时候就以为是 namenode 的地址,郁闷的很久。
namenode 和 searchserver 结合不太好 , 没有提供直接从 namenode 到searchserver 的 文件访问接口,需要自己开发,如果大
家知道有可以直接从 namenode 到searchserver 的方法或者现成的程序,请告诉我一下,我需要,要是实在找不到,那就没办法了,自己写。
我现在从namenode 到 searchserver的方法比较原始,不值得推荐,所以就不作介绍了。

分享到:
评论

相关推荐

    搜索引擎nutch配置

    在开始Nutch配置之前,确保你已安装了Java运行环境(JRE)和Java开发工具(JDK),版本至少为1.8。同时,你需要一个支持Hadoop的环境,如Hadoop单机模式或伪分布式模式。如果你打算使用Solr或Elasticsearch作为检索...

    nutch配置与安装

    ### Nutch配置与安装知识点详解 #### 一、Nutch简介 Nutch是一款开源的Web爬虫项目,基于Apache Hadoop构建,能够抓取、处理和索引互联网上的信息。Nutch提供了高度可定制化的配置选项,使得用户可以根据自己的需求...

    nutch配置nutch-default.xml

    nutch配置nutch-default.xml

    windows下的nutch配置总结

    - 提供的`.chm`和`.doc`文件很可能是Nutch配置的详细指南或教程,这些文档可以帮助理解配置过程中的细节,解决遇到的问题。 10. **扩展和优化**: - Nutch允许自定义插件来扩展其功能,例如解析特定格式的文件,...

    Nutch 配置

    Nutch 配置涉及的是一个开源的网络爬虫项目,它与Hadoop相结合,用于大规模的网页抓取和索引。Nutch 1.6是该项目的一个版本,这个版本的配置过程主要涵盖以下几个步骤: 1. **下载Nutch源代码**:首先,你需要从...

    Nutch配置[汇编].pdf

    ### Nutch配置详解 #### 一、Nutch简介与配置准备 **Nutch**是一款开源的Web爬虫项目,能够帮助用户抓取互联网上的网页数据并进行内容分析。本篇文章将详细解读《Nutch配置[汇编].pdf》文档中的关键步骤及知识点。...

    eclipse配置nutch,eclipse配置nutch

    通过右键点击项目名,选择“Properties &gt; Java Build Path &gt; Source”,然后点击“Add Folder”按钮,将“conf”文件夹添加进来,这是Nutch配置文件所在的位置,对于项目的运行至关重要。 #### 步骤3:处理依赖库 ...

    Nutch配置环境\Nutch1[1].4_windows下eclipse配置图文详解.docx

    本文将详细介绍如何在Windows环境下配置Nutch 1.4,并使用Eclipse进行开发。以下是你需要知道的关键步骤: 1. **安装JDK**: 在配置Nutch之前,首先确保已安装Java Development Kit (JDK)。这里推荐使用JDK 1.6。...

    Nutch安装配置

    总结来说,Nutch安装配置涉及Java环境、源码编译、Cygwin模拟环境(针对Windows用户)、Hadoop集成、Nutch配置、种子URL设置、执行生命周期管理和日志监控等多个环节。理解并熟练掌握这些步骤,将有助于顺利地搭建和...

    Nutch程序运行环境配置

    - mysql-connector-java-5.1.6-bin.jar是用于连接MySQL数据库的驱动包,如果你的Nutch配置中涉及到存储数据到MySQL,这个jar文件是必不可少的。 3. **运行时错误处理**: - 在Windows上运行Nutch可能会遇到一些...

    nutch使用&Nutch;入门教程

    三、Nutch配置与设置 在使用Nutch之前,你需要配置Nutch的运行环境,包括安装Java、设置Hadoop(如果需要分布式爬取)、下载和编译Nutch源代码。还需要配置Nutch的`conf/nutch-site.xml`文件,指定抓取策略、存储...

    Linux下Nutch分布式配置和使用.rar

    6.1配置Nutch配置文件 ............................................ 9 6.2 执行Nutch分布式爬虫 ........................................ 10 7 Nutch检索 .....................................................

    windows7环境下配置nutch

    在抓取过程中,可能会遇到一些问题,例如环境变量配置不正确或Nutch配置文件的错误。务必检查错误日志(如`crawl.log`)以定位问题所在。 最后,JDK是运行Nutch所必需的。从Oracle官网下载JDK安装程序(如...

    Nutch入门教程 高清 带书签

    三、Nutch配置与设置 学习Nutch,需要熟悉其配置文件,如`conf/nutch-site.xml`,其中包含了各种参数设置,如抓取间隔、抓取策略、存储路径等。同时,还需要配置`conf/regex-urlfilter.txt`和`conf/fetcher....

    windows下nutch的安装.pdf

    5. Nutch配置文件:如nutch-site.xml、nutch-default.xml等。 安装过程中,首先需要在Windows系统上安装Cygwin,安装完成后,需指定JDK的安装路径,这通常是在环境变量中设置NUTCH_JAVA_HOME。在Cygwin的终端中,...

    nutch的安装方法,好用

    6. **修改Nutch配置文件**: - 打开 `nutch\conf\nutch-site.xml` 文件,在 `&lt;configuration&gt;` 标签内添加以下内容来配置目标站点: ```xml &lt;name&gt;http.robots.agents&lt;/name&gt; &lt;value&gt;...

    nutch爬虫资料

    参考书中可能涉及的主题有Nutch配置、爬虫优化、抓取策略、数据存储和检索机制。例如,可能会讲解如何定制Nutch的配置文件以适应特定的抓取需求,如何避免重复抓取和IP封锁问题,以及如何调整抓取速度和深度。此外,...

    分布式搜索引擎nutch开发

    3. **Nutch配置** 在使用Nutch之前,需要进行一些基本配置,如设置爬虫范围(robots.txt遵循规则)、抓取间隔、抓取深度等。这些配置信息通常位于`conf/nutch-site.xml`文件中。此外,还可以通过修改`conf/regex-...

Global site tag (gtag.js) - Google Analytics