Tuesday 22 March 2022

Hadoop: Cannot create directory, Name node is in safe mode

When I am trying to create a directory in HDFS, I got error like ‘Cannot create directory /user/cloudera/demo1. Name node is in safe mode’

[cloudera@quickstart ~]$ hadoop fs -mkdir -p /user/cloudera/demo1
mkdir: Cannot create directory /user/cloudera/demo1. Name node is in safe mode.

 

What is safemode?

Safemode represents the maintenance state of Namenode, during this time, Namenode do not allow any modificaitons to the system. When you start hadoop cluster, for some time limit hadoop stays in safemode.

 

How to leave the safemode?

Leave the safemode by executing below command.

hadoop dfsadmin -safemode leave

 

[cloudera@quickstart ~]$ hadoop dfsadmin -safemode leave
DEPRECATED: Use of this script to execute hdfs command is deprecated.
Instead use the hdfs command for it.

Safe mode is OFF
[cloudera@quickstart ~]$ 
[cloudera@quickstart ~]$ hadoop fs -mkdir -p /user/cloudera/demo1
[cloudera@quickstart ~]$ 
[cloudera@quickstart ~]$ hadoop fs -ls /user/cloudera
Found 1 items
drwxr-xr-x   - cloudera cloudera          0 2022-03-22 09:27 /user/cloudera/demo1
[cloudera@quickstart ~]$

 

Note

‘hadoop dfsadmin -safemode leave’ command is deprecated, you can use ‘hdfs dfsadmin -safemode leave’ to quit safemode.

$ hdfs dfsadmin -safemode leave
Safe mode is OFF

 

 

Previous                                                 Next                                                 Home

No comments:

Post a Comment