我在ubuntu上安装Hadoop 3.x时遇到java IO异常

时间:2017-09-08 04:42:28

标签: ubuntu hadoop

完成所有必需的配置后,我正在'格式化节点名'并运行命令“ bin / hdfs namenode -format ”,但获得以下java IO异常:

我遵循以下步骤: http://data-flair.training/blogs/installation-hadoop-3-x-ubuntu-pseudo-distributed-mode/

java.io.IOException: Cannot create directory /home/dataflair/hdata/dfs/name/current
        at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.clearDirectory(Storage.java:415)
        at org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:579)
        at org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:601)
        at org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:157)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1144)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1584)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1704)
2017-09-08 09:59:40,098 ERROR namenode.NameNode: Failed to start namenode.
java.io.IOException: Cannot create directory /home/dataflair/hdata/dfs/name/current
        at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.clearDirectory(Storage.java:415)
        at org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:579)
        at org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:601)
        at org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:157)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1144)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1584)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1704)
2017-09-08 09:59:40,100 INFO util.ExitUtil: Exiting with status 1
2017-09-08 09:59:40,102 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at amit-virtual-machine/127.0.1.1
************************************************************/

1 个答案:

答案 0 :(得分:0)

在$ HADOOP_PREFIX / etc / hadoop / core-site.xml 中为 hadoop.tmp.dir 属性添加正确的路径。

<configuration> 
<property> 
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property> 
<property> 
<name>hadoop.tmp.dir</name> 
<value>/home/{your ubuntu's user not dataflair}/hdata</value>
</property> 
</configuration>