`

nutch-1.2结合hadoop分布式搜索

 
阅读更多

nutch-1.2结合hadoop分布式搜索。
1、网上关于nutch分布式搜索的配置有些BLOG写的很详细了。有那些地方有疑问的,我这里也给一个连接<<nutch分布式搜索配置>>
2、在这里主要想写下工作过程当中遇到的一些问题:
------0-------
------1-------
------2-------
------3-------
java.io.IOException: Filesystem closed
    at org.apache.hadoop.hdfs.DFSClient.checkOpen(DFSClient.java:226)
    at org.apache.hadoop.hdfs.DFSClient.access$600(DFSClient.java:67)
    at org.apache.hadoop.hdfs.DFSClient$DFSInputStream.read(DFSClient.java:1756)
    at java.io.DataInputStream.read(Unknown Source)
    at org.apache.nutch.indexer.FsDirectory$DfsIndexInput.readInternal(FsDirectory.java:178)
    at org.apache.lucene.store.BufferedIndexInput.refill(BufferedIndexInput.java:160)
    at org.apache.lucene.store.BufferedIndexInput.readByte(BufferedIndexInput.java:39)
    at org.apache.lucene.store.IndexInput.readVInt(IndexInput.java:81)
    at org.apache.lucene.index.FieldsReader.doc(FieldsReader.java:222)
    at org.apache.lucene.index.SegmentReader.document(SegmentReader.java:879)
    at org.apache.lucene.index.DirectoryReader.document(DirectoryReader.java:574)
    at org.apache.lucene.index.IndexReader.document(IndexReader.java:658)
    at org.apache.lucene.search.IndexSearcher.doc(IndexSearcher.java:163)
    at org.apache.nutch.searcher.IndexSearcher.getDetails(IndexSearcher.java:110)
    at org.apache.nutch.searcher.LuceneSearchBean.getDetails(LuceneSearchBean.java:107)
    at org.apache.nutch.searcher.NutchBean.getDetails(NutchBean.java:359)
    at com.yichen.node.ThreadPoolTaskSearch.query(ThreadPoolTaskSearch.java:89)
    at com.yichen.node.ThreadPoolTaskSearch.query(ThreadPoolTaskSearch.java:59)
    at com.yichen.node.ThreadPoolTaskSearch.search(ThreadPoolTaskSearch.java:38)
    at com.yichen.node.ThreadPoolTaskSearch.run(ThreadPoolTaskSearch.java:130)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
nutchBean closed。。。。
nutchBean closed。。。。
{indexNo=0, uniqueKey=35, su=null, post=IT工程师, company=卡斯柯信号有限公司北京分公司, salary=(0-0), type=job, updatetime=20110621}
no found result。。。。
{indexNo=0, uniqueKey=19, su=null, post=【知名合资IT企业】高级营销经理(安全)–CEN810, company=大连博科人才有限公司, salary=(0-0), type=job, updatetime=20110621}
{indexNo=0, uniqueKey=18, su=null, post=【知名合资IT企业】高级拓展经理(安全)–CEN811, company=大连博科人才有限公司, salary=(0-0), type=job, updatetime=20110621}
{indexNo=0, uniqueKey=20, su=null, post=【知名合资IT企业】高级规划经理(安全)–CEN809, company=大连博科人才有限公司, salary=(0-0), type=job, updatetime=20110621}
{indexNo=0, uniqueKey=21, su=null, post=理财产品销售专员(综合金融), company=平安金融服务公司, salary=(4000-50000), type=job, updatetime=20110621}
{indexNo=0, uniqueKey=25, su=null, post=理财金融营销专员, company=平安金融服务公司, salary=(4000-50000), type=job, updatetime=20110620}
{indexNo=0, uniqueKey=28, su=null, post=金融产品理财专员, company=平安金融服务公司, salary=(5000-20000), type=job, updatetime=20110620}
{indexNo=0, uniqueKey=22, su=null, post=理财客户金融经理, company=平安金融服务公司, salary=(6001-8000), type=job, updatetime=20110620}
{indexNo=0, uniqueKey=24, su=null, post=理财金融专员, company=平安金融服务公司, salary=(3000-20000), type=job, updatetime=20110621}
{indexNo=0, uniqueKey=31, su=null, post=金融理财经理(综合金融), company=平安金融服务公司, salary=(8001-10000), type=job, updatetime=20110620}

分析原因:单个线程在分布式中搜索没有出现问题,以上出现错误原因是多线程搜索时出现的。由于每次打开的连接次数太多,导致连接没有关闭。出现上面的错误。
解决办法:
1、在servlet初始化中,加入:
    public void init(ServletConfig config) throws ServletException {
        try {
            this.conf = NutchConfiguration.get(config.getServletContext());
            bean = NutchBean.get(config.getServletContext(), this.conf);
        } catch (IOException e) {
            throw new ServletException(e);
        }
        MAX_HITS_PER_PAGE = conf.getInt("searcher.max.hits.per.page", -1);
    }
2、修改web.xml,加入:
<listener>
  <listener-class>org.apache.nutch.searcher.NutchBean$NutchBeanConstructor</listener-class>
</listener>

<servlet>
  <servlet-name>Cached</servlet-name>
  <servlet-class>org.apache.nutch.servlet.Cached</servlet-class>
</servlet>
3、在自己的servlet中把NutchBean的实例和NutchConfiguration的实例传递过去。保证初始化时只打开一次index。

分享到:
评论

相关推荐

    nutch-1.2.part06

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

    nutch-1.2.war

    nutch官方简单案例,请版本是nutch-1.2.war

    nutch-1.2.part02

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

    nucth-1.2.part01 (该资源有10个包,共144M 完整nutch包 目录如下)

    Nutch是一个由Java实现的,...-rwx------+ 1 nutch-1.2.jar -rwx------+ 1 nutch-1.2.job -rwx------+ 1 nutch-1.2.war drwx------+ 61 plugins drwx------+ 10 src -rwx------+ 1 url.txt drwx------+ 8 webapps

    nutch-1.2.part07

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

    nutch-1.2.part05

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

    nutch-1.2.part10

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

    nutch-1.2.part03

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

    nutch-1.2.part08

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

    nutch-1.2.part09

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

    nutch-1.2.part04

    Nutch 是一个开源Java 实现的搜索引擎.它提供了我们运行自己的搜索引擎所需的全部工具.包括全文搜索和Web爬虫. 尽管Web搜索是漫游Internet的基本要求, 但是现有web搜

    apache-nutch-1.4-bin.tar.gz

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

    apache-nutch-1.5.1-bin.tar.gz

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

    apache-nutch-2.3.1-src.tar.gz

    apache-nutch-2.3.1-src.tar.gz

    Nutch-1.0分布式安装手册.rar

    Nutch-1.0分布式安装手册.rar,完整的

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

    nutch不用安装,是个应用程序,下载后为nutch-1.6.tar.gz,双击桌面上的cygwin快捷方式;执行以下命令: $ cd D:/Downloads/Soft $ tar zxvf nutch-1.0.tar.gz 在e盘下面出现nutch-0.9文件夹说明解压成功了.然后环境...

    nutch配置nutch-default.xml

    nutch配置nutch-default.xml

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

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

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

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

Global site tag (gtag.js) - Google Analytics