spark第三篇:Cluster Mode Overview 集群模式预览

Spark applications run as independent sets of processes on a cluster, coordinated by the SparkContext object in your main program (called the driver program).

Specifically, to run on a cluster, the SparkContext can connect to several types of cluster managers (either Spark’s own standalone cluster manager, Mesos or YARN), which allocate resources across applications. Once connected, Spark acquires executors on nodes in the cluster, which are processes that run computations and store data for your application. Next, it sends your application code (defined by JAR or Python files passed to SparkContext) to the executors. Finally, SparkContext sends tasks to the executors to run.

                                                               

There are several useful things to note about this architecture:

1、Each application gets its own executor processes, which stay up for the duration of the whole application and run tasks in multiple threads. This has the benefit of isolating applications from each other, on both the scheduling side (each driver schedules its own tasks) and executor side (tasks from different applications run in different JVMs). However, it also means that data cannot be shared across different Spark applications (instances of SparkContext) without writing it to an external storage system.

2、Spark is agnostic to the underlying cluster manager. As long as it can acquire executor processes, and these communicate with each other, it is relatively easy to run it even on a cluster manager that also supports other applications (e.g. Mesos/YARN).

3、The driver program must listen for and accept incoming connections from its executors throughout its lifetime (e.g., see spark.driver.port in the network config section). As such, the driver program must be network addressable from the worker nodes.

4、Because the driver schedules tasks on the cluster, it should be run close to the worker nodes, preferably on the same local area network. If you’d like to send requests to the cluster remotely, it’s better to open an RPC to the driver and have it submit operations from nearby than to run a driver far away from the worker nodes.

应用程序可以使用spark-submit脚本提交。参考application submission guide

每一个驱动程序都有一个Web UI(默认4040端口),显示正在执行的任务、执行程序和存储使用等信息。可通过http://<driver-node>:4040访问该页面。参考Monitoring and Instrumentation

Spark可以跨应用程序和应用程序内进行资源分配控制。参考Job Scheduling

术语表

TermMeaning
ApplicationUser program built on Spark. Consists of a driver program and executors on the cluster.
Application jar

A jar containing the user's Spark application.

In some cases users will want to create an "uber jar" containing their application along with its dependencies.

The user's jar should never include Hadoop or Spark libraries, however, these will be added at runtime.

Driver programThe process running the main() function of the application and creating the SparkContext
Cluster managerAn external service for acquiring resources on the cluster (e.g. standalone manager, Mesos, YARN)
Deploy mode

Distinguishes where the driver process runs. In "cluster" mode, the framework launches the driver inside of the cluster.

In "client" mode, the submitter launches the driver outside of the cluster.

Worker nodeAny node that can run application code in the cluster
Executor

A process launched for an application on a worker node, that runs tasks and keeps data in memory or disk storage across them.

Each application has its own executors.

TaskA unit of work that will be sent to one executor
Job

A parallel computation consisting of multiple tasks that gets spawned in response to a Spark action (e.g. savecollect);

Stage

Each job gets divided into smaller sets of tasks called stages that depend on each other (similar to the map and reduce stages in MapReduce);

转载于:https://www.cnblogs.com/koushr/p/5873440.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值