MapReduce 缓存文件

/**
   * Called once at the beginning of the task.
   */
  protected void setup(Context context ) throws IOException,InterruptedException {
    BufferedReader bufferedReader = new BufferedReader(new FileReader("文件名"))
  }
// 指定需要缓存一个文件到所有的maptask运行节点工作目录
        /* job.addArchiveToClassPath(archive); */// 缓存jar包到task运行节点的classpath中
        /* job.addFileToClassPath(file); */// 缓存普通文件到task运行节点的classpath中
        /* job.addCacheArchive(uri); */// 缓存压缩包文件到task运行节点的工作目录
        /* job.addCacheFile(uri) */// 缓存普通文件到task运行节点的工作目录

        // 将产品表文件缓存到task工作节点的工作目录中去
        job.addCacheFile(new URI("file:/D:/srcdata/mapjoincache/pdts.txt"));

        //map端join的逻辑不需要reduce阶段,设置reducetask数量为0
        job.setNumReduceTasks(0);

你可能感兴趣的:(Hadoop)