运行 具有自定义内核数和内存大小的 Spark 应用程序
Run Spark application with custom number of cores and memory size
我对此完全陌生,所以我不太了解它的运行情况。
我需要 运行 在我的机器上启动(使用 ssh 登录)并设置 60g 内存和 6 个执行内核。
这是我试过的。
spark-submit --master yarn --deploy-mode cluster --executor-memory 60g --executor-cores 6
这就是我得到的:
SPARK_MAJOR_VERSION is set to 2, using Spark2
Exception in thread "main" java.lang.IllegalArgumentException: Missing application resource.
at org.apache.spark.launcher.CommandBuilderUtils.checkArgument(CommandBuilderUtils.java:253)
at org.apache.spark.launcher.SparkSubmitCommandBuilder.buildSparkSubmitArgs(SparkSubmitCommandBuilder.java:160)
at org.apache.spark.launcher.SparkSubmitCommandBuilder.buildSparkSubmitCommand(SparkSubmitCommandBuilder.java:276)
at org.apache.spark.launcher.SparkSubmitCommandBuilder.buildCommand(SparkSubmitCommandBuilder.java:151)
at org.apache.spark.launcher.Main.main(Main.java:87)
所以,我想 运行ning 的代码行中需要添加一些内容,但我不知道是什么。
此处:
spark-submit --master yarn --deploy-mode cluster --executor-memory 60g --executor-cores 6
您没有指定入口点和您的应用程序!
查看 spark-submit 文档,其中指出:
一些常用的选项是:
--class:您的应用程序的入口点(例如org.apache.spark.examples.SparkPi)
--master:集群的master URL (e.g. spark://23.195.26.187:7077)
--deploy-mode:是将你的驱动程序部署在worker节点(集群)上还是本地部署为外部客户端(client)(默认:client)
†
--conf: 任意 Spark 配置 属性 key=value 格式。对于包含空格的值,将“key=value”括在引号中(如图所示)。
application-jar:包含您的应用程序和
所有依赖项。 URL 必须在您的内部全局可见
集群,例如,一个 hdfs:// 路径或一个 file:// 路径
出现在所有节点上。
application-arguments:传递给您的主要方法的参数
主要class,如果有的话
对于 Python 应用程序,只需传递一个 .py 文件代替 <application-jar>
而不是 JAR,然后将 Python .zip、.egg 或 .py 文件添加到--py-files
.
的搜索路径
这是一个包含一些 JAR 和 python 文件的示例(为简单起见,我没有包含您的其他参数):
./spark-submit --jars myjar1.jar,myjar2.jar --py-files path/to/my/main.py arg1 arg2
I hope I can entry to spark shell (with that much memory and cores) and type code in there
那么你需要pyspark
,而不是spark-submit
! What is the difference between spark-submit and pyspark?
所以你真正想做的是:
pyspark --master yarn --deploy-mode cluster --executor-memory 60g --executor-cores 6
如果我没看错你的问题,你的内核总数=6,总内存为60GB。参数
--executor-memory
--executor-cores
实际上是针对 spark 中的每个执行者。也许你应该试试
--执行器-内存8G
--executor-cores 1
这将创建大约 6 个 8Gb 的执行器(总共 6*8 = 48GB)。其余 12 GB 用于操作系统处理和元数据。
我对此完全陌生,所以我不太了解它的运行情况。 我需要 运行 在我的机器上启动(使用 ssh 登录)并设置 60g 内存和 6 个执行内核。 这是我试过的。
spark-submit --master yarn --deploy-mode cluster --executor-memory 60g --executor-cores 6
这就是我得到的:
SPARK_MAJOR_VERSION is set to 2, using Spark2
Exception in thread "main" java.lang.IllegalArgumentException: Missing application resource.
at org.apache.spark.launcher.CommandBuilderUtils.checkArgument(CommandBuilderUtils.java:253)
at org.apache.spark.launcher.SparkSubmitCommandBuilder.buildSparkSubmitArgs(SparkSubmitCommandBuilder.java:160)
at org.apache.spark.launcher.SparkSubmitCommandBuilder.buildSparkSubmitCommand(SparkSubmitCommandBuilder.java:276)
at org.apache.spark.launcher.SparkSubmitCommandBuilder.buildCommand(SparkSubmitCommandBuilder.java:151)
at org.apache.spark.launcher.Main.main(Main.java:87)
所以,我想 运行ning 的代码行中需要添加一些内容,但我不知道是什么。
此处:
spark-submit --master yarn --deploy-mode cluster --executor-memory 60g --executor-cores 6
您没有指定入口点和您的应用程序!
查看 spark-submit 文档,其中指出:
一些常用的选项是:
--class:您的应用程序的入口点(例如org.apache.spark.examples.SparkPi)
--master:集群的master URL (e.g. spark://23.195.26.187:7077)
--deploy-mode:是将你的驱动程序部署在worker节点(集群)上还是本地部署为外部客户端(client)(默认:client) †
--conf: 任意 Spark 配置 属性 key=value 格式。对于包含空格的值,将“key=value”括在引号中(如图所示)。
application-jar:包含您的应用程序和 所有依赖项。 URL 必须在您的内部全局可见 集群,例如,一个 hdfs:// 路径或一个 file:// 路径 出现在所有节点上。
application-arguments:传递给您的主要方法的参数 主要class,如果有的话
对于 Python 应用程序,只需传递一个 .py 文件代替 <application-jar>
而不是 JAR,然后将 Python .zip、.egg 或 .py 文件添加到--py-files
.
这是一个包含一些 JAR 和 python 文件的示例(为简单起见,我没有包含您的其他参数):
./spark-submit --jars myjar1.jar,myjar2.jar --py-files path/to/my/main.py arg1 arg2
I hope I can entry to spark shell (with that much memory and cores) and type code in there
那么你需要pyspark
,而不是spark-submit
! What is the difference between spark-submit and pyspark?
所以你真正想做的是:
pyspark --master yarn --deploy-mode cluster --executor-memory 60g --executor-cores 6
如果我没看错你的问题,你的内核总数=6,总内存为60GB。参数
--executor-memory
--executor-cores
实际上是针对 spark 中的每个执行者。也许你应该试试
--执行器-内存8G --executor-cores 1 这将创建大约 6 个 8Gb 的执行器(总共 6*8 = 48GB)。其余 12 GB 用于操作系统处理和元数据。