gpt4 book ai didi

apache-spark - Apache Spark : Differences between client and cluster deploy modes

转载 作者:可可西里 更新时间:2023-11-01 15:50:20 25 4
gpt4 key购买 nike

TL;DR:在 Spark Standalone 集群中,客户端和集群部署模式有何区别?如何设置我的应用程序要运行的模式?


我们有一个包含三台机器的 Spark Standalone 集群,它们都装有 Spark 1.6.1:

  • 一台主机,也是我们使用 spark-submit
  • 运行我们的应用程序的地方
  • 2台相同的worker机器

来自Spark Documentation ,我读到:

(...) For standalone clusters, Spark currently supports two deploy modes. In client mode, the driver is launched in the same process as the client that submits the application. In cluster mode, however, the driver is launched from one of the Worker processes inside the cluster, and the client process exits as soon as it fulfills its responsibility of submitting the application without waiting for the application to finish.

但是,我并没有真正理解阅读本文的实际差异,也不知道不同部署模式的优点和缺点是什么。

此外,当我使用 start-submit 启动我的应用程序时,即使我将属性 spark.submit.deployMode 设置为“cluster”,我的上下文的 Spark UI 也会显示以下条目:

Context UI

所以我无法测试这两种模式以查看实际差异。话虽如此,我的问题是:

1) Spark Standalone client 部署模式和cluster 部署模式之间的实际区别是什么?使用每种方法的优缺点是什么?

2) 如何使用 spark-submit 选择我的应用程序将在哪一个上运行?

最佳答案

What are the practical differences between Spark Standalone client deploy mode and cluster deploy mode? What are the pro's and con's of using each one?

让我们试着看看客户端模式和集群模式之间的区别。

客户:

  • 驱动程序在专用进程内的专用服务器(主节点)上运行。这意味着它拥有执行工作所需的所有可用资源。
  • Driver 开启一个专用的 Netty HTTP 服务器,并将指定的 JAR 文件分发给所有 Worker 节点(大优势)。
  • 因为 Master 节点有自己的专用资源,所以您不需要为 Driver 程序“花费”worker 资源。
  • 如果驱动程序进程终止,您需要一个外部监控系统来重置它的执行。

集群:

  • Driver 在集群的一个 Worker 节点上运行。 worker 由Master领导选择
  • Driver 作为专用的独立进程在 Worker 中运行
  • 驱动程序占用至少 1 个核心和来自其中一名工作人员的专用内存量(这可以配置)。
  • 可以使用 --supervise 标志从主节点监控驱动程序,并在它死亡时重置。
  • 在集群模式下工作时,与应用程序执行相关的所有 JAR 都需要对所有工作人员公开可用。这意味着您可以手动将它们放在共享位置或每个工作人员的文件夹中。

哪个更好?不确定,这实际上是供您试验和决定的。这不是更好的决定,您可以从前者和后者中获益,由您决定哪个更适合您的用例。

How to I choose which one my application is going to be running on, using spark-submit

选择运行模式的方法是使用 --deploy-mode 标志。来自Spark Configuration页:

/bin/spark-submit \
--class <main-class>
--master <master-url> \
--deploy-mode <deploy-mode> \
--conf <key>=<value> \
... # other options
<application-jar> \
[application-arguments]

关于apache-spark - Apache Spark : Differences between client and cluster deploy modes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50333808/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com