Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot create directory /home/hadoop/hadoopinfra/hdfs/namenode/current

Tags:

hadoop

hdfs

I get the error

Cannot create directory /home/hadoop/hadoopinfra/hdfs/namenode/current

While trying to install hadoop on my local Mac.

What could be the reason for this? Just for reference, I'm putting my xml files down below:

mapred-site.xml:

<configuration>

   <property> 
      <name>mapreduce.framework.name</name>
      <value>yarn</value>
   </property>
</configuration>

hdfs-site.xml:

<configuration>
    <property>
      <name>dfs.replication</name>
      <value>1</value>
    </property>

   <property>
      <name>dfs.name.dir</name>
      <value>file:///home/hadoop/hadoopinfra/hdfs/namenode </value>
   </property>

   <property>
      <name>dfs.data.dir</name> 
      <value>file:///home/hadoop/hadoopinfra/hdfs/datanode </value> 
   </property>
</configuration>

core-site.xml:

<configuration>
  <property>
    <name>hadoop.tmp.dir</name>
    <value>/usr/local/Cellar/hadoop/hdfs/tmp</value>
    <description>A base for other temporary directories.</description>
  </property>
  <property>
    <name>fs.default.name</name>
    <value>hdfs://localhost:9000</value>
  </property>
</configuration>

I think my problem lies in my hdfs-site.xml file, but I'm not sure how to pinpoint/change it.

I'm using this tutorial, and "hadoop" in the file path is replaced by my username.

like image 267
lordingtar Avatar asked Feb 08 '16 20:02

lordingtar


People also ask

Can not create directory name node is in safe mode?

Namenode in safe mode means, Hadoop is in read-only mode. At this point, Hadoop won't allow any files to be written/append into HDFS, i.e., no changes are allowed in HDFS. So, if we try to create a directory in HDFS, above error in question will be thrown.

Why is NameNode in safe mode?

Safemode for the NameNode is essentially a read-only mode for the Hadoop Distributed File System (HDFS) cluster. NameNode might enter into Safemode for different reasons, such as the following: Available space is less than the amount of space required for the NameNode storage directory.

What is the command to format NameNode?

Formatting any NameNode with already existing namespaces could result in data loss. Format the active NameNode by specifying the Cluster ID. The Cluster ID must be the same as that of the existing namespaces. Bootstrap the standby NameNode as specified.


1 Answers

I had this problem too and it was a permission problem. I just did:

sudo chmod 777 /home/hadoop/hadoopinfra/hdfs/namenode/

and works!

like image 110
Luiz Calaça Avatar answered Oct 14 '22 16:10

Luiz Calaça