Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hadoop Name Node format fails

Tags:

hadoop

When I try to format NameNode on Hadoop, I get an error saying that the directories can't be created.

Cannot create directory /usr/local/hadoop_store/hdfs/namenode/current
Cannot create directory /usr/local/hadoop_store/hdfs/namenode/current


java.io.IOException: Cannot create directory /usr/local/hadoop_store/hdfs/namenode/current
    at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.clearDirectory(Storage.java:337)
    at org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:548)
    at org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:569)
    at org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:161)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:990)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1428)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1553)
15/06/06 22:04:30 ERROR namenode.NameNode: Failed to start namenode.
java.io.IOException: Cannot create directory /usr/local/hadoop_store/hdfs/namenode/current
    at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.clearDirectory(Storage.java:337)
    at org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:548)
    at org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:569)
    at org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:161)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:990)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1428)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1553)
like image 646
Vineel Avatar asked Jun 06 '15 22:06

Vineel


2 Answers

This error occurs if you have not created the /usr/local/hadoop_store/hdfs/namenode folder or it does not have correct permission.

  1. Create the directory first. Try this in terminal:

    sudo mkdir /usr/local/hadoop_store/hdfs/namenode

NOTE: Run this command as hadoop user.

  1. Change permissions, if necessary.

    sudo chown -R hadoopuser:hadoopgroup /usr/local/hadoop_store/hdfs/namenode

    sudo chmod -R 777 /usr/local/hadoop_store/hdfs/namenode

Here, hadoopuser is your hadoop username and hadoopgroup is hadoop group name.

like image 102
Rajesh N Avatar answered Nov 05 '22 06:11

Rajesh N


Which OS are you using on your hadoop cluster??

If you're running this on Ubuntu try this..

sudo bin/hadoop namenode -format

like image 5
hadooper Avatar answered Nov 05 '22 05:11

hadooper