Google News
logo
Hadoop - Interview Questions
What is Safemode in Hadoop?
Safemode in Apache Hadoop is a maintenance state of NameNode. During which NameNode doesn’t allow any modifications to the file system. During Safemode, HDFS cluster is in read-only and doesn’t replicate or delete blocks. At the startup of NameNode :
 
  * It loads the file system namespace from the last saved FsImage into its main memory and the edits log file.
  * Merges edits log file on FsImage and results in new file system namespace.
  * Then it receives block reports containing information about block location from all datanodes.

In SafeMode NameNode perform a collection of block reports from datanodes. NameNode enters safemode automatically during its start up. NameNode leaves Safemode after the DataNodes have reported that most blocks are available. Use the command :

hadoop dfsadmin – safemode get : To know the status of Safemode
bin/hadoop dfsadmin – safemode enter : To enter Safemode
hadoop dfsadmin - safemode leave : To come out of Safemode

NameNode front page shows whether safemode is on or off.
 
Advertisement