zoukankan      html  css  js  c++  java
  • spark-submit 参数总结

    spark-submit 可以提交任务到 spark 集群执行,也可以提交到 hadoop 的 yarn 集群执行。

    1)./spark-shell --help   :不知道如何使用,可通过它查看命令帮助,[]中括号里面的表示可选的。

    2)重要参数讲解:

    --master    master 的地址,提交任务到哪里执行,例如 spark://host:port,  yarn,  local

    --name     这个是指定你的application name  应用名称。

    --jars        这个是用comma逗号分隔的一系列包含driver和executor的环境变量的包。

    --conf       这个是指定一些配置的参数。

    --driver-*   这个是指定driver的memory、class-path等。

    --executor-memory   这个是设置executor端的内存。

    --executor-core   指定executor的core资源

    --driver-core       指定driver的core资源

    --queue     生产上肯定是以队列的方式来提交的

    --num-executor   指定executor 执行者的个数

    -----------------------------------------------------------------------------

     原文:https://blog.csdn.net/qq_42064119/article/details/83038811 

    转自: https://www.cnblogs.com/weiweifeng/p/8073553.html

    1. 例子

    一个最简单的例子,部署 spark standalone 模式后,提交到本地执行。

    ./bin/spark-submit 
    --master spark://localhost:7077 
    examples/src/main/python/pi.py

    如果部署 hadoop,并且启动 yarn 后,spark 提交到 yarn 执行的例子如下。

    注意,spark 必须编译成支持 yarn 模式,编译 spark 的命令为:

    build/mvn -Pyarn -Phadoop-2.x -Dhadoop.version=2.x.x -DskipTests clean package

     其中, 2.x 为 hadoop 的版本号。编译完成后,可执行下面的命令,提交任务到 hadoop yarn 集群执行。

    ./bin/spark-submit --class org.apache.spark.examples.SparkPi 
    --master yarn
    --deploy-mode cluster
    --driver-memory 1g
    --executor-memory 1g
    --executor-cores 1
    --queue thequeue
    examples/target/scala-2.11/jars/spark-examples*.jar 10

    2. spark-submit 详细参数说明

    参数名 参数说明
    --master  master 的地址,提交任务到哪里执行,例如 spark://host:port,  yarn,  local
    --deploy-mode  在本地 (client) 启动 driver 或在 cluster 上启动,默认是 client
    --class  应用程序的主类,仅针对 java 或 scala 应用
    --name  应用程序的名称
    --jars  用逗号分隔的本地 jar 包,设置后,这些 jar 将包含在 driver 和 executor 的 classpath 下
    --packages  包含在driver 和executor 的 classpath 中的 jar 的 maven 坐标
    --exclude-packages  为了避免冲突 而指定不包含的 package
    --repositories  远程 repository
    --conf PROP=VALUE

     指定 spark 配置属性的值,

     例如 -conf spark.executor.extraJavaOptions="-XX:MaxPermSize=256m"

    --properties-file  加载的配置文件,默认为 conf/spark-defaults.conf
    --driver-memory  Driver内存,默认 1G
    --driver-java-options  传给 driver 的额外的 Java 选项
    --driver-library-path  传给 driver 的额外的库路径
    --driver-class-path  传给 driver 的额外的类路径
    --driver-cores  Driver 的核数,默认是1。在 yarn 或者 standalone 下使用
    --executor-memory  每个 executor 的内存,默认是1G
    --total-executor-cores  所有 executor 总共的核数。仅仅在 mesos 或者 standalone 下使用
    --num-executors  启动的 executor 数量。默认为2。在 yarn 下使用
    --executor-core  每个 executor 的核数。在yarn或者standalone下使用
  • 相关阅读:
    leetcode 279. Perfect Squares
    leetcode 546. Remove Boxes
    leetcode 312. Burst Balloons
    leetcode 160. Intersection of Two Linked Lists
    leetcode 55. Jump Game
    剑指offer 滑动窗口的最大值
    剑指offer 剪绳子
    剑指offer 字符流中第一个不重复的字符
    leetcode 673. Number of Longest Increasing Subsequence
    leetcode 75. Sort Colors (荷兰三色旗问题)
  • 原文地址:https://www.cnblogs.com/Allen-rg/p/10969226.html
Copyright © 2011-2022 走看看