1、dfs目录结构node
[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
2、解析shell
edits_* 文件:当咱们对元数据进行修改时,如新增了block,新增了节点,等等,这样对namespace等进行了修改,数据都会被临时存放到edits文件中。express
fsimage 文件:存放实际的namenode所管理的数据。按期的由secondary namenode和并edits文件和旧的fsimage文件而成的。apache
seen_txid:记录最后一个edits文件的数字如 本例子中式134.由于edits文件最后到133.当系统重启时,会检查seen_txid和edits文件的最后数字,来表示是否存在元数据的缺失。session
[root@master current]# cat seen_txid 134
VERSION文件:
app
[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