视频:【美妙人生】Hadoop课程系列之HDFS--手把手教你精通HDFS
【美妙人生】Hadoop课程系列之HDFS--手把手教你精通HDFS
【视频笔记】
元数据
-------------------------
1.查看fsimage文件
$>hdfs oiv -i fsimage_0000000000000000022 -o ~/fs22.xml -p XML
【
<?xml version="1.0"?>
<fsimage>
<NameSection>
<genstampV1>1000</genstampV1>
<genstampV2>1002</genstampV2>
<genstampV1Limit>0</genstampV1Limit>
<!-- 描述当前镜像的最后一个块ID -->
<lastAllocatedBlockId>1073741826</lastAllocatedBlockId>
<!-- 事务ID-对应的是fsimage_0000000000000000022 -->
<txid>22</txid>
</NameSection>
<INodeSection>
<lastInodeId>16390</lastInodeId>
<!-- inode节点描述HDFS文件系统所有信息
我们保留文件/块层次结构的内存中表示。这是一个基本的INode类,它包含文件和文件的公共字段目录inode。
-->
<inode>
<id>16385</id>
<type>DIRECTORY</type>
<name></name>
<mtime>1528043810446</mtime>
<permission>hyxy:supergroup:rwxr-xr-x</permission>
<nsquota>9223372036854775807</nsquota>
<dsquota>-1</dsquota>
</inode>
<inode>
<id>16386</id>
<type>DIRECTORY</type>
<name>user</name>
<mtime>1528043865470</mtime>
<permission>hyxy:supergroup:rwxr-xr-x</permission>
<nsquota>-1</nsquota>
<dsquota>-1</dsquota>
</inode>
<inode>
<id>16387</id>
<type>DIRECTORY</type>
<name>hyxy</name>
<mtime>1528044944833</mtime>
<permission>hyxy:supergroup:rwxr-xr-x</permission>
<nsquota>-1</nsquota>
<dsquota>-1</dsquota>
</inode>
<inode>
<id>16388</id>
<type>DIRECTORY</type>
<name>20180603</name>
<mtime>1528044017284</mtime>
<permission>hyxy:supergroup:rwxr-xr-x</permission>
<nsquota>-1</nsquota>
<dsquota>-1</dsquota>
</inode>
<inode>
<id>16390</id>
<type>FILE</type>
<name>text.txt</name>
<replication>3</replication>
<mtime>1528044017272</mtime>
<atime>1528044016919</atime>
<perferredBlockSize>134217728</perferredBlockSize>
<permission>hyxy:supergroup:rw-r--r--</permission>
<blocks>
<block>
<id>1073741826</id>
<genstamp>1002</genstamp>
<numBytes>12</numBytes>
</block>
</blocks>
</inode>
</INodeSection>
<INodeReferenceSection></INodeReferenceSection>
<SnapshotSection>
<snapshotCounter>0</snapshotCounter>
</SnapshotSection>
<INodeDirectorySection>
<directory>
<parent>16385</parent>
<inode>16386</inode>
</directory>
<directory>
<parent>16386</parent>
<inode>16387</inode>
</directory>
<directory>
<parent>16387</parent>
<inode>16388</inode>
</directory>
<directory>
<parent>16388</parent>
<inode>16390</inode>
</directory>
</INodeDirectorySection>
<FileUnderConstructionSection></FileUnderConstructionSection>
<SnapshotDiffSection>
<diff>
<inodeid>16385</inodeid>
</diff>
</SnapshotDiffSection>
<SecretManagerSection>
<currentId>0</currentId>
<tokenSequenceNumber>0</tokenSequenceNumber>
</SecretManagerSection>
<CacheManagerSection>
<nextDirectiveId>1</nextDirectiveId>
</CacheManagerSection>
</fsimage>
】
hdfs:分布式文件系统【分布式{切块和复本}---文件系统{逻辑上的}】
镜像文件当中包含哪些信息,参照上述XML
2.查看edits文件
$>hdfs oev -i edits_inprogress_0000000000000000040 -o ~/ed.xml
【
<?xml version="1.0" encoding="UTF-8"?>
<EDITS>
<EDITS_VERSION>-63</EDITS_VERSION>
<RECORD>
<OPCODE>OP_START_LOG_SEGMENT</OPCODE>
<DATA>
<TXID>40</TXID>
</DATA>
</RECORD>
<RECORD>
<OPCODE>OP_MKDIR</OPCODE>
<DATA>
<TXID>41</TXID>
<LENGTH>0</LENGTH>
<INODEID>16392</INODEID>
<PATH>/hyxy</PATH>
<TIMESTAMP>1528055285399</TIMESTAMP>
<PERMISSION_STATUS>
<USERNAME>hyxy</USERNAME>
<GROUPNAME>supergroup</GROUPNAME>
<MODE>493</MODE>
</PERMISSION_STATUS>
</DATA>
</RECORD>
</EDITS>
】