Hadoop recycle bin trash

Source: Internet
Author: User
Tags hadoop fs

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.