简体   繁体   English

如何更改每个工作程序在Spark Standalone模式下使用的CPU数量?

[英]How to change the number of CPUs each worker uses in Spark Standalone mode?

I could run master and slave nodes in Spark Standalone mode on the machine with OS Windows 7, 8 cores CPU and 16 GB RAM. 我可以在具有OS Windows 7,8核CPU和16 GB RAM的机器上以Spark Standalone模式运行主节点和从节点。

Now I'm trying to change the number of workers on this machine. 现在我正在尝试改变这台机器上的工人数量。

As I read on Spark's site, launching scripts are not currently supported in Windows OS. 正如我在Spark网站上看到的那样,Windows操作系统目前不支持启动脚本。 So I start the master and workers manually. 所以我手动启动主人和工人。

In driver program I define: 在驱动程序中我定义:

SparkConf conf = new SparkConf().setAppName("myapplication")
  .setMaster("spark://fujitsu11:7077")
  .setJars(new String[] {"target/maven1-0.0.1-SNAPSHOT-driver.jar"})
  .set("spark.home","D:/spark")
  .set("spark.executor.memory", "2g")
  .set("spark.worker.instances","2")
  .set("spark.worker.cores", "4"); // I allocate four cores for each worker
JavaSparkContext sc = new JavaSparkContext(conf);

Then in Cygwin I start by hand master daemon and two workers. 然后在Cygwin,我开始手动掌握守护进程和两名工人。

But when I run my application and follow on http://localhost:8080 I see, that both workers trying to use all 8 cores... 但是,当我运行我的应用程序并按照http:// localhost:8080时,我看到,两个工作人员都试图使用所有8个核心......

在此输入图像描述

How could I change the number of cores the instances use? 我怎样才能更改实例使用的核心数量?

The number of the CPU/cores a worker uses is given as an environment variable at start time, and you could set it in two places: 工作人员使用的CPU /核心数在开始时作为环境变量给出,您可以在两个位置设置它:

  1. In conf/spark-env.sh as SPARK_WORKER_CORES . conf/spark-env.shSPARK_WORKER_CORES
  2. As an command line argument when you start a worker daemon as --cores 4 . 作为--cores 4启动工作器守护程序时的命令行参数。

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

相关问题 Spark Worker - 在独立模式下更改 web ui 主机 - Spark Worker - Change web ui host in standalone mode Spark 独立模式:有没有办法以编程方式从 Spark 的 localhost:8080 获取每个工作人员的内核/内存信息 - Spark Standalone Mode: Is there a way to programmatically get cores/memory information for each worker from Spark's localhost:8080 Spark独立模式:工作者无法在cloudera中正常启动 - Spark Standalone Mode: Worker not starting properly in cloudera Spark:如何在独立模式下设置特定于工人的SPARK_HOME - Spark: how to set worker-specific SPARK_HOME in standalone mode 如何使用start-all.sh启动使用不同SPARK_HOME(而不是Master)的独立Worker? - How to use start-all.sh to start standalone Worker that uses different SPARK_HOME (than Master)? Apache Spark独立模式:核心数量 - Apache Spark standalone mode: number of cores SPARK独立集群模式下的工作者数 - Number of workers in SPARK standalone cluster mode Spark 2.0独立模式动态资源分配工作者启动错误 - Spark 2.0 Standalone mode Dynamic Resource Allocation Worker Launch Error Spark 0.9.0:当作业失败时,工作人员在独立模式下继续死亡 - Spark 0.9.0: worker keeps dying in standalone mode when job fails Spark独立模式不将作业分发到其他工作程序节点 - Spark standalone mode not distributing job to other worker node
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM