Following are the functions of Secondary NameNode:
FsImage which stores a copy of EditLog and FsImage file. NameNode crash: If the NameNode crashes, then Secondary NameNode’s FsImage can be used to recreate the NameNode. Checkpoint: It is used by Secondary NameNode to confirm that data is not corrupted in HDFS. Update: It automatically updates the EditLog and FsImage file. It helps to keep FsImage file on Secondary NameNode updated.
Below is key point for remember :
-
The Secondary NameNode connects to the primary NameNode and requests a copy of the file system metadata that means namespace image and edit log.
-
The primary NameNode creates a new checkpoint by saving the current namespace image and the accumulated edit log into a new checkpoint directory.
-
The primary NameNode sends the newly created checkpoint files to the Secondary NameNode.
-
The Secondary NameNode downloads the checkpoint files and merges them with the existing namespace image and edit log stored locally.
-
The Secondary NameNode creates a new, consolidated checkpoint that includes the merged metadata.
-
The consolidated checkpoint is then sent back to the primary NameNode.
-
The primary NameNode replaces the old namespace image and edit log with the new checkpoint received from the Secondary NameNode.