使用新api的java分布式缓存使用

56lgkhnf  于 2021-06-02  发布在  Hadoop
关注(0)|答案(0)|浏览(280)

我正在尝试使用hadoop中的新api运行hadoop程序。有谁能指导我如何使用新的api使用安装方法吗。
Map类

protected void setup(Context context)
          throws IOException, InterruptedException {
      Configuration conf = context.getConfiguration();
      URI[] cacheFiles = context.getCacheFiles();
      BufferedReader br = new BufferedReader(new FileReader(cacheFiles[0].toString()));
  }

public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException
 {

    ....?   // How should I access the above cached file here?
String line=br.readLine();
}

驾驶员等级

Job job = Job.getInstance(getConf());
job.setJobName("wordcount");
job.setJarByClass(driver.class);

Configuration conf = new Configuration();         

job.addCacheFile(new Path("hdfs://master:54310/usr/local/hadoop/input/normal_small").toUri());

这是我搜索后得到的结果,但我不确定如何访问mapper类的map方法中的缓存文件。请提及同样的问题。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题