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

Summary of tips for making web pages

Preface This article mainly summarizes some of th...

The image element img has extra blank space in IE6

When doing DIV+CSS layout of the page, it is very...

Vue implements book management case

This article example shares the specific code of ...

Docker starts MySQL configuration implementation process

Table of contents Actual combat process Let's...

MySQL slow query and query reconstruction method record

Preface What is a slow query and how to optimize ...

Getting started with JavaScript basics

Table of contents 1. Where to write JavaScript 2....

Detailed usage of Vue timer

This article example shares the specific code of ...

What is the function and writing order of the a tag pseudo class

The role of the a tag pseudo-class: ":link&qu...

A brief discussion on when MySQL uses internal temporary tables

union execution For ease of analysis, use the fol...

How to restore data using binlog in mysql5.7

Step 1: Ensure that MySQL has binlog enabled show...

Website User Experience Design (UE)

I just saw a post titled "Flow Theory and Des...

Detailed example of using js fetch asynchronous request

Table of contents Understanding Asynchrony fetch(...