简体   繁体   English

使用Virtualbox的Hortonworks Hadoop-执行jar

[英]Hortonworks Hadoop using Virtualbox - Execute a jar

i am a hadoop beginner. 我是Hadoop初学者。 Therefore i try to handle easy examples to get to know the environment. 因此,我尝试处理一些简单的示例来了解环境。 So i created a jar that performs a wordcount - amongst others this one Hadoop: Set up Maven project in 5 Minutes . 因此,我创建了一个执行单词计数的jar,其中包括一个Hadoop:5分钟内设置Maven项目 My problem: It is not possible for me to execute the .jar at my Hortonworks Sandbox. 我的问题:我无法在Hortonworks Sandbox上执行.jar。 Every time i get the error: 每次我得到错误:

WARNING: Use "yarn jar" to launch YARN applications. 警告:使用“纱线罐”启动YARN应用程序。
Not a valid JAR: /user/maria_dev/wordcount3.jar 不是有效的JAR:/user/maria_dev/wordcount3.jar

To launch the jar i did the following steps: 要启动jar,我执行了以下步骤:

  1. Create the java classes in eclipse using maven projects. 使用Maven项目在eclipse中创建Java类。
  2. Export a runnable jar file. 导出可运行的jar文件。
  3. Load the jar into HDFS (using Ambari). 将罐子装入HDFS(使用Ambari)。
  4. Call the jar using (with root-user, also trying with and without ssh): 使用(使用root用户,也可以使用ssh和不使用ssh)调用jar:

hadoop jar /user/maria_dev/wordcount3.jar /user/maria_dev/BlackArrow.txt /user/maria_dev / hadoop jar /user/maria_dev/wordcount3.jar /user/maria_dev/BlackArrow.txt /user/maria_dev /

AND

hadoop jar /user/maria_dev/wordcount3.jar de.kja. wordcount3. wordcount /user/maria_dev/BlackArrow.txt /user/maria_dev/

In Both cases i get the error from above... 在这两种情况下,我都会从上面得到错误...

So i had the following thoughts: 所以我有以下想法:

  1. My java class has an error -> I tried diverse other examples, all do not work. 我的Java类有错误->我尝试了其他各种示例,但都无法正常工作。 But trying to run the main class of each java file as java application i get one of the following errors: 但是尝试将每个java文件的主类作为java应用程序运行时,出现以下错误之一:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at de.kja.wordcount2.wordcount.main(wordcount.java:47) 线程“主”中的异常java.lang.ArrayIndexOutOfBoundsException:de.kja.wordcount2.wordcount.main(wordcount.java:47)为0

OR 要么

Usage: WordCount [generic options] Generic options supported are -conf specify an application configuration file -D use value for given property -fs specify a namenode -jt specify a job tracker -files specify comma separated files to be copied to the map reduce cluster -libjars specify comma separated jar files to include in the classpath. 用法:WordCount [通用选项]支持的通用选项是-conf指定应用程序配置文件-D给定属性的使用值-fs指定名称节点-jt指定作业跟踪器-files指定将逗号分隔的文件复制到map减少群集-libjars指定以逗号分隔的jar文件,以包含在类路径中。 -archives specify comma separated archives to be unarchived on the compute machines. -archives指定用逗号分隔的归档文件,这些归档文件将在计算机上取消归档。 The general command line syntax is bin/hadoop command [genericOptions] [commandOptions] 常规命令行语法为bin / hadoop命令[genericOptions] [commandOptions]

  1. I read that the jar file does not have to be uploaded to the HDFS. 我读到jar文件不必上载到HDFS。 So do have to load it to the local files of the virtual box? 那么是否必须将其加载到虚拟盒的本地文件中? If yes: How can i do this? 如果是:我该怎么做?

Hadoop version: 2.7.1.2.4.0.0-169 Hadoop版本:2.7.1.2.4.0.0-169

If you need more information please ask! 如果您需要更多信息,请询问! Thank you for your help :) 谢谢您的帮助 :)

In your virtual machine, open the Linux terminal 在您的虚拟机中,打开Linux终端

su - ambari-qa su-ambari-qa

yarn jar /usr/hdp/current/hadoop-mapreduce-client/hadoop-mapreduce-examples.jar teragen 1000 /tmp/genout 纱罐/usr/hdp/current/hadoop-mapreduce-client/hadoop-mapreduce-examples.jar teragen 1000 / tmp / genout

yarn jar /usr/hdp/current/hadoop-mapreduce-client/hadoop-mapreduce-examples.jar terasort /tmp/genout /tmp/sortout 纱罐/usr/hdp/current/hadoop-mapreduce-client/hadoop-mapreduce-examples.jar terasort / tmp / genout / tmp / sortout

yarn jar /usr/hdp/current/hadoop-mapreduce-client/hadoop-mapreduce-examples.jar teravalidate /tmp/sortout /tmp/valout 纱罐/usr/hdp/current/hadoop-mapreduce-client/hadoop-mapreduce-examples.jar teravalidate / tmp / sortout / tmp / valout

This is a sample to ensure you able to run jobs from sandbox. 这是确保您能够从沙箱运行作业的示例。

you need to run your code as yarn jar .... 您需要将代码作为jar来运行....

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

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