Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Analysis and recovery of mistaken deletion of hdfs data

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

1. Relevant parameters:

1. The core-site.xml file modifies the following configuration items:

Fs.trash.interval 2880 HDFS trash bin setting, which can restore erroneous deletion. The configured value is minutes, and 0 is disabled.

2. Note the following configuration items in the hdfs-default.xml file:

Dfs.ha.log-roll.period 120 EditLog log scrolling frequency (in seconds). Default is two minutes.

Second, the analysis process

1. Find the directory where the editlog log is located

Check the hdfs-site.xml file to find the value of the fs.namenode.name.dir configuration item, such as file:/home/hadoop-2.6.0-cdh6.5.0/dfs/name

In the current file in the / home/hadoop-2.6.0-cdh6.5.0/dfs/name directory, it is the editlog file, as shown below

2. Use the command to view edits_inprogress files

# hdfs oev-I edits_inprogress_0000000000000000023-o edits_inprogress_0000000000000000023.xml

Where-I is the input file name and-o is the need to output the parsed file to the file

After the parsing is complete, just view the edits_inprogress_0000000000000000023.xml file.

3. Open file analysis

Locate the deleted file or folder and search for related items in the edits_inprogress_0000000000000000023.xml file, as follows:

OP_RENAME_OLD 150 / dat / user/root/.Trash/Current/dat 1454315297010 6832d4f9-4fa6-4dbb-89aa-ffaa26109078 6

As you can see, the / dat file in HDFS was moved to the Recycle Bin at 1454315297 time.

4. Restore files

Execute the following command:

# fs-mv / user/root/.Trash/Current/dat / dat

Perform a recovery

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report