Restore deleted files in hadoop HDFS

Source: Internet
Author: User

The file recovery principle deleted in HDFS of hadoop is the same as that of the recycle bin, that is, when the HDFS file is deleted, the deleted file exists in HDFS. in the trash folder, you only need to extract the files in the folder to restore. The procedure is as follows:

1. Set trash

If you need to restore files in HDFS, you need to set trash. hadoop's trash is disabled by default. The specific settings are as follows:

<Property>
<Name> fs. Trash. interval </Name>
<Value> 10080 </value>
</Property>

In the core-site.xml, FS. Trash. interval represents the time when the deleted file was retained, in minutes, and 0 by default indicates that the deleted file is not saved. You only need to set this time to enable trash.

2. After setting this parameter, the deleted file will be moved to HDFS: // 192.168.1.100: 9000/user/hadoop/. Trash/current. For example:

14/10/20 16:48:24 info fs. trashpolicydefault: namenode trash configuration: Deletion interval = 10080 minutes, emptier interval = 0 minutes.
Moved: 'hdfs: // 10.207.0.217: 9000/data/test_out/mr-20141017111556 'to trash at: HDFS: // 192.168.1.100: 9000/user/hadoop/. Trash/Current

3. During recovery, you only need to move the files in. trash to the directory we set. For example, move the test1 file in. trash to the/test directory,

Bin/hadoop FS-du-H/user/hadoop/. Trash/current/test1/test

4. Permanently delete an object

This is to completely delete the file in. Trash .. Trash is actually a directory in HDFS. If you delete a file in this folder, the deleted file is permanently deleted. The principle is that the file in the recycle bin is deleted. This option is rarely used unless the HDFS space is insufficient.



Restore deleted files in hadoop HDFS

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.