YARN 上的 Spark:在没有 worker 的情况下执行 driver
Spark on YARN: execute driver without worker
运行 Spark on YARN,集群模式。
- 3 个带 YARN 的数据节点
- YARN => 32 个 vCore,32 GB RAM
我正在这样提交 Spark 程序:
spark-submit \
--class com.blablacar.insights.etl.SparkETL \
--name ${JOB_NAME} \
--master yarn \
--num-executors 1 \
--deploy-mode cluster \
--driver-memory 512m \
--driver-cores 1 \
--executor-memory 2g \
--executor-cores 20 \
toto.jar json
我可以看到 2 个作业在 2 个节点上 运行 正常。但我还可以看到另外 2 个工作只有一个 driver 容器!
没有worker的资源可以不运行 driver吗?
实际上,有一个设置将资源限制为 "Application Master"(对于 Spark,这是驱动程序):
yarn.scheduler.capacity.maximum-am-resource-percent
来自http://maprdocs.mapr.com/home/AdministratorGuide/Hadoop2.xCapacityScheduler-RunningPendingApps.html:
Maximum percent of resources in the cluster that can be used to run
application masters - controls the number of concurrent active
applications.
这样,YARN 就不会为 Spark 驱动占用全部资源,而为 worker 保留资源。有皮!
运行 Spark on YARN,集群模式。
- 3 个带 YARN 的数据节点
- YARN => 32 个 vCore,32 GB RAM
我正在这样提交 Spark 程序:
spark-submit \
--class com.blablacar.insights.etl.SparkETL \
--name ${JOB_NAME} \
--master yarn \
--num-executors 1 \
--deploy-mode cluster \
--driver-memory 512m \
--driver-cores 1 \
--executor-memory 2g \
--executor-cores 20 \
toto.jar json
我可以看到 2 个作业在 2 个节点上 运行 正常。但我还可以看到另外 2 个工作只有一个 driver 容器!
没有worker的资源可以不运行 driver吗?
实际上,有一个设置将资源限制为 "Application Master"(对于 Spark,这是驱动程序):
yarn.scheduler.capacity.maximum-am-resource-percent
来自http://maprdocs.mapr.com/home/AdministratorGuide/Hadoop2.xCapacityScheduler-RunningPendingApps.html:
Maximum percent of resources in the cluster that can be used to run application masters - controls the number of concurrent active applications.
这样,YARN 就不会为 Spark 驱动占用全部资源,而为 worker 保留资源。有皮!