Hadoop分块存储解析及还原分块存储的文件

问题

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

行动

我们来到下面这个hadoop安装的目录下

在这里插入图片描述

[root@hadoop102 subdir0]# pwd
/opt/module/hadoop-2.7.7/data/tmp/dfs/data/current/BP-1961147429-192.168.1.102-1570287343868/current/finalized/subdir0/subdir0
[root@hadoop102 subdir0]#

查看一下目录下的文件


[root@hadoop102 subdir0]# ll
总用量 215280
-rw-r--r--. 1 root root        69 10月  6 13:17 blk_1073741825
-rw-r--r--. 1 root root        11 10月  6 13:17 blk_1073741825_1001.meta
-rw-r--r--. 1 root root 134217728 10月  6 13:18 blk_1073741826
-rw-r--r--. 1 root root   1048583 10月  6 13:18 blk_1073741826_1002.meta
-rw-r--r--. 1 root root  84502793 10月  6 13:18 blk_1073741827
-rw-r--r--. 1 root root    660187 10月  6 13:18 blk_1073741827_1003.meta
[root@hadoop102 subdir0]# 

cat一下25这个文件,发现居然是我第一个上传的文件

[root@hadoop102 subdir0]# 
[root@hadoop102 subdir0]# cat blk_1073741825
zhangsan lisi wangwu zhaosi
hh
shendu
zhenghui
aiyou
shendu
zhenghui
[root@hadoop102 subdir0]# 

在这里插入图片描述

还原分块存储的文件

[root@hadoop102 subdir0]# 
[root@hadoop102 subdir0]# 
[root@hadoop102 subdir0]# 
[root@hadoop102 subdir0]# cat blk_1073741826 >> tmp.txt
[root@hadoop102 subdir0]# 
[root@hadoop102 subdir0]# 
[root@hadoop102 subdir0]# cat blk_1073741827 >> tmp.txt 
[root@hadoop102 subdir0]# 
[root@hadoop102 subdir0]# 
[root@hadoop102 subdir0]# ll
总用量 477296
-rw-r--r--. 1 root root        69 10月  6 13:17 blk_1073741825
-rw-r--r--. 1 root root        11 10月  6 13:17 blk_1073741825_1001.meta
-rw-r--r--. 1 root root 134217728 10月  6 13:18 blk_1073741826
-rw-r--r--. 1 root root   1048583 10月  6 13:18 blk_1073741826_1002.meta
-rw-r--r--. 1 root root  84502793 10月  6 13:18 blk_1073741827
-rw-r--r--. 1 root root    660187 10月  6 13:18 blk_1073741827_1003.meta
-rw-r--r--. 1 root root 218720521 10月  6 13:35 tmp.txt
[root@hadoop102 subdir0]# 

还原

[root@hadoop102 subdir0]# tar -zxvf tmp.txt 
[root@hadoop102 subdir0]# 
[root@hadoop102 subdir0]# 
[root@hadoop102 subdir0]# 
[root@hadoop102 subdir0]# ll
总用量 477296
-rw-r--r--. 1 root root        69 10月  6 13:17 blk_1073741825
-rw-r--r--. 1 root root        11 10月  6 13:17 blk_1073741825_1001.meta
-rw-r--r--. 1 root root 134217728 10月  6 13:18 blk_1073741826
-rw-r--r--. 1 root root   1048583 10月  6 13:18 blk_1073741826_1002.meta
-rw-r--r--. 1 root root  84502793 10月  6 13:18 blk_1073741827
-rw-r--r--. 1 root root    660187 10月  6 13:18 blk_1073741827_1003.meta
drwxr-xr-x. 9 1000 ftp        149 7月  19 2018 hadoop-2.7.7
-rw-r--r--. 1 root root 218720521 10月  6 13:35 tmp.txt
[root@hadoop102 subdir0]# 

hadoop-2.7.7就是咱们想要的文件,现在就还原过来了,发现这个和源文件一模一样。

发布了79 篇原创文章 · 获赞 70 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/qq_17623363/article/details/102225111
今日推荐