Explanation of the new feature of Hadoop 2.X, the recycle bin function

Explanation of the new feature of Hadoop 2.X, the recycle bin function

By turning on the Recycle Bin function, you can restore the original data of deleted files without timing out, thus preventing accidental deletion and providing backup.

1. Recycle Bin parameter settings and working mechanism

2. Enable Recycle Bin

Modify core-site.xml and set the garbage collection time to 1 minute.

<property>
  <name>fs.trash.interval</name>
<value>1</value>
</property>

3. View Recycle Bin

The path of the recycle bin in the cluster: /user/username/.Trash/….

4. Modify the user name for accessing the Recycle Bin

The user name for entering the trash bin is dr.who by default, change it to the user name

[core-site.xml]

<property>
 <name>hadoop.http.staticuser.user</name>
 <value>Username</value>
</property>

5. Files deleted by the program will not go through the Recycle Bin. You need to call moveToTrash() to enter the Recycle Bin.

Trash trash = New Trash(conf);
trash.moveToTrash(path);

6. Restore Recycle Bin Data

hadoop fs -mv
/user/atguigu/.Trash/Current/user/atguigu/input /user/atguigu/input

7. Empty the Recycle Bin

hadoop fs -expunge

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links

You may also be interested in:
  • Hadoop NameNode Federation
  • Application of Hadoop counters and data cleaning
  • A practical tutorial on building a fully distributed Hadoop environment under Ubuntu 16.4
  • Hadoop 2.x vs 3.x 22-point comparison, Hadoop 3.x improvements over 2.x
  • How to build a Hadoop cluster environment with ubuntu docker
  • Detailed steps to build Hadoop in CentOS
  • Hadoop wordcount example code
  • Java/Web calls Hadoop for MapReduce sample code
  • Explanation of the working mechanism of namenode and secondarynamenode in Hadoop

<<:  The perfect solution for MySql version problem sql_mode=only_full_group_by

>>:  Detailed explanation of how to use binlog2sql to quickly roll back after MySQL misoperation

Recommend

Implementation of importing and exporting vue-element-admin projects

vue-element-admin import component encapsulation ...

Example of adding music video to HTML page

1. Video tag Supports automatic playback in Firef...

Detailed explanation of common for loop in JavaScript statements

There are many loop statements in JavaScript, inc...

MySQL randomly extracts a certain number of records

In the past, I used to directly order by rand() t...

How to import and export Cookies and Favorites in FireFox

FireFox is a commonly used browser with many exte...

Disable IE Image Toolbar

I just tried it on IE6, and it does show the toolb...

JS implements a detailed plan for the smooth version of the progress bar

The progress bar is not smooth I believe that mos...

MySQL8.0.18 configuration of multiple masters and one slave

Table of contents 1. Realistic Background 2. Agre...

WeChat Mini Program to Implement Electronic Signature

This article shares the specific code for impleme...

Detailed explanation of data type issues in JS array index detection

When I was writing a WeChat applet project, there...

Example of using supervisor to manage nginx+tomcat containers

need: Use docker to start nginx + tomcat dual pro...

HTML implements the function of detecting input completion

Use "onInput(event)" to detect whether ...