Professional Documents
Culture Documents
At a high level, the NameNodes primary responsibility is storing the HDFS namespace.
This means things like the directory tree, file permissions, and the mapping of files to
block IDs. Its important that this metadata (and all changes to it) are safely persisted to
stable storage for fault tolerance.
This filesystem metadata is stored in two different constructs: the fsimage and the edit
log. The fsimage is a file that represents a point-in-time snapshot of the filesystems
metadata. However, while the fsimage file format is very efficient to read, its unsuitable
for making small incremental updates like renaming a single file. Thus, rather than
writing a new fsimage every time the namespace is modified, the NameNode instead
records the modifying operation in the edit log for durability.
This way, if the NameNode crashes, it can restore its state by first loading the fsimage
then replaying all the operations (also called edits or transactions) in the edit log to catch
up to the most recent state of the namesystem.
NameNode can load the final in-memory state directly from the fsimage. This is a far
more efficient operation and reduces NameNode startup time.
and edit files as needed via GET to the NNs GetImageServlet. The
SecondaryNameNode might already have some of these files from a previous
checkpoint (such as the current fsimage).
4. If necessary, the 2NN reloads its namespace from a newly downloaded fsimage.
5. The 2NN replays the new edit log segments to catch up to the current transaction
ID.
6. 2NN writes out its namespace to a new fsimage.
7. The 2NN contacts the NN via HTTP GET at /getimage?putimage=1,
causing the NNs servlet to do its own GET to the 2NN to download the new
fsimage.
8. The active NNs servlet uses the information in the GET request to in turn do its
Configuring Checkpointing
Add below properties in core-site.xml file.
<property>
<name>fs.checkpoint.dir</name>
<value>/data/Hadoop/namesecondary</value>
</property>
<property>
<name>fs.checkpoint.edits.dir</name>
<value>${fs.checkpoint.dir}</value>
</property>
<property>
<name>fs.checkpoint.period</name>
<value>3600</value>
</property>