How to overwrite/reuse the existing output path for Hadoop jobs again and agian

后端 未结 10 900
既然无缘
既然无缘 2021-02-12 10:29

I want to overwrite/reuse the existing output directory when I run my Hadoop job daily. Actually the output directory will store summarized output of each day\'s job run results

10条回答
  •  一个人的身影
    2021-02-12 11:11

    What about deleting the directory before you run the job?

    You can do this via shell:

    hadoop fs -rmr /path/to/your/output/
    

    or via the Java API:

    // configuration should contain reference to your namenode
    FileSystem fs = FileSystem.get(new Configuration());
    // true stands for recursively deleting the folder you gave
    fs.delete(new Path("/path/to/your/output"), true);
    

提交回复
热议问题