使用Trash放入垃圾桶的配置问题
来源:12-3 回收站

海特圣山彼岸花
2020-10-24
老师您好,我尝试使用HDFS API删除文件,最后找到方法,需要使用:
Trash trash = new Trash(fs, fs.getConf());
boolean trashResult = trash.moveToTrash(serverPath);
才能将删除的文件move到.Trash目录下。
我的问题是,在实际的生产环境,是如何统一 HDFS 和 java中写的configuration 的配置的?
总不能每次修改了core-site.xml后还要通知后端程序改吧?
为什么会提这个问题,因为我发现需要在服务器的core-site.xml配置
<property>
<name>fs.trash.interval</name>
<value>60</value>
</property>
<property>
<name>fs.trash.checkpoint.interval</name>
<value>60</value>
</property>
以及java代码处同时配置
configuration.set("dfs.replication", "3");
configuration.set("fs.trash.interval", "60");
configuration.set("fs.trash.checkpoint.interval", "60");
然后运行junit,才能将欲删除的文件放入回收站。
写回答
1回答
-
Michael_PK
2020-10-24
一般生产上回收站的东西直接一个定时脚本去删就可以的。
代码层面万一误操作就麻烦了
022020-10-24
相似问题