Due to its unfortunate naming, the Secondary NameNode (SNN) is sometimes
confused with a failover backup for NameNode. It most certainly is not. The SNN
only serves to periodically clean up and tighten the fi lesystem’s state information in
NameNode, helping NameNode become more effi cient. NameNode manages the
fi lesystem’s state information using two fi les, FsImage and EditLog . The fi le FsImage is
a snapshot of the fi lesystem at some checkpoint, and EditLog records each incremental
change ( delta ) to the fi lesystem after that checkpoint. These two fi les can completely
determine the current state of the fi lesystem. When you initialize NameNode, it merges
these two fi les to create a new snapshot. At the end of NameNode’s initialization,
FsImage will contain the new snapshot and EditLog will be empty. Afterward any
operation that changes the state of HDFS is appended to EditLog, whereas FsImage will
remain unchanged. When you shut down NameNode and restart it, the consolidation
will take place again and make a new snapshot. Note that the two fi les are only for
retaining the fi lesystem’s state information while NameNode is not running (either
intentionally shut down or due to system malfunction ). NameNode keeps in memory
a constantly maintained copy of the fi lesystem’s state information to quickly answer
queries about the fi lesystem
Usage:hadoop secondarynamenode [-checkpoint [force]] | [-geteditsize]