HDFS角色NameNode之Fsimage文件分析

网友投稿 283 2022-11-17

HDFS角色NameNode之Fsimage文件分析

1 查看oiv和oev命令

[root@node1 ~]# hdfs|grep o.voev apply the offline edits viewer to an edits fileoiv apply the offline fsimage viewer to an fsimage

2 查看oiv命令

[root@node1 ~]# hdfs oiv --helpUsage: bin/hdfs oiv [OPTIONS] -i INPUTFILE -o OUTPUTFILEOffline Image ViewerView a Hadoop fsimage INPUTFILE using the specified PROCESSOR,saving the results in OUTPUTFILE.-i,--inputFile FSImage or XML file to process.Optional command line arguments:-o,--outputFile Name of output file. If the specified file exists, it will be overwritten. (output to stdout by default) If the input file was an XML file, we will also create an .md5 file.-p,--processor Select which type of processor to apply against image file. (XML|FileDistribution| ReverseXML|Web|Delimited) The default is Web.

3 基本语法

hdfs oiv -p 文件类型 -i 镜像文件 -o 转换后文件输出的全路径名

4 案例实操

[root@node1 current]# pwd/var/itbaizhan/hadoop/full/dfs/name/current[root@node1 current]# ll|grep fsimage-rw-r--r-- 1 root root 722 10月 9 13:49 fsimage_0000000000000000047-rw-r--r-- 1 root root 62 10月 9 13:49 fsimage_0000000000000000047.md5-rw-r--r-- 1 root root 722 10月 9 14:49 fsimage_0000000000000000049-rw-r--r-- 1 root root 62 10月 9 14:49 fsimage_0000000000000000049.md5[root@node1 current]# hdfs oiv -p XML -i fsimage_0000000000000000049 -o /opt/hadoop-3.1.3/fsimage49.xml2021-10-09 15:20:24,428 INFO offlineImageViewer.FSImageHandler: Loading 3 strings[root@node1 current]# vim /opt/hadoop-3.1.3/fsimage49.xml#格式化该xml文件:Ctrl+v-> !xmllint -format - -> 删除生成的 ->保存并退出[root@node1 current]# cat /opt/hadoop-3.1.3/fsimage49.xml

部分显示结果如下:

16392 5 16385 DIRECTORY 1633749749273 root:supergroup:0755 9223372036854775807 -1 16386 DIRECTORY user 1633748876034 root:supergroup:0755 -1 -1 16387 DIRECTORY root 1633749176246 root:supergroup:0755 -1 -1 16388 FILE hadoop-3.1.3.tar.gz 2 1633749066652 1633749010986 134217728 root:supergroup:0644 1073741825 1001 134217728 1073741826 1002 134217728 1073741827 1003 69640404 0 16389 FILE test.txt 2 1633749176236 1633749175593 134217728 root:supergroup:0644 1073741828 1004 38 0 ......

思考:观察发现Fsimage中没有记录块所对应DataNode,为什么?

在集群启动后,要求DataNode上报数据块信息,并间隔一段时间后再次上报。

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:HDFS角色NameNode之Edits log文件分析
下一篇:想扩展多功能轻薄本你可以试试创基USB HUB分线器
相关文章

 发表评论

暂时没有评论,来抢沙发吧~