Namenode contains the following files in
$ data.name.dir or in new parameter data.namenode.name.dir
current (Folder)
version
fsimage
fstime
edits
Image (Folder)
in_use.lock
In this post only version file is being discussed , rest are the topics for other posts
The contents of my version file are shown below
#Thu Apr 12 22:10:30 IST 2012
namespaceID=36961221
cTime=0
storageType=NAME_NODE
layoutVersion=-18
The significance of each is as follows
storageType donates the type of role this machine is being playing in the hadoop cluster . This can take value defined in HdfsConstants.NodeType The values being NAME_NODE and DATA_NODE
Other 3 values are defined using the StorageInfo
cTime defines the time when of creation of NN storage
namespaceID defines the unique identifier which is created after NN is formatted
layoutVersion is pretty interesting , it is a negative number representing HDFS persistent datastructure. Whenever the layout changes this version is decremented. The more for this will be discussed when writing about Upgrades of cluster
Some text from official documentation
Storage information file.
Local storage information is stored in a separate file VERSION. It contains type of the node, the storage layout version, the namespace id, and the fs state creation time.
Local storage can reside in multiple directories. Each directory should contain the same VERSION file as the others. During startup Hadoop servers (name-node and data-nodes) read their local storage information from them.
The servers hold a lock for each storage directory while they run so that other nodes were not able to startup sharing the same storage. The locks are released when the servers stop (normally or abnormally).