yyyyyyyyyyyyyyyyyyyy

博客园 首页 新随笔 联系 订阅 管理

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>  


总结: 
大与小,多与少,长与短,在不同的情况下是不断变化的,对于大数据量而言,更要跟具实际情况灵活变化,所谓运用之刀,存乎一心是也!
posted on 2015-12-23 16:49  xxxxxxxx1x2xxxxxxx  阅读(125)  评论(0编辑  收藏  举报