您的位置:首页 > Web前端 > Node.js

Hadoop格式化namenode时候,出现Java异常:URI has an authority component问题的解决

2017-07-06 10:26 591 查看
在执行命令:

hdfs namenode -formate


时候,出现错误,提示:

17/07/06 10:07:39 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.num.users = 10
17/07/06 10:07:39 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.windows.minutes = 1,5,25
17/07/06 10:07:39 INFO namenode.FSNamesystem: Retry cache on namenode is enabled
17/07/06 10:07:39 INFO namenode.FSNamesystem: Retry cache will use 0.03 of total heap and retry cache entry expiry time is 600000 millis
17/07/06 10:07:39 INFO util.GSet: Computing capacity for map NameNodeRetryCache
17/07/06 10:07:39 INFO util.GSet: VM type       = 64-bit
17/07/06 10:07:39 INFO util.GSet: 0.029999999329447746% max memory 966.7 MB = 297.0 KB
17/07/06 10:07:39 INFO util.GSet: capacity      = 2^15 = 32768 entries
17/07/06 10:07:39 ERROR namenode.NameNode: Failed to start namenode.
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:986)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1434)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1559)


这个问题是因为配置hdfs-site.xml文件出现错误时候产生的:

默认的hdfs-site.xml的配置文件参数是:

<property>
<name>df
4000
s.namenode.name.dir</name>
<value>file://${hadoop.tmp.dir}/dfs/name</value>
<description>Determines where on the local filesystem the DFS name node
should store the name table(fsimage).  If this is a comma-delimited list
of directories then the name table is replicated in all of the
directories, for redundancy. </description>
</property>


将其改为具体的hadoop文件路径,想必这个大家也都知道,是在core-site.xml中配置的,默认的路径是在tmp文件夹下的,我们都会更改这个路径,很重要,也很基础的。

对于我的机器,改为

<property>
<name>dfs.namenode.name.dir</name>
<value>file:/~/hadoop_tmp/dfs/name</value>
<description>Determines where on the local filesystem the DFS name node
should store the name table(fsimage).  If this is a comma-delimited list
of directories then the name table is replicated in all of the
directories, for redundancy. </description>
</property>


这里file://原来是双斜杠,我仿照网上的博文改为单斜杠,双斜杠能不能用,我也不知道,大家可以自己试一试。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐