zoukankan      html  css  js  c++  java
  • nutch搏斗之一

    nutch搏斗之一

    问题描述: 
    在用nutch1.0做generate 包括5亿url的crawldb时,它默认按照64M分块,分成777个map task,在运行的后期出现 
    Could not find taskTracker/jobcache/job_200903231519_0017/attempt_200903231519_0017_r_000051_0/output/file.out in any of the configured local directories 
    异常。 
    解决办法: 
    减小task数目,改成按照crawldb里面文件个数划分的策略: 
    Java代码 
    1. public static class InputFormat extends SequenceFileInputFormat<WritableComparable, Writable> {  
    2.    /** Don't split inputs, to keep things polite. */  
    3.    public InputSplit[] getSplits(JobConf job, int nSplits)  
    4.      throws IOException {  
    5.      FileStatus[] files = listStatus(job);  
    6.      FileSystem fs = FileSystem.get(job);  
    7.      InputSplit[] splits = new InputSplit[files.length];  
    8.      for (int i = 0; i < files.length; i++) {  
    9.        FileStatus cur = files[i];  
    10.        splits[i] = new FileSplit(cur.getPath(), 0,  
    11.            cur.getLen(), (String[])null);  
    12.      }  
    13.      return splits;  
    14.    }  
    15.  }  


    这次出现了新问题,有数个task因为十分钟无反应而导致整个任务failed 
    解决办法: 
    修改hadoop-site.xml 
    Java代码 
    1. <property>  
    2.   <name>mapred.task.timeout</name>  
    3.   <value>3600000</value>  
    4.   <description>The number of milliseconds before a task will be  
    5.   terminated if it neither reads an input, writes an output, nor  
    6.   updates its status string.  
    7.   </description>  
    8. </property>  


    总结: 
    大与小,多与少,长与短,在不同的情况下是不断变化的,对于大数据量而言,更要跟具实际情况灵活变化,所谓运用之刀,存乎一心是也!
  • 相关阅读:
    [Swift系列]002-基础语法
    [Swift系列]001-入门准备
    navicat连接服务器Mysql 忘记密码 ------- 查看密码
    Elasticsearch 7.10.1 尝鲜笔记
    java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy 排查解决
    nginx TCP 代理& windows傻瓜式安装
    python项目出现的问题 Microsoft Visual C++ 14.0 is required解决方法
    前端使用crypto.js进行加密
    xcopy 高级使用
    高并发解决方案-概念知识
  • 原文地址:https://www.cnblogs.com/timssd/p/5070454.html
Copyright © 2011-2022 走看看