【发布时间】:2019-04-26 08:31:26
【问题描述】:
我对 hadoop 很陌生,所以我开始关注hadoop 2.9.2 getting started。当我运行命令时
bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.9.2.jar grep input output 'dfs[a-z.]+'
它返回成功,但是当我查看用于显示结果的output/part-r-00000.txt 文件时,它是空的,即使input 目录包含etc/hadoop 的.xml 文件,因为它应该是的。
我一遍又一遍地开始整个过程,阅读所有日志,以了解错误可能出在哪里。无论如何,当我运行bin/hdfs namenode -format 时,它会显示这个错误:
ERROR common.Util: Syntax error in URI file://path to temp_directory/dfs/name. Please check hdfs configuration.
java.net.URISyntaxException: Illegal character in authority at index 7: file://path to temp_directory/dfs/name
at java.base/java.net.URI$Parser.fail(URI.java:2915)
at java.base/java.net.URI$Parser.parseAuthority(URI.java:3249)
at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3160)
at java.base/java.net.URI$Parser.parse(URI.java:3116)
at java.base/java.net.URI.<init>(URI.java:600)
at org.apache.hadoop.hdfs.server.common.Util.stringAsURI(Util.java:49)
at org.apache.hadoop.hdfs.server.common.Util.stringCollectionAsURIs(Util.java:99)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getStorageDirs(FSNamesystem.java:1466)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getNamespaceEditsDirs(FSNamesystem.java:1511)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getNamespaceEditsDirs(FSNamesystem.java:1480)
at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1137)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1614)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1741)
当我运行bin/hdfs dfs -put etc/hadoop input时也会发生这种情况:
WARN hdfs.DataStreamer: DataStreamer Exception
org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /user/federico/input/hadoop/capacity-scheduler.xml._COPYING_ could only be replicated to 0 nodes instead of minReplication (=1). There are 0 datanode(s) running and no node(s) are excluded in this operation.
似乎很清楚没有数据节点正在运行。那么,假设这种情况,我如何初始化一个数据节点以使事情正常运行,以及我如何知道我的数据节点是否按预期运行?
编辑:我尝试遵循遇到类似问题的不同用户的一些建议,但出现了错误:
WARN org.apache.hadoop.hdfs.server.datanode.checker.StorageLocationChecker: Exception checking StorageLocation [DISK]file:/dfs/data
java.io.FileNotFoundException: File file:/dfs/data does not exist
因此数据节点创建失败。我该如何处理?
【问题讨论】:
-
您必须根据您的目录结构更改 hdfs 站点 xml 中的配置。