符号链接:
Path inPathRelLocal = new Path(hdfsFile);
// # 号之后的名称是对上面文件的链接,不同文件的链接名不能相同,虽然由你自己随便取
String inPathLinkRelLocal=inPathRelLocal.toUri().toString()+"#"+linkName;
DistributedCache.addCacheFile(new URI(inPathLinkRelLocal), conf);
你在main函数中使用这个函数之后,你可以直接调用linkName,相当于调用项目中的本地文件。
注意:
conf 文件是:getCacheFile(job.getConfiguration(),hdfsFile,linkName);
不是 Configuration conf = new Configuration(); 而是你在Job job = new Job(conf,"###");之后的