What is Safemode in Hadoop?

Viewing 3 reply threads
  • Author
    Posts
    • #6063
      DataFlair TeamDataFlair Team
      Spectator

      What is Safemode? how to come out of Safemode in Hadoop?
      Write the commands to enter and leave Safemode in Hadoop?

    • #6066
      DataFlair TeamDataFlair Team
      Spectator

      Safemode in Apache Hadoop is a maintenance state of NameNode, during which NameNode doesn’t allow any modifications to the file system. In Safemode, HDFS cluster is in read-only and doesn’t replicate or delete Data Blocks.

      When NameNode starts:

      • 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 performs 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.

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

    • #6068
      DataFlair TeamDataFlair Team
      Spectator

      Safe mode is a mechanism of preventing modifications when HDFS cluster is unstable, In this mode HDFS remains in the read-only mode preventing deletion, replication of the Data Blocks.

      HDFS is a distributed file system, so the data blocks of a file are replicated between different data nodes depending upon the replication factor to ensure data availability in case if any data node goes down. What if all the nodes that holds certain blocks are down?
      HDFS has a safety mechanism, in which reaching a certain percentage of unavailable blocks makes the HDFS go to a “safe mode”

      Status of Safemode :

      hadoop dfsadmin –safemode get

      To Manually enter Safemode:

      hadoop dfsadmin –safemode enter

      To Exit Safemode:

      hadoop dfsadmin -safemode leave
    • #6069
      DataFlair TeamDataFlair Team
      Spectator

      Safemode in Apache Hadoop is a maintenance state of NameNode, during which NameNode doesn’t allow any modifications to the file system. In Safemode, HDFS cluster is in read-only and doesn’t replicate or delete Data Blocks.

      To come out of/leave safemode :

      hdfs dfsadmin -safemode leave

      To enter safemode :

      hdfs dfsadmin -safemode enter

      **hadoop dfsadmin -safemode enter
      This command will work and will take you to safemode but just as an update hadoop command is DEPRECATED.
      Instead use hdfs command .

Viewing 3 reply threads
  • You must be logged in to reply to this topic.