删除hdfs文件系统中的数据文件,要提供的是文件名称,具体代码如下:
/** 从HDFS上删除文件 */
public static void deleteFromHdfs(String deleteFile) throws FileNotFoundException,IOException {
String dst = "hdfs://192.168.248.129:9000/"+deleteFile;
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(URI.create(dst), conf);
fs.deleteOnExit(new Path(dst));
fs.close();
}