Hadoop2.7.0 NameNode FORMAT java.lang.IllegalArgumentException:URI具有权限组件

时间:2016-06-17 03:45:43

标签: hadoop hdfs

我下载了Hadoop源代码,以便将Hadoop源代码导入Eclipse工作区。

我添加了core-site.xmlhdfs-site.xml hadoop-2.7.0-src/hadoop-hdfs-project/hadoop-hdfs/src/main/java dir内容。

在Eclipse中,我运行了NameNode.java

java NameNode.java -format

我收到以下错误消息:

 java.lang.IllegalArgumentException: URI has an authority component
    at java.io.File.<init>(File.java:423)
    at org.apache.hadoop.hdfs.server.namenode.NNStorage.getStorageDirectory(NNStorage.java:329)
    at org.apache.hadoop.hdfs.server.namenode.FSEditLog.initJournals(FSEditLog.java:276)
    at org.apache.hadoop.hdfs.server.namenode.FSEditLog.initJournalsForWrite(FSEditLog.java:247)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:984)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1428)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1553)
2016-06-17 11:12:54,404 INFO  util.ExitUtil (ExitUtil.java:terminate(124)) - Exiting with status 1
2016-06-17 11:12:54,405 INFO  namenode.NameNode (LogAdapter.java:info(47)) - SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at localhost/127.0.0.1
************************************************************/

我的core-site.xml

<configuration>
    <property>
        <name>fs.defaultFS</name>
        <value>hdfs://master:9000/</value>
    </property>

    <property>
        <name>hadoop.tmp.dir</name>
        <value>file:///Users/Joker/tmp</value>
    </property>
</configuration>

我的hdfs-site.xml

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

    <property>
        <name>dfs.namenode.name.dir</name>
        <value>file://code/java/hadoop2.7.0/dfs/name</value>
    </property>

    <property>
        <name>dfs.datanode.data.dir</name>
        <value>file://code/java/hadoop2.7.0/dfs/data</value>
    </property>
</configuration>

我没有设置HADOOP_HOME,我只想在源代码中运行NameNode

1 个答案:

答案 0 :(得分:2)

实际上你已经在core-site.xml和hdfs-site.xml中设置了如下所示的路径

  <configuration>
    <property>
    <name>fs.defaultFS</name>
    <value>hdfs://master:9000/</value>
   </property>

<property>
    <name>hadoop.tmp.dir</name>
    <value>/Users/Joker/tmp</value>
   </property>
</configuration>

在像这样的hdfs-site.xml中。

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

<property>
    <name>dfs.namenode.name.dir</name>
    <value>/code/java/hadoop2.7.0/dfs/name</value>
</property>

<property>
    <name>dfs.datanode.data.dir</name>
    <value>/code/java/hadoop2.7.0/dfs/data</value>
   </property>
   </configuration>