无法创建目录/ home / hadoop / hadoopinfra / hdfs / namenode / current

lor*_*tar 5 hadoop hdfs

我得到错误

Cannot create directory /home/hadoop/hadoopinfra/hdfs/namenode/current
Run Code Online (Sandbox Code Playgroud)

尝试在本地Mac上安装hadoop时。

这可能是什么原因?仅供参考,我将xml文件放在下面:

mapred-site.xml:

<configuration>

   <property> 
      <name>mapreduce.framework.name</name>
      <value>yarn</value>
   </property>
</configuration>
Run Code Online (Sandbox Code Playgroud)

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>
Run Code Online (Sandbox Code Playgroud)

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>
Run Code Online (Sandbox Code Playgroud)

我认为我的问题出在我的hdfs-site.xml文件中,但是我不确定如何查明/更改它。

我正在使用教程,文件路径中的“ hadoop”已替换为我的用户名。

小智 6

我也有这个问题,这是一个权限问题。我已经做了:

须藤 chmod 777 /home/hadoop/hadoopinfra/hdfs/namenode/

和作品!


Ébe*_*aac 5

可能的错误:hdfs-site.xml文件配置错误

当我在学习设置教程时,这发生在我身上。hdfs-site.xml对我来说的内容是

<configuration>
    <property>
            <name>dfs.namenode.name.dir</name>
            <value>/home/hadoop/data/nameNode</value>
    </property>

    <property>
            <name>dfs.datanode.data.dir</name>
            <value>/home/hadoop/data/dataNode</value>
    </property>

    <property>
            <name>dfs.replication</name>
            <value>1</value>
    </property>
</configuration>
Run Code Online (Sandbox Code Playgroud)

直到那时我才意识到hadoop上述文件中的文本对应于用户名,在我的情况下,它必须替换为hduser. 当两个出现的hadoop被替换为 时hduser,该hdfs namenode -format命令工作正常。


小智 0

在需要验证hadoop安装的步骤中,使用“/usr/local/hadoop/bin/hdfs namenode -format”而不是“hdfs namenode -format”

从以下位置找到了这个答案: hadoop java.io.IOException: while running namenode -format