hadoop 回收站 配置
在需要开启回收站功能的hadoop客户端编辑hdfs-site.xml文件,内容如下:
$ cat hdfs-site.xml
<?xml version="1.0"?>
<?xml-stylesheettype="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific propertyoverrides in this file. -->
<configuration>
<property>
<name>fs.trash.interval</name>
<value>1440</value>
<description>Number ofminutes between trash checkpoints.
If zero, the trashfeature is disabled.
</description>
</property>
</configuration>
说明:
1, fs.trash.interval参数设置保留时间为1440秒(1天)
2, 回收站的位置:
在HDFS上的 /user/$USER/.Trash/Current/
疑问:有没有统一开启集群所有机器回收站的方法呢?
验证:
copy 本地文件hdfs-site.xml 到hdfs上
$ hadoop fs -put hdfs-site.xml /
删除,这里会有提示" Moved to trash "
$ hadoop fs -rmr /hdfs-site.xml
Moved to trash: hdfs://hadoop-vip:9000/hdfs-site.xml
看看回收站里面有没有...果然有!
$ hadoop fs -ls/user/admin/.Trash/Current/
Found 2 items
-rw-r--r-- 3 admin supergroup 3852012-07-04 11:04 /user/admin/.Trash/Current/hdfs-site.xml
-rw-r--r-- 3 admin supergroup 3852012-07-04 11:08 /user/admin/.Trash/Current/hdfs-site.xml.1