Apache spark 首次运行后无法更改火花执行器的芯数

Apache spark 首次运行后无法更改火花执行器的芯数,apache-spark,Apache Spark,我使用spark 2.1.0,我注意到spark流应用程序中有奇怪的行为。我无法更改executor在第一次运行期间设置的内核数。应用程序在spark独立群集上运行 我第一次以这种方式运行spark流媒体应用程序 spark-submit --driver-java-options -Denv=test --master spark://my_server:6066 --deploy-mode cluster --driver-memory 3G --driver-cores 4 --exe

我使用spark 2.1.0,我注意到spark流应用程序中有奇怪的行为。我无法更改executor在第一次运行期间设置的内核数。应用程序在spark独立群集上运行

我第一次以这种方式运行spark流媒体应用程序

spark-submit --driver-java-options -Denv=test --master spark://my_server:6066 --deploy-mode cluster --driver-memory 3G  --driver-cores 4  --executor-memory 3G --executor-cores 4 --conf spark.metrics.conf=/usr/lib/spark/conf/metrics_analytics.properties --class com.MyApp hdfs:///apps/app.jar
然后我停止了我的应用程序

spark-submit --master spark://my_server:6066 --kill driver-20170807163818-0051 
我运行spark(每个执行器3个核心)

这是我的星火配置

  .setMaster(configuration.spark.master) //it is better to set master as a spark submit param
  .set("spark.cassandra.connection.host", configuration.cassandra.server)
  .set("spark.cassandra.auth.username", configuration.cassandra.user)
  .set("spark.cassandra.auth.password", configuration.cassandra.password)
  .set("spark.cassandra.connection.keep_alive_ms", configuration.cassandra.timeout.toString)
  .set("spark.streaming.backpressure.enabled", "true")
  .set("spark.streaming.kafka.maxRatePerPartition", configuration.spark.maxRatePerPartition.toString)
  .set("spark.streaming.stopGracefullyOnShutdown", "true")
  .set("spark.metrics.namespace", "my-app")
  .set("spark.cassandra.output.consistency.level", "LOCAL_QUORUM")
即使我更改executor的内核数,我的应用程序仍然使用4个内核而不是3个。 我还删除了检查点数据,但没有任何帮助

我想知道这是否仅仅是UI问题,或者我因为某种原因无法更改应用程序的配置(按应用程序名称为作业存储的一些元数据?)

这是我的

最后我解决了这个问题有两个问题导致了这个问题

  • --num执行器似乎不适用于独立集群。我不得不使用——全部执行器内核
  • 在我更改了内核的数量之后,为了进行更改,我必须清理检查点目录

  • 这个检查点对于部署应用程序、更改配置和,广播等。Ok structured streaming解决了一些问题,但仍然不是每个人都会使用此新API。

    请提供Spark UI环境选项卡的屏幕截图,以验证您是否已正确设置作业以在3个executor Core(而不是4个Core)上运行?是的,这是我的Spark UI,我面临相同的问题。如何清理检查点目录?非常感谢您提前提供的帮助。每次部署新版本的流媒体应用程序时,您都需要自己清理检查点目录
    hadoop fs-rm-r-f/checkpoint
    检查点目录由
    val ssc=new StreamingContext
    //检查点:hdfs:///checkpoint/“
    ssc.checkpoint(configuration.spark.checkpoint)//设置检查点目录
    我曾经使用fabfile脚本进行部署。更好的方法是使用Spark Job Server,但我不确定该解决方案中的清理是如何实现的。
      .setMaster(configuration.spark.master) //it is better to set master as a spark submit param
      .set("spark.cassandra.connection.host", configuration.cassandra.server)
      .set("spark.cassandra.auth.username", configuration.cassandra.user)
      .set("spark.cassandra.auth.password", configuration.cassandra.password)
      .set("spark.cassandra.connection.keep_alive_ms", configuration.cassandra.timeout.toString)
      .set("spark.streaming.backpressure.enabled", "true")
      .set("spark.streaming.kafka.maxRatePerPartition", configuration.spark.maxRatePerPartition.toString)
      .set("spark.streaming.stopGracefullyOnShutdown", "true")
      .set("spark.metrics.namespace", "my-app")
      .set("spark.cassandra.output.consistency.level", "LOCAL_QUORUM")