Trash of the hadoop recycle bin is disabled by default.
If you are used to window, it is recommended that you open it in advance. Otherwise, you may need to cry in case of misoperations.
1. Modify CONF/core-site.xml, add
< Property > < Name > FS. Trash. Interval </ Name > < Value > 1440 </ Value > < Description > Number of minutes between trash checkpoints. If zero, the trash feature is disabled. </ Description > </ Property >
The default value is 0. The unit is minute. Here I set 1 day (60*24)
After the data RM is deleted, the data is moved to the. Trash directory in the current folder.
2. Test
1) create a directory Input
Hadoop/bin/hadoop FS-MkdirInput
2) upload files
Root @ master:/data/soft # hadoop/bin/hadoop FS-copyfromlocal/data/soft/file0 * Input
3) Delete the directory Input
[Root @ master data] #Hadoop FS-RMR input moved to trash: HDFS:// Master: 9000/user/root/Input
4) See the current directory.
[Root @ master data] #Hadoop FS-ls found2Items drwxr-XR-X-root supergroup0/user/root/. Trash
The input is deleted, and a directory is added. Trash
5) restore the deleted directory
[Root @ master data] # hadoop FS-mV/user/root/. Trash/current/user/root/input/user/root/Input
6) Check the recovered data
[Root @ master data] #Hadoop FS-ls input found2Items-RW-r --3 root supergroup 22/user/root/input/File01-RW-r --3 root supergroup 28/user/root/input/file02
6) Delete the. Trash directory (clear garbage)
[Root @ master data] # hadoop FS-RMR.Trash deleted HDFS:// Master: 9000/user/root/. Trash
From http://running.iteye.com/blog/904536