Tuesday, 8 April 2014

[SOLVED] org.apache.hadoop.hdfs.server.namenode.SafeModeException:Name node is in safe mode - How to leave

Namenode daemon in Hadoop Framework enters into safe mode in unusual situations.

For example when disk is full, also in the start-up phase. You can see something like this.

org.apache.hadoop.hdfs.server.namenode.SafeModeException: Cannot create directory /user/root/t. Name node is in safe mode

So Hadoop needs to leave safemode.Running below command leaves safemode.

bin/hadoop dfsadmin -safemode leave

After doing the above command, Run hadoop fsck so that any inconsistencies crept in the hdfs might be sorted out.

Use  hdfs  command instead of  hadoop command for newer distributions:

hdfs dfsadmin -safemode leave

hadoop dfsadmin has been deprecated, all hdfs related tasks are being moved to a separate command hdfs.