Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does Name node store fsImage and edit Log?

Tags:

hadoop

hdfs

I am a java programmer, learning Hadoop. I read that the Name node in HDFS stores its information into two files namely fsImage & editLog. In case of start up it reads this data from the disk & performs checkpoint operation.

But at many places I also read that Name Node stores the data in RAM & that is why apache recommends a machine with high RAM for Name Node server.

Please enlighten me on this. What data does it store in RAM & where does it store fsImage and edit Log ?

Sorry if I asked anything obvious.

like image 660
Ankit Avatar asked Apr 20 '14 12:04

Ankit


People also ask

Where FsImage and edit logs are stored?

located in your hadoop conf folder. In my system it is located at usr/lib/hadoop/conf which is hadoop installed directory. In this code /var/lib/hadoop-0.20/cache/ is the location of fsimage, fstime and edits log.

Where is FsImage stored?

The FsImage is stored as a file in the NameNode's local file system too. The NameNode keeps an image of the entire file system namespace and file Blockmap in memory.

What happens with the FsImage and edit logs during the name node formatting?

When we are starting namenode, latest FsImage file is loaded into "in-memory" and at the same time, EditLog file is also loaded into memory if FsImage file does not contain up to date information. Namenode stores metadata in "in-memory" in order to serve the multiple client request(s) as fast as possible.

Which location name node stores its metadata and why?

Namenode stored metadata in “in-memory” in order to serve the multiple client request(s) as fast as possible.


2 Answers

When namenode starts, it loads fsimage from persistent storage(disk) it's location specified by the property dfs.name.dir (hadoop-1.x) or dfs.namenode.name.dir (hadoop-2.x) in hdfs-site.xml. Fsimage is loaded into main memory. Also as you asked during namenode starting it performs check point operation. Namenode keeps the Fsimage in RAM inorder to serve requests fast.

Apart from initial checkpoint, subsequent checkpoints can be controlled by tuning the following parameters in hdfs-site.xml.

dfs.namenode.checkpoint.period       # in second 3600 Secs by default
dfs.namenode.checkpoint.txns         # No of namenode transactions
like image 24
SachinJ Avatar answered Nov 16 '22 07:11

SachinJ


Let me first answer

What data does it store in RAM & where does it store fsImage and edit Log ?

In RAM -- file to block and block to data node mapping. In persistent storage (includes both edit log and fsimage) -- file related metadata (permissions, name and so on)

Regarding the storage location of the fsimage and editlog @mashuai's answer is spot on.

For a more detailed discussion you can read up on this

like image 125
Sudarshan Avatar answered Nov 16 '22 08:11

Sudarshan