当前位置: 首页 > 知识库问答 >
问题:

无法在HDP 2.0上运行Spark 1.0 SparkPi

邬博涉
2023-03-14
 ./bin/spark-submit --class org.apache.spark.examples.SparkPi     --master yarn-cluster --num-executors 3 --driver-memory 2g --executor-memory 2g --executor-cores 1 ./lib/spark-examples-1.0.0-hadoop2.2.0.jar 2

我有错误:

应用程序application_1404470405736_0044失败3次,原因是appattempt_1404470405736_0044_000003的容器退出,退出代码:1原因是:容器异常-启动:org.apache.hadoop.util.shell$exitcodeexception:在org.apache.hadoop.util.shell.runcommand(shell.java:464)在org.apache.hadoop.util.shell.run(shell.java:379)在org.apache.hadoop.util.shell$shellcommandexecutor.execute(shell.java:589)在)在java.lang.Thread.Run(Thread.java:744)处。如果尝试失败。应用程序失败。

未知/不支持的参数列表(--executor-memory,2048,--executor-cores,1,--num-executors,3)用法:org.apache.spark.deploy.yarn.applicationmaster[options]选项:
--JAR JAR_PATH应用程序JAR文件的路径(必需)--class CLASS_NAME应用程序主类的名称(必需)...bla-bla-bla

有什么想法吗?我怎么才能让它起作用呢?

共有1个答案

澹台新知
2023-03-14

我也有同样的问题。原因是hdfs中的spark-assembly.jar版本与当前的spark版本不同。

例如,org.apache.spark.deploy.yarn.client在hdfs版本中的params列表:

  $ hadoop jar ./spark-assembly.jar  org.apache.spark.deploy.yarn.Client --help
Usage: org.apache.spark.deploy.yarn.Client [options] 
Options:
  --jar JAR_PATH             Path to your application's JAR file (required in yarn-cluster mode)
  --class CLASS_NAME         Name of your application's main class (required)
  --args ARGS                Arguments to be passed to your application's main class.
                             Mutliple invocations are possible, each will be passed in order.
  --num-workers NUM          Number of workers to start (Default: 2)
  --worker-cores NUM         Number of cores for the workers (Default: 1). This is unsused right now.
  --master-class CLASS_NAME  Class Name for Master (Default: spark.deploy.yarn.ApplicationMaster)
  --master-memory MEM        Memory for Master (e.g. 1000M, 2G) (Default: 512 Mb)
  --worker-memory MEM        Memory per Worker (e.g. 1000M, 2G) (Default: 1G)
  --name NAME                The name of your application (Default: Spark)
  --queue QUEUE              The hadoop queue to use for allocation requests (Default: 'default')
  --addJars jars             Comma separated list of local jars that want SparkContext.addJar to work with.
  --files files              Comma separated list of files to be distributed with the job.
  --archives archives        Comma separated list of archives to be distributed with the job.

和最新安装的spark-assembly jar文件的相同帮助:

$ hadoop jar ./spark-assembly-1.0.0-cdh5.1.0-hadoop2.3.0-cdh5.1.0.jar org.apache.spark.deploy.yarn.Client
Usage: org.apache.spark.deploy.yarn.Client [options] 
Options:
  --jar JAR_PATH             Path to your application's JAR file (required in yarn-cluster mode)
  --class CLASS_NAME         Name of your application's main class (required)
  --arg ARGS                 Argument to be passed to your application's main class.
                             Multiple invocations are possible, each will be passed in order.
  --num-executors NUM        Number of executors to start (Default: 2)
  --executor-cores NUM       Number of cores for the executors (Default: 1).
  --driver-memory MEM        Memory for driver (e.g. 1000M, 2G) (Default: 512 Mb)
  --executor-memory MEM      Memory per executor (e.g. 1000M, 2G) (Default: 1G)
  --name NAME                The name of your application (Default: Spark)
  --queue QUEUE              The hadoop queue to use for allocation requests (Default: 'default')
  --addJars jars             Comma separated list of local jars that want SparkContext.addJar to work with.
  --files files              Comma separated list of files to be distributed with the job.
  --archives archives        Comma separated list of archives to be distributed with the job.

因此,我将Spark-Assembly.jar更新为hdfs,spark开始很好地工作

 类似资料:
  • 问题内容: 以下代码可在实时站点上运行,但无法在jsfiddle站点上运行。 谁能告诉我为什么它在jsfiddle上不起作用? 在控制台上,它记录:和。 您将代码作为片段嵌入此处时,可以看到该代码的工作原理: 问题答案: 您定义的函数是在onload函数中定义的,因此在它们被引用之前,因为它们是在该函数中定义的,所以只能在该函数中引用它们。您在HTML中将它们称为全局变量。您有三种选择 a)(最简

  • 问题内容: 我在Windows上有一个基本的webserver hello world应用程序,可用于Windows上的nodejs,它可在localhost上运行。但是,当我从互联网测试它时,它无法连接。我在netgear路由器中设置了端口转发。我是否在这里缺少使我的nodejs服务器对外界可见的步骤? 谢谢。 问题答案: 确保您聆听而不是 是仅对您的计算机可见的专用网络。 侦听所有接口,包括私

  • 问题内容: 我正在尝试在Ubuntu终端上运行javac。但是我得到以下信息: JDK已经安装并运行说 我的jdk安装在/ usr / lib / jvm / java-6-open- jdk中;而且我能够从Eclipse编译并运行Java程序。但是在使用终端时遇到了上述问题。 问题答案: 该二进制(可能其他的Java二进制文件)是/不是您的用户环境变量。有几种解决方法: 添加到用户的环境变量。您

  • 问题内容: 所以我最近一直在C9上使用Node.js,并在一个javascript文件中遇到了这个问题: 这是我的代码: 我更新了所有依赖关系以及Node本身,但仍然遇到此问题。有人知道怎么回事吗? 问题答案: 我面临着同样的问题。正在网上寻找解决方案。事实证明,jsdom自v10以来已更新了一些功能。因此,我想在快速应用程序的Node.js端使用jQuery,并且必须像下面这样进行操作: 从v1

  • 根据Maven的发布历史,应该可以在JDK7上运行Maven的任何最新版本(在编写本文时)。但是,当我在Ubuntu21.04机器上尝试这样做时,我得到了一个错误:。 即使在不包含任何Java文件或文件的目录中运行而没有任何参数时也会发生这种情况。 Maven信息: (我还安装了Zulu1.7.292和OpenJDK;那里的行为是相同的。)

  • 问题内容: 我正试图让nvidia-docker在我的centos7系统上运行: 到目前为止,一切都很好: 现在,让我们尝试使用nvidia运行时: 但是奇怪的是 问题答案: 所以…最后,我完全禁用了selinux并重新启动,并对其进行了修复。

  • 我的应用程序在Android 6上崩溃, 调用时,我正在使用带有自定义适配器的改型:方法不工作 问题出在哪里?