0

我正在关注本教程http://v-lad.org/Tutorials/Hadoop/14%20-%20start%20up%20the%20cluster.html

我在“启动集群”步骤,但是当我启动数据节点时(当我执行命令时:bin/hadoop datanode)我收到以下错误:

$ bin/hadoop datanode
12/07/04 23:53:53 INFO datanode.DataNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting DataNode
STARTUP_MSG:   host = halgarci-WS/10.21.144.26
STARTUP_MSG:   args = []
STARTUP_MSG:   version = 0.19.1
STARTUP_MSG:   build = https://svn.apache.org/repos/asf/hadoop/core/branches/bra                             nch-0.19 -r 745977; compiled by 'ndaley' on Fri Feb 20 00:16:34 UTC 2009
************************************************************/
12/07/04 23:53:54 ERROR datanode.DataNode: java.io.IOException: Expecting a line                              not the end of stream
        at org.apache.hadoop.fs.DU.parseExecResult(DU.java:181)
        at org.apache.hadoop.util.Shell.runCommand(Shell.java:179)
        at org.apache.hadoop.util.Shell.run(Shell.java:134)
        at org.apache.hadoop.fs.DU.<init>(DU.java:53)
        at org.apache.hadoop.fs.DU.<init>(DU.java:63)
        at org.apache.hadoop.hdfs.server.datanode.FSDataset$FSVolume.<init>(FSDa                             taset.java:325)
        at org.apache.hadoop.hdfs.server.datanode.FSDataset.<init>(FSDataset.jav                             a:681)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.startDataNode(DataNod                             e.java:291)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.<init>(DataNode.java:                             205)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.makeInstance(DataNode                             .java:1238)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(D                             ataNode.java:1193)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.createDataNode(DataNo                             de.java:1201)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:13                             23)

12/07/04 23:53:54 INFO datanode.DataNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down DataNode at halgarci-WS/10.21.144.26
************************************************************/

关于如何解决此错误的任何建议?

谢谢!!

4

2 回答 2

3

not sure if you have resolved the problem. The 'du' command Hadoop uses is the windows/system32/ builtin one, not the cygwin/bin/du.exe. I just removed the Windows builtid du.exe, and let haddop use cygwin's, then everything worked.

于 2012-10-31T05:50:38.983 回答
1

该类DU执行命令du -sk <dirPath>并尝试解析其结果。

您得到的异常表明结果(标准输出)为空。这里的解析代码供参考:

  protected void parseExecResult(BufferedReader lines) throws IOException {
    String line = lines.readLine();
    if (line == null) {
      throw new IOException("Expecting a line not the end of stream");
    }
    String[] tokens = line.split("\t");
    if(tokens.length == 0) {
      throw new IOException("Illegal du output");
    }
    this.used.set(Long.parseLong(tokens[0])*1024);
  }

如果du在命令行上运行,如果指定的目录不存在,则可以看到 std-out 为空。所以我认为这里就是这种情况。

您是否检查过 datanode 数据目录(通过dfs.data.dirin配置hdfs-site.xml)是否存在?

于 2012-07-05T07:58:35.257 回答