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>  


    总结: 
    大与小,多与少,长与短,在不同的情况下是不断变化的,对于大数据量而言,更要跟具实际情况灵活变化,所谓运用之刀,存乎一心是也!
  • 相关阅读:
    公布一些常用的WebServices
    ARM的嵌入式Linux应用程序开发研究
    c++读写剪贴板代码
    如何破解路由器密码(CISCO)!
    用Shell扩展实现源代码统计程序(转)
    图文例解C++类的多重继承与虚拟继承
    MSDN上关于ADO示例代码
    不错的句子
    codeforces #271(div2) F. Ant colony
    [Z]CUDA中Bank conflict冲突
  • 原文地址:https://www.cnblogs.com/timssd/p/5070454.html
Copyright © 2011-2022 走看看