标签:hdfs
在hdfs中,默认的文件删除保留的时间是0,也就是没有保留删除的文件,删除即丢失
那么如果你想启用hdfs的回收站机制,在删除文件后,希望多久之后,文件才消失,因为这个过程中万一你想来恢复文件呢
<property> <name>fs.trash.interval</name> <value>1440</value> </property>
[root@com22 bin]# sh hdfs dfs -ls -R /flume/events/2015/01/28/15/55 -rw-r--r-- 3 root supergroup 12207 2015-01-28 15:56 /flume/events/2015/01/28/15/55/cmcc.1422431701282 [root@com22 bin]# sh hdfs dfs -rm /flume/events/2015/01/28/15/55/cmcc.1422431701282 15/03/05 14:28:00 INFO fs.TrashPolicyDefault: Namenode trash configuration: Deletion interval = 1440 minutes, Emptier interval = 0 minutes. Moved: 'hdfs://com22.authentication:9000/flume/events/2015/01/28/15/55/cmcc.1422431701282' to trash at: hdfs://com22.authentication:9000/user/root/.Trash/Current [root@com22 bin]#
整个过程如下:
[root@com22 bin]# sh hdfs dfs -ls -R /flume/events/2015/01/28/15/55 [root@com22 bin]# sh hdfs dfs -ls -R /user/root/.Trash/Current drwx------ - root supergroup 0 2015-03-05 14:28 /user/root/.Trash/Current/flume drwx------ - root supergroup 0 2015-03-05 14:28 /user/root/.Trash/Current/flume/events drwx------ - root supergroup 0 2015-03-05 14:28 /user/root/.Trash/Current/flume/events/2015 drwx------ - root supergroup 0 2015-03-05 14:28 /user/root/.Trash/Current/flume/events/2015/01 drwx------ - root supergroup 0 2015-03-05 14:28 /user/root/.Trash/Current/flume/events/2015/01/28 drwx------ - root supergroup 0 2015-03-05 14:28 /user/root/.Trash/Current/flume/events/2015/01/28/15 drwx------ - root supergroup 0 2015-03-05 14:28 /user/root/.Trash/Current/flume/events/2015/01/28/15/55 -rw-r--r-- 3 root supergroup 12207 2015-01-28 15:56 /user/root/.Trash/Current/flume/events/2015/01/28/15/55/cmcc.1422431701282 [root@com22 bin]# sh hdfs dfs -mv /user/root/.Trash/Current/flume/events/2015/01/28/15/55/cmcc.1422431701282 /flume/events/2015/01/28/15/55 [root@com22 bin]# sh hdfs dfs -ls -R /user/root/.Trash/Current drwx------ - root supergroup 0 2015-03-05 14:28 /user/root/.Trash/Current/flume drwx------ - root supergroup 0 2015-03-05 14:28 /user/root/.Trash/Current/flume/events drwx------ - root supergroup 0 2015-03-05 14:28 /user/root/.Trash/Current/flume/events/2015 drwx------ - root supergroup 0 2015-03-05 14:28 /user/root/.Trash/Current/flume/events/2015/01 drwx------ - root supergroup 0 2015-03-05 14:28 /user/root/.Trash/Current/flume/events/2015/01/28 drwx------ - root supergroup 0 2015-03-05 14:28 /user/root/.Trash/Current/flume/events/2015/01/28/15 drwx------ - root supergroup 0 2015-03-05 14:31 /user/root/.Trash/Current/flume/events/2015/01/28/15/55 [root@com22 bin]# sh hdfs dfs -ls -R /flume/events/2015/01/28/15/55 -rw-r--r-- 3 root supergroup 12207 2015-01-28 15:56 /flume/events/2015/01/28/15/55/cmcc.1422431701282 [root@com22 bin]#
【hadoop 2.6】hdfs如何打开回收站机制trash,恢复删除的文件
标签:hdfs
原文地址:http://blog.csdn.net/simonchi/article/details/44081977