Hadoop集群怎么管理Namenode的目录数据结构

这篇文章主要讲解了“Hadoop集群怎么管理Namenode的目录数据结构”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Hadoop集群怎么管理Namenode的目录数据结构”吧!

一、dfs目录结构

[root@master hadoop]# pwd
/opt/hadoop-2.7.1/etc/hadoop

[root@master hadoop]# cat core-site.xml 
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->

<!-- Put site-specific property overrides in this file. -->

<configuration>
	<property>
		<name>hadoop.tmp.dir</name>
		<value>/opt/hadoop-2.7.1/tmp</value>
	</property>
	<property>
		<name>fs.defaultFS</name>
		<value>hdfs://master.harry.com:9000</value>
	</property>
	
	<!-- HA-->
<!--
	<property>
		<name>ha.zookeeper.quorum</name>
		<value>master.harry.com:2181</value>
	</property>
	<property>
		<name>ha.zookeeper.session-timeout.ms</name>
		<value>5000</value>
	</property>
	<property>
		<name>ha.zookeeper.parent-znode</name>
		<value>/hadoop-harry-ha</value>
	</property>
-->
</configuration>


[root@master tmp]# pwd
/opt/hadoop-2.7.1/tmp

[root@master tmp]# tree dfs/ -L 2
dfs/
|-- data
|   `-- current
`-- name
    `-- current

4 directories, 0 files

[root@master current]# pwd
/opt/hadoop-2.7.1/tmp/dfs/name/current

[root@master current]# ll
total 1076
-rw-r--r--. 1 root root     207 Oct 14 22:39 VERSION
-rw-r--r--. 1 root root   14381 Oct 14 23:33 edits_0000000000000000001-0000000000000000127
-rw-r--r--. 1 root root      42 Oct 15 00:33 edits_0000000000000000128-0000000000000000129
-rw-r--r--. 1 root root      42 Oct 15 01:33 edits_0000000000000000130-0000000000000000131
-rw-r--r--. 1 root root      42 Oct 15 02:33 edits_0000000000000000132-0000000000000000133
-rw-r--r--. 1 root root 1048576 Oct 15 02:33 edits_inprogress_0000000000000000134
-rw-r--r--. 1 root root    1809 Oct 15 01:33 fsimage_0000000000000000131
-rw-r--r--. 1 root root      62 Oct 15 01:33 fsimage_0000000000000000131.md5
-rw-r--r--. 1 root root    1809 Oct 15 02:33 fsimage_0000000000000000133
-rw-r--r--. 1 root root      62 Oct 15 02:33 fsimage_0000000000000000133.md5
-rw-r--r--. 1 root root       4 Oct 15 02:33 seen_txid

二、解析

edits_* 文件:当我们对元数据进行修改时,如新增了block,新增了节点,等等,这样对namespace等进行了修改,数据都会被临时存放到edits文件中。

fsimage 文件:存放实际的namenode所管理的数据。定期的由secondary namenode和并edits文件和旧的fsimage文件而成的。

seen_txid:记录最后一个edits文件的数字如 本例子中式134.因为edits文件最后到133.当系统重启时,会检查seen_txid和edits文件的最后数字,来表示是否存在元数据的缺失。

[root@master current]# cat seen_txid 
134

VERSION文件:

[root@master current]# cat VERSION 
#Wed Oct 14 22:39:48 PDT 2015
namespaceID=1916027777
clusterID=CID-f0ee4204-f7a1-4e8d-9799-bdd5e23259f1
cTime=0
storageType=NAME_NODE
blockpoolID=BP-1637593683-172.16.114.202-1444887588098
layoutVersion=-63

感谢各位的阅读,以上就是“Hadoop集群怎么管理Namenode的目录数据结构”的内容了,经过本文的学习后,相信大家对Hadoop集群怎么管理Namenode的目录数据结构这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!