zoukankan      html  css  js  c++  java
  • spark-submit部署应用的相关参数详解

    a.[--master]:表示要连接的集群管理器
      spark://host:port:连接到指定端口的Spark独立集群上。默认情况下Spark 独立主节点使用7077端口
      mesos://host:port:连接到指定端口的Mesos 集群上。默认情况下Mesos 主节点监听5050端口
      yarn :连接到一个YARN 集群。当在YARN上运行时,需要设置环境变量HADOOP_CONF_DIR指向Hadoop 配置目录,以获取集群信息
      local:运行本地模式,使用单核
      local[N]:运行本地模式,使用N个核心
      local[*]:运行本地模式,使用尽可能多的核心

    b.[--deploy-mode]:选择driver驱动管理器在“client”和“cluster”运行;
      在集群管理器上,如果是“client”提交,那么驱动管理器在client运行;
      如果是“cluster”提交,那么驱动管理器在集群上运行;
      如:在spark on yarn模式下:
        在slave1节点上执行:{spark-submit --master yarn --deploy-mode client},那么spark-submit守护进程在slave1上
        在slave1节点上执行:{spark-submit --master yarn --deploy-mode cluster},那么spark-submit守护进程在nodemanger节点上
          但在{spark-shell --master yarn --deploy-mode cluster}模式下,报以下错误:
          Error: Cluster deploy mode is not applicable to Spark shells.因为spark-shell本身就是一个客户端

    c.相关属性:
    【在spsrk on yarn模式下】
      SPARK_EXECUTOR_INSTANCES, Number of executors to start (Default: 2)
        --设置exexutor(执行进程)的总数量,原则上越大越好。
      SPARK_EXECUTOR_CORES, Number of cores for the executors (Default: 1).
        --设置executor(执行进程)所需的cores(核数),cores(核数)决定Task并行度。
      SPARK_EXECUTOR_MEMORY, Memory per Executor (e.g. 1000M, 2G) (Default: 1G)
        --设置每个executor所需的内存大小;可以指定单位;
      SPARK_DRIVER_MEMORY, Memory for Driver (e.g. 1000M, 2G) (Default: 1G)
        --设置driver进程所需的内存大小
    【在spsrk Standalone模式下】
      SPARK_MASTER_HOST, to bind the master to a different IP address or hostname
        --设置Master的主机名或IP
      SPARK_MASTER_PORT / SPARK_MASTER_WEBUI_PORT, to use non-default ports for the master
        --设置Master端口号,默认为7077
      SPARK_MASTER_OPTS, to set config properties only for the master (e.g. "-Dx=y")
        --设置Master配置属性
      SPARK_WORKER_CORES, to set the number of cores to use on this machine
        --设置workerg工作节点的核数
      SPARK_WORKER_MEMORY, to set how much total memory workers have to give executors (e.g. 1000m, 2g)
        --设置给每个executor内存数大小
      SPARK_WORKER_PORT / SPARK_WORKER_WEBUI_PORT, to use non-default ports for the worker
        --设置worker节点的端口号
      SPARK_WORKER_INSTANCES, to set the number of worker processes per node
        --设置每个节点开启多少个worker进程
      SPARK_WORKER_DIR, to set the working directory of worker processes
        --设置每个worker节点的工作目录,比如:缓存操作进行Disk操作时。
      SPARK_WORKER_OPTS, to set config properties only for the worker (e.g. "-Dx=y")
        --设置Worker配置属性
      SPARK_DAEMON_MEMORY, to allocate to the master, worker and history server themselves (default: 1g).
        --设置守护进程的内存大小,默认为1G
      SPARK_HISTORY_OPTS, to set config properties only for the history server (e.g. "-Dx=y")
        --设置HISTORY配置属性
      SPARK_SHUFFLE_OPTS, to set config properties only for the external shuffle service (e.g. "-Dx=y")
        --设置SHUFFLE配置属性
      SPARK_DAEMON_JAVA_OPTS, to set config properties for all daemons (e.g. "-Dx=y")
        --设置Java守护进程配置属性
      SPARK_PUBLIC_DNS, to set the public dns name of the master or workers
        --设置DNS服务器名称

    d.[--executor-memory]
      针对当前spark-submit,设置每个executor所需的内存大小;执行器进程使用的内存量,以字节为单位。

    e.[--driver-memory]
      驱动器进程使用的内存量,以字节为单位

    案例:
      如假设一个集群有六个节点服务器(Nodemanager),每个主机的配置16内核和64G内存;
        yarn资源调度上,资源分配应如下:
        内存上:yarn.nodemanager.resource.memory-mb = 63G
        内核上:yarn.nodemanager.resource.cpu-vcores = 15
          原因:避免将100%的资源分配给Yarn容器,因为主机是需要一些资源来运行操作系统和Hadoop的守护进程;
        注明:不考虑集群中存在HBase的情况;
        那么,spark on Yarn模式。开启spark-submit应用:
          spark-submit --master yarn --deploy-mode cluster
                --num-executors 6
                --exector-cores 15
                --executor-memory 63G
      说明:分别在每个节点开启一个executor,每个executor执行任务的并行度为15,每个executor所分配的内存大小63G
      问题:1.内存开销将超出nodemanager的内存限制;
         2.ApplicationMaster(slave3)占用一个核数,在该主机节点(slave3)上将没有15个核来分配;
         3.每个执行进程15个核心,将会产生15个并行度,将对HDFS的IO吞吐量性能较差
      解决方案,如下:
        spark-submit --master yarn --deploy-mode cluster
              --num-executors 17 //确保每个节点开启三个executor(3*6=18),17+1=18(17个executor+一个driver)
              --exector-cores 5 //确保每个executor的并行度为5,HDFSIO性能
              --executor-memory 19G //计算63G/3=21G(内存数/executor个数)
        思路:executor的并行度(核数)控制在5以内,HDFSI/O性能

  • 相关阅读:
    【BZOJ4637】期望 Kruskal+矩阵树定理
    IEnumerable是什么
    (转)IIS windows认证
    使用pgrouting进行最短路径搜索
    Nginx设置防止IP及非配置域名访问
    java 调用c# web api 代码
    一台机器部署多个tomcat服务 nginx反向代理多个服务 笔记
    利用Kettle 从Excel中抽取数据写入SQLite
    sql server 统计信息
    sql server 索引碎片相关问题
  • 原文地址:https://www.cnblogs.com/lyr999736/p/10362012.html
Copyright © 2011-2022 走看看