Name node is in safe mode error in HDFS

When we create a directory in HDFS or move a directory from the local machine to HDFS, we occasionally encounter the following error.

Cannot create directory /location/. Name node is in safe mode.

This is because the name node went into safe mode. NameNode may enter Safemode for a variety of reasons. The most possible reason can be, the amount of space available is less than the amount of space required for the NameNode storage directory. As a result, the HDFS becomes readonly. That means we can’t add any new directories or files to the HDFS because it will interfere with file replication due to limited storage.

Inorder to create the directories, issue the following command to leave from the safe mode, after sorting out the space issue.

sudo -u hdfs hdfs dfsadmin -safemode leave

Now, you can create the directory successfully.

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s