简体   繁体   English

在Windows下运行hadoop作业

[英]Run hadoop job under windows

I have successfully installed hadoop under windows. 我已经在Windows下成功安装了hadoop。 (Namenodes and jobtrackers start normally as they should) (名称节点和作业跟踪程序应正常启动)

Now I'm trying to run some example jobs: 现在,我正在尝试运行一些示例作业:

Running the following command (in cygwin) 运行以下命令(在cygwin中)

hadoop jar $HADOOP_INSTALL/hadoop-0.20.2-examples.jar randomwriter random-data

Throws 投掷

   Exception in thread "main" java.io.IOException: Error opening job jar: /cygdrive   /c/cygwin/home/Username/hadoop/hadoop-0.20.2-examples.jar
    at org.apache.hadoop.util.RunJar.main(RunJar.java:90)
 Caused by: java.io.FileNotFoundException: \cygdrive\c\cygwin\home\Username\hadoop\hadoop-0.20.2-examples.jar (The system cannot find the path specified)
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:127)
    at java.util.jar.JarFile.<init>(JarFile.java:135)
    at java.util.jar.JarFile.<init>(JarFile.java:72)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:88)

Which is probably thrown because of the fact that cygwin can't recognize the CLASSPATH. 之所以抛出该错误,是因为cygwin无法识别CLASSPATH。

The solution (?) to this problem is described here 此问题的解决方案(?)在此处描述

So, in general i have to execute java programms as 因此,一般而言,我必须执行java程序作为

java -classpath `cygpath -wp $CLASSPATH` [arguments]

Now, given that, how exactly should I execute the above hadoop command in conjuction with the last one? 现在,考虑到这一点,我应该如何结合上面的hadoop命令来执行上述命令?

I realize this post is over a year old, but there is no answer marked. 我知道这篇文章已有一年多的历史了,但是没有标记答案。 You are very close ... this should work without having to edit any configurations. 您非常亲密...这应该无需编辑任何配置即可工作。

hadoop jar `cygpath -wp $HADOOP_INSTALL/hadoop-0.20.2-examples.jar` randomwriter random-data

Edit the $HADOOP_HOME/bin/hadoop file and alter the last line which calls the java command according to your cygwin requirement. 编辑$ HADOOP_HOME / bin / hadoop文件,并根据您的cygwin要求更改最后一行调用java命令的行。 After that call the example as the initial call. 之后,将示例作为初始调用。

Last line calling java is 调用java的最后一行是

# run it
  exec "$JAVA" -Dproc_$COMMAND $JAVA_HEAP_MAX $HADOOP_OPTS -classpath "$CLASSPATH" $CLASS "$@"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM