Spark master

Spark master DEFAULT

Whats the exact use of apache spark master server in spark cluster ?

Spark master in YARN mode is the YARN itself, master server is relevant in standalone or Media operation.

There are two deploy modes that can be used to launch Spark applications on YARN. In mode, the Spark driver runs inside an application master process which is managed by YARN on the cluster, and the client can go away after initiating the application. In mode, the driver runs in the client process, and the application master is only used for requesting resources from YARN.

Unlike Spark standalone and Mesos modes, in which the master’s address is specified in the parameter, in YARN mode the ResourceManager’s address is picked up from the Hadoop configuration. Thus, the parameter is .

https://spark.apache.org/docs/latest/running-on-yarn.html

https://spark.apache.org/docs/latest/submitting-applications.html

Diagram of execution https://spark.apache.org/docs/latest/img/cluster-overview.png

Sours: https://community.cloudera.com/t5/Support-Questions/Whats-the-exact-use-of-apache-spark-master-server-in-spark/td-p/111574

Spark Master Tape

Spark Master Tape is the pseudonym of an anonymous rapper. He has released five mixtapes since 2012 with an announced sixth tape releasing sometime in the future. These albums have garnered interest from blogs and music websites such as Mass Appeal Magazine, passionweiss.com, The Daily Dot,[1]Noisey.Vice,[2]Complex,[3]DJBooth,[4] and The Fader,[5] to name a few. All of his beats are produced by Paper Platoon, which is also the name of his unique collective that includes visual artists and musicians.[6]

Spark Master Tape's second mixtape, 2013's The #SWOUP Serengeti, was described by Mishka NYC as, "enough bump and 808s to satisfy y'all that think Juicy J is god and enough verbal dexterity to have everyone that misses the old days of rappity rapping."[7] Masking his voice by pitching it down and sampling everything from 2pac to rare soul, Spark Master Tape has been described as "a gimmick, a sonic choice, or something in-between."

In 2014, Spark Master Tape became unresponsive. His Twitter, Facebook, and Instagram had been abandoned. There was no information about Spark's whereabouts. The rest of the Paper Platoon collective were also gone. Rumors circulated that he may be in prison, but were never plausibly confirmed nor denied. No official word was given by anyone in Paper Platoon.

On January 25, 2016, after about two years since his mysterious disappearance, Spark Master Tape tweeted "#SWOUP". This was the first communication from Spark since 2014. A week or so later, a video was posted to the official Spark Master Tape YouTube and Facebook, which showed a small group of people, filmed in black and white, wearing strange masks. At the end of this video, which was titled "SUNKKEN", words appear on the screen that say "Silhouette of a Sunkken City" and "March". This is in reference to his long-awaited third album, Silhouette of a Sunkken City. He then released his first song since his return, "Livin' Lavish", on February 19. The music video for "Livin' Lavish" was released on February 23. In an interview with The Fader explaining his new video and sudden return, Spark Master Tape said, "2016 the year of that sewage and garbage, we out here militant and ignorant. Schemin' on everybody with a hoverboard and a dream. Shout out to DJ Charlie holdin' shit down like he back to baptizing. We out the ocean, ready. In the name of Spark, the Paper Platoon and the holy #SWOUP; we shall rise."[8] On March 29, after a short period of silence, fans received a brand new #SWOUP visual "Tenkkeys". In an interview with Complex, the Paper Platoon General said "It all started with some SWOUP and a hand grenade, five years later we swimmin' out the case like Polly Pocket lookin' for a place to park this 2106 Lada. We on that 3-6-5, cash grab with a chance of voluntary manslaughter. #SWOUP". On the same premiere, it was announced that Spark's third album would drop April 15.[9]

It was announced in October 2016 that Spark Master Tape would be opening for Run the Jewels on their Run the World Tour,[10] though in January 2017 it was announced that they would have to pull out of the remaining tour dates due to unspecified "legalities" out of their control.[11]

In late 2017, Spark Master Tape introduced Flmmboiint Frdii, a new artist that is featured in his fifth EP "Seven Sekkonds of Silence".[12]

In mid 2018, Spark Master Tape tweeted about and released new songs that will be on his new upcoming EP.[13]

On February 14, 2020, Spark Master Tape was featured in two songs, Go Bananas and Gasoline Pt 2, on Baby Gravy 2, a collaborative album between rappers Yung Gravy and bbno$.[14]

Discography[edit]

  • Syrup Splash (2012)
  • The #SWOUP Serengeti (2013)
  • Silhouette of a Sunkken City (2016)
  • The Lost Grapes EP (2017)
  • Seven Sekkonds of Silence (2018)
  • TBA (2021)

References[edit]

Sours: https://en.wikipedia.org/wiki/Spark_Master_Tape
  1. Pentominoes hundreds chart
  2. Wow classic population
  3. Marine mos list 2020
  4. Lifeguard jobs miami beach

results matching ""

Standalone Master

A standalone Master is pretty much the Master RPC Endpoint that you can access using RPC port (low-level operation communication) or Web UI.

Application ids follows the pattern .

Master keeps track of the following:

  • workers ()

  • mapping between ids and applications ()

  • waiting applications ()

  • applications ()

  • mapping between ids and workers ()

  • mapping between RPC address and workers ()

  • mapping between application ids and their Web UIs ()

  • drivers ()

  • drivers currently spooled for scheduling ()

The following INFO shows up when the Master endpoint starts up ( is called):

Master WebUI

is the Web UI server for the standalone master. Master starts Web UI to listen to , e.g. .

States

Master can be in the following states:

  • - the initial state while Master is initializing

  • - start scheduling resources among applications.

RPC Environment

It then registers endpoint.

sparkMaster rpcenv.png

Figure 1. sparkMaster - the RPC Environment for Spark Standalone’s master

The Master endpoint starts the daemon single-thread scheduler pool . It is used for worker management, i.e. removing any timed-out workers.

Metrics

The name of the source is master.

It emits the following metrics:

  • - the number of all workers (any state)

  • - the number of alive workers

  • - the number of applications

  • - the number of waiting applications

The name of the other source is applications

Caution

  • Review

  • How to access the metrics for master? See

  • Review and

REST Server

is the client.

The server includes a JSON representation of in the HTTP body.

The following INFOs show up when the Master Endpoint starts up ( is called) with REST Server enabled:

Recovery Mode

A standalone Master can run with recovery mode enabled and be able to recover state among the available swarm of masters. By default, there is no recovery, i.e. no persistence and no election.

Note

Only a master can schedule tasks so having one always on is important for cases where you want to launch new tasks. Running tasks are unaffected by the state of the master.

Leader Election

Master endpoint is , i.e. FIXME

RPC Messages

Master communicates with drivers, executors and configures itself using RPC messages.

The following message types are accepted by master (see or methods):

  • for Leader Election

  • RegisterApplication

RegisterApplication event

A RegisterApplication event is sent by AppClient to the standalone Master. The event holds information about the application being deployed () and the driver’s endpoint reference.

describes an application by its name, maximum number of cores, executor’s memory, command, appUiUrl, and user with optional eventLogDir and eventLogCodec for Event Logs, and the number of cores per executor.

A standalone Master receives with a and the driver’s .

Application ids in Spark Standalone are in the format of .

Master keeps track of the number of already-scheduled applications ().

ApplicationDescription (AppClient) -→ ApplicationInfo (Master) - application structure enrichment

metrics +

Caution

FIXME

schedules the currently available resources among waiting apps.

FIXME When is method called?

It’s only executed when the Master is in state.

Worker in state can accept applications.

A driver has a state, i.e. and when it’s in state the driver has been assigned to a worker for execution.

LaunchDriver RPC message

Warning

It seems a dead message. Disregard it for now.

A LaunchDriver message is sent by an active standalone Master to a worker to launch a driver.

spark standalone master worker LaunchDriver.png

Figure 2. Master finds a place for a driver (posts LaunchDriver)

You should see the following INFO in the logs right before the message is sent out to a worker:

The message holds information about the id and name of the driver.

A driver can be running on a single worker while a worker can have many drivers running.

When a worker receives a message, it prints out the following INFO:

It then creates a and starts it. It starts a separate JVM process.

Workers' free memory and cores are considered when assigning some to waiting drivers (applications).

Caution

FIXME Go over …​

DriverRunner

Warning

It seems a dead piece of code. Disregard it for now.

A manages the execution of one driver.

It is a

When started, it spawns a thread that:

  1. Creates the working directory for this driver.

  2. Downloads the user jar FIXME

  3. Substitutes variables like or that are set when…​FIXME

Internals of org.apache.spark.deploy.master.Master

Tip

You can debug a Standalone master using the following command:

The above command suspends () the process until a JPDA debugging client, e.g. your IDE, is connected, and that Spark is available under . Change it to meet your environment.

A fully-configured master instance requires , (default: ), (default: ) settings defined.

It starts RPC Environment with necessary endpoints and lives until the RPC environment terminates.

Worker Management

Master uses to schedule a thread every to check workers' availability and remove timed-out workers.

It is that Master sends message to itself to trigger verification.

When a worker hasn’t responded for , it is assumed dead and the following WARN message appears in the logs:

System Environment Variables

Master uses the following system environment variables (directly or indirectly):

  • - the custom host name

  • - the custom IP to use when is not set

  • (not as used in script above!) - the master custom host

  • (default: ) - the master custom port

  • (default: command’s output)

  • (default: ) - the port of the master’s WebUI. Overriden by if set in the properties file.

  • (default: hostname) - the custom master hostname for WebUI’s http URL and master’s address.

  • (default: ) - the directory of the default properties file spark-defaults.conf from which all properties that start with prefix are loaded.

Settings

Caution

  • Where are `RETAINED_’s properties used?

Master uses the following properties:

  • (default: ) - total expected number of cores. When set, an application could get executors of different sizes (in terms of cores).

  • (default: ) - time (in seconds) when no heartbeat from a worker means it is lost. See Worker Management.

  • (default: )

  • (default: )

  • (default: )

  • (default: ) - possible modes: , , or . Refer to Recovery Mode.

  • - the class name of the custom .

  • (default: empty) - the directory to persist recovery state

  • spark.deploy.spreadOut to perform round-robin scheduling across the nodes.

  • (default: , i.e. unbounded)- the number of maxCores for applications that don’t specify it.

  • (default: ) - master’s REST Server for alternative application submission that is supposed to work across Spark versions.

  • (default: ) - the port of master’s REST Server

Sours: https://mallikarjuna_g.gitbooks.io/spark/spark-standalone-master.html

How Applications are Executed on a Spark Cluster

Before you begin your journey as a Spark programmer, you should have a solid understanding of the Spark application architecture and how applications are executed on a Spark cluster. This chapter closely examines the components of a Spark application, looks at how these components work together, and looks at how Spark applications run on Standalone and YARN clusters.

Save 35% off the list price* of the related book or multi-format eBook (EPUB + MOBI + PDF) with discount code ARTICLE.
* See informit.com/terms

This chapter is from the book 
  • It is not the beauty of a building you should look at; it’s the construction of the foundation that will stand the test of time.

    David Allan Coe, American songwriter

In This Chapter:

  • Detailed overview of the Spark application and cluster components

  • Spark resource schedulers and Cluster Managers

  • How Spark applications are scheduled on YARN clusters

  • Spark deployment modes

Before you begin your journey as a Spark programmer, you should have a solid understanding of the Spark application architecture and how applications are executed on a Spark cluster. This chapter closely examines the components of a Spark application, looks at how these components work together, and looks at how Spark applications run on Standalone and YARN clusters.

Anatomy of a Spark Application

A Spark application contains several components, all of which exist whether you’re running Spark on a single machine or across a cluster of hundreds or thousands of nodes.

Each component has a specific role in executing a Spark program. Some of these roles, such as the client components, are passive during execution; other roles are active in the execution of the program, including components executing computation functions.

The components of a Spark application are the Driver, the Master, the Cluster Manager, and the Executor(s), which run on worker nodes, or Workers. Figure 3.1 shows all the Spark components in the context of a Spark Standalone application. You will learn more about each component and its function in more detail later in this chapter.

Figure 3.1

Figure 3.1 Spark Standalone cluster application components.

All Spark components, including the Driver, Master, and Executor processes, run in Java virtual machines (JVMs). A JVM is a cross-platform runtime engine that can execute instructions compiled into Java bytecode. Scala, which Spark is written in, compiles into bytecode and runs on JVMs.

It is important to distinguish between Spark’s runtime application components and the locations and node types on which they run. These components run in different places using different deployment modes, so don’t think of these components in physical node or instance terms. For instance, when running Spark on YARN, there would be several variations of Figure 3.1. However, all the components pictured are still involved in the application and have the same roles.

Spark Driver

The life of a Spark application starts and finishes with the Spark Driver. The Driver is the process that clients use to submit applications in Spark. The Driver is also responsible for planning and coordinating the execution of the Spark program and returning status and/or results (data) to the client. The Driver can physically reside on a client or on a node in the cluster, as you will see later.

SparkSession

The Spark Driver is responsible for creating the SparkSession. The SparkSession object represents a connection to a Spark cluster. The SparkSession is instantiated at the beginning of a Spark application, including the interactive shells, and is used for the entirety of the program.

Prior to Spark 2.0, entry points for Spark applications included the SparkContext, used for Spark core applications; the SQLContext and HiveContext, used with Spark SQL applications; and the StreamingContext, used for Spark Streaming applications. The SparkSession object introduced in Spark 2.0 combines all these objects into a single entry point that can be used for all Spark applications.

Through its SparkContext and SparkConf child objects, the SparkSession object contains all the runtime configuration properties set by the user, including configuration properties such as the Master, application name, number of Executors, and more. Figure 3.2 shows the SparkSession object and some of its configuration properties within a shell.

Listing 3.1 demonstrates how to create a SparkSession within a non-interactive Spark application, such as a program submitted using .

Listing 3.1 Creating a SparkSession

Application Planning

One of the main functions of the Driver is to plan the application. The Driver takes the application processing input and plans the execution of the program. The Driver takes all the requested transformations (data manipulation operations) and actions (requests for output or prompts to execute programs) and creates a directed acyclic graph (DAG) of nodes, each representing a transformational or computational step.

A Spark application DAG consists of tasks and stages. A task is the smallest unit of schedulable work in a Spark program. A stage is a set of tasks that can be run together. Stages are dependent upon one another; in other words, there are stage dependencies.

In a process scheduling sense, DAGs are not unique to Spark. For instance, they are used in other Big Data ecosystem projects, such as Tez, Drill, and Presto for scheduling. DAGs are fundamental to Spark, so it is worth being familiar with the concept.

Application Orchestration

The Driver also coordinates the running of stages and tasks defined in the DAG. Key driver activities involved in the scheduling and running of tasks include the following:

  • Keeping track of available resources to execute tasks

  • Scheduling tasks to run “close” to the data where possible (the concept of data locality)

Other Functions

In addition to planning and orchestrating the execution of a Spark program, the Driver is also responsible for returning the results from an application. These could be return codes or data in the case of an action that requests data to be returned to the client (for example, an interactive query).

The Driver also serves the application UI on port 4040, as shown in Figure 3.3. This UI is created automatically; it is independent of the code submitted or how it was submitted (that is, interactive using or non-interactive using ).

If subsequent applications launch on the same host, successive ports are used for the application UI (for example, 4041, 4042, and so on).

Spark Workers and Executors

Spark Executors are the processes on which Spark DAG tasks run. Executors reserve CPU and memory resources on slave nodes, or Workers, in a Spark cluster. An Executor is dedicated to a specific Spark application and terminated when the application completes. A Spark program normally consists of many Executors, often working in parallel.

Typically, a Worker node—which hosts the Executor process—has a finite or fixed number of Executors allocated at any point in time. Therefore, a cluster—being a known number of nodes—has a finite number of Executors available to run at any given time. If an application requires Executors in excess of the physical capacity of the cluster, they are scheduled to start as other Executors complete and release their resources.

As mentioned earlier in this chapter, JVMs host Spark Executors. The JVM for an Executor is allocated a heap, which is a dedicated memory space in which to store and manage objects. The amount of memory committed to the JVM heap for an Executor is set by the property  or as the argument to the , , or commands.

Executors store output data from tasks in memory or on disk. It is important to note that Workers and Executors are aware only of the tasks allocated to them, whereas the Driver is responsible for understanding the complete set of tasks and the respective dependencies that comprise an application.

By using the Spark application UI on port 404x of the Driver host, you can inspect Executors for the application, as shown in Figure 3.4.

Figure 3.4

Figure 3.4 Executors tab in the Spark application UI.

For Spark Standalone cluster deployments, a worker node exposes a user interface on port 8081, as shown in Figure 3.5.

The Spark Master and Cluster Manager

The Spark Driver plans and coordinates the set of tasks required to run a Spark application. The tasks themselves run in Executors, which are hosted on Worker nodes.

The Master and the Cluster Manager are the central processes that monitor, reserve, and allocate the distributed cluster resources (or containers, in the case of YARN or Mesos) on which the Executors run. The Master and the Cluster Manager can be separate processes, or they can combine into one process, as is the case when running Spark in Standalone mode.

Spark Master

The Spark Master is the process that requests resources in the cluster and makes them available to the Spark Driver. In all deployment modes, the Master negotiates resources or containers with Worker nodes or slave nodes and tracks their status and monitors their progress.

When running Spark in Standalone mode, the Spark Master process serves a web UI on port 8080 on the Master host, as shown in Figure 3.6.

Cluster Manager

The Cluster Manager is the process responsible for monitoring the Worker nodes and reserving resources on these nodes upon request by the Master. The Master then makes these cluster resources available to the Driver in the form of Executors.

As discussed earlier, the Cluster Manager can be separate from the Master process. This is the case when running Spark on Mesos or YARN. In the case of Spark running in Standalone mode, the Master process also performs the functions of the Cluster Manager. Effectively, it acts as its own Cluster Manager.

A good example of the Cluster Manager function is the YARN ResourceManager process for Spark applications running on Hadoop clusters. The ResourceManager schedules, allocates, and monitors the health of containers running on YARN NodeManagers. Spark applications then use these containers to host Executor processes, as well as the Master process if the application is running in mode; we will look at this shortly.

Sours: https://www.informit.com/articles/article.aspx?p=2928186

Master spark

Spark Standalone Mode

In addition to running on the Mesos or YARN cluster managers, Spark also provides a simple standalone deploy mode. You can launch a standalone cluster either manually, by starting a master and workers by hand, or use our provided launch scripts. It is also possible to run these daemons on a single machine for testing.

Security in Spark is OFF by default. This could mean you are vulnerable to attack by default. Please see Spark Security and the specific security sections in this doc before running Spark.

To install Spark Standalone mode, you simply place a compiled version of Spark on each node on the cluster. You can obtain pre-built versions of Spark with each release or build it yourself.

You can start a standalone master server by executing:

Once started, the master will print out a URL for itself, which you can use to connect workers to it, or pass as the “master” argument to . You can also find this URL on the master’s web UI, which is http://localhost:8080 by default.

Similarly, you can start one or more workers and connect them to the master via:

Once you have started a worker, look at the master’s web UI (http://localhost:8080 by default). You should see the new node listed there, along with its number of CPUs and memory (minus one gigabyte left for the OS).

Finally, the following configuration options can be passed to the master and worker:

ArgumentMeaning
, Hostname to listen on
, Hostname to listen on (deprecated, use -h or --host)
, Port for service to listen on (default: 7077 for master, random for worker)
Port for web UI (default: 8080 for master, 8081 for worker)
, Total CPU cores to allow Spark applications to use on the machine (default: all available); only on worker
, Total amount of memory to allow Spark applications to use on the machine, in a format like 1000M or 2G (default: your machine's total RAM minus 1 GiB); only on worker
, Directory to use for scratch space and job output logs (default: SPARK_HOME/work); only on worker
Path to a custom Spark properties file to load (default: conf/spark-defaults.conf)

To launch a Spark standalone cluster with the launch scripts, you should create a file called conf/workers in your Spark directory, which must contain the hostnames of all the machines where you intend to start Spark workers, one per line. If conf/workers does not exist, the launch scripts defaults to a single machine (localhost), which is useful for testing. Note, the master machine accesses each of the worker machines via ssh. By default, ssh is run in parallel and requires password-less (using a private key) access to be setup. If you do not have a password-less setup, you can set the environment variable SPARK_SSH_FOREGROUND and serially provide a password for each worker.

Once you’ve set up this file, you can launch or stop your cluster with the following shell scripts, based on Hadoop’s deploy scripts, and available in :

  • - Starts a master instance on the machine the script is executed on.
  • - Starts a worker instance on each machine specified in the file.
  • - Starts a worker instance on the machine the script is executed on.
  • - Starts both a master and a number of workers as described above.
  • - Stops the master that was started via the script.
  • - Stops all worker instances on the machine the script is executed on.
  • - Stops all worker instances on the machines specified in the file.
  • - Stops both the master and the workers as described above.

Note that these scripts must be executed on the machine you want to run the Spark master on, not your local machine.

You can optionally configure the cluster further by setting environment variables in . Create this file by starting with the , and copy it to all your worker machines for the settings to take effect. The following settings are available:

Environment VariableMeaning
Bind the master to a specific hostname or IP address, for example a public one.
Start the master on a different port (default: 7077).
Port for the master web UI (default: 8080).
Configuration properties that apply only to the master in the form "-Dx=y" (default: none). See below for a list of possible options.
Directory to use for "scratch" space in Spark, including map output files and RDDs that get stored on disk. This should be on a fast, local disk in your system. It can also be a comma-separated list of multiple directories on different disks.
Total number of cores to allow Spark applications to use on the machine (default: all available cores).
Total amount of memory to allow Spark applications to use on the machine, e.g. , (default: total memory minus 1 GiB); note that each application's individual memory is configured using its property.
Start the Spark worker on a specific port (default: random).
Port for the worker web UI (default: 8081).
Directory to run applications in, which will include both logs and scratch space (default: SPARK_HOME/work).
Configuration properties that apply only to the worker in the form "-Dx=y" (default: none). See below for a list of possible options.
Memory to allocate to the Spark master and worker daemons themselves (default: 1g).
JVM options for the Spark master and worker daemons themselves in the form "-Dx=y" (default: none).
Classpath for the Spark master and worker daemons themselves (default: none).
The public DNS name of the Spark master and workers (default: none).

Note: The launch scripts do not currently support Windows. To run a Spark cluster on Windows, start the master and workers by hand.

SPARK_MASTER_OPTS supports the following system properties:

Property NameDefaultMeaningSince Version
200 The maximum number of completed applications to display. Older applications will be dropped from the UI to maintain this limit.
0.8.0
200 The maximum number of completed drivers to display. Older drivers will be dropped from the UI to maintain this limit.
1.1.0
true Whether the standalone cluster manager should spread applications out across nodes or try to consolidate them onto as few nodes as possible. Spreading out is usually better for data locality in HDFS, but consolidating is more efficient for compute-intensive workloads.
0.6.1
(infinite) Default number of cores to give to applications in Spark's standalone mode if they don't set . If not set, applications always get all available cores unless they configure themselves. Set this lower on a shared cluster to prevent users from grabbing the whole cluster by default.
0.9.0
10 Limit on the maximum number of back-to-back executor failures that can occur before the standalone cluster manager removes a faulty application. An application will never be removed if it has any running executors. If an application experiences more than failures in a row, no executors successfully start running in between those failures, and the application has no running executors then the standalone cluster manager will remove the application and mark it as failed. To disable this automatic removal, set to .
1.6.3
60 Number of seconds after which the standalone deploy master considers a worker lost if it receives no heartbeats. 0.6.2
(none) Amount of a particular resource to use on the worker. 3.0.0
(none) Path to resource discovery script, which is used to find a particular resource while worker starting up. And the output of the script should be formatted like the class. 3.0.0
(none) Path to resources file which is used to find various resources while worker starting up. The content of resources file should be formatted like . If a particular resource is not found in the resources file, the discovery script would be used to find that resource. If the discovery script also does not find the resources, the worker will fail to start up. 3.0.0

SPARK_WORKER_OPTS supports the following system properties:

Property NameDefaultMeaningSince Version
false Enable periodic cleanup of worker / application directories. Note that this only affects standalone mode, as YARN works differently. Only the directories of stopped applications are cleaned up. This should be enabled if spark.shuffle.service.db.enabled is "true" 1.0.0
1800 (30 minutes) Controls the interval, in seconds, at which the worker cleans up old application work dirs on the local machine. 1.0.0
604800 (7 days, 7 * 24 * 3600) The number of seconds to retain application work directories on each worker. This is a Time To Live and should depend on the amount of available disk space you have. Application logs and jars are downloaded to each application work dir. Over time, the work dirs can quickly fill up disk space, especially if you run jobs very frequently. 1.0.0
true Store External Shuffle service state on local disk so that when the external shuffle service is restarted, it will automatically reload info on current executors. This only affects standalone mode (yarn always has this behavior enabled). You should also enable , to ensure that the state eventually gets cleaned up. This config may be removed in the future. 3.0.0
true Enable cleanup non-shuffle files(such as temp. shuffle blocks, cached RDD/broadcast blocks, spill files, etc) of worker directories following executor exits. Note that this doesn't overlap with `spark.worker.cleanup.enabled`, as this enables cleanup of non-shuffle files in local directories of a dead executor, while `spark.worker.cleanup.enabled` enables cleanup of all files/subdirectories of a stopped and timeout application. This only affects Standalone mode, support of other cluster managers can be added in the future. 2.4.0
100 For compressed log files, the uncompressed file can only be computed by uncompressing the files. Spark caches the uncompressed file size of compressed log files. This property controls the cache size. 2.0.2

Please make sure to have read the Custom Resource Scheduling and Configuration Overview section on the configuration page. This section only talks about the Spark Standalone specific aspects of resource scheduling.

Spark Standalone has 2 parts, the first is configuring the resources for the Worker, the second is the resource allocation for a specific application.

The user must configure the Workers to have a set of resources available so that it can assign them out to Executors. The is used to control the amount of each resource the worker has allocated. The user must also specify either or to specify how the Worker discovers the resources its assigned. See the descriptions above for each of those to see which method works best for your setup.

The second part is running an application on Spark Standalone. The only special case from the standard Spark resource configs is when you are running the Driver in client mode. For a Driver in client mode, the user can specify the resources it uses via or . If the Driver is running on the same host as other Drivers, please make sure the resources file or discovery script only returns resources that do not conflict with other Drivers running on the same node.

Note, the user does not need to specify a discovery script when submitting an application as the Worker will start each Executor with the resources it allocates to it.

To run an application on the Spark cluster, simply pass the URL of the master as to the constructor.

To run an interactive Spark shell against the cluster, run the following command:

You can also pass an option to control the number of cores that spark-shell uses on the cluster.

Spark applications supports the following configuration properties specific to standalone mode:

Property NameDefault ValueMeaningSince Version
In standalone cluster mode, controls whether the client waits to exit until the application completes. If set to , the client process will stay alive polling the driver's status. Otherwise, the client process will exit after submission. 3.1.0

The script provides the most straightforward way to submit a compiled Spark application to the cluster. For standalone clusters, Spark currently supports two deploy modes. In mode, the driver is launched in the same process as the client that submits the application. In 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.

If your application is launched through Spark submit, then the application jar is automatically distributed to all worker nodes. For any additional jars that your application depends on, you should specify them through the flag using comma as a delimiter (e.g. ). To control the application’s configuration or execution environment, see Spark Configuration.

Additionally, standalone mode supports restarting your application automatically if it exited with non-zero exit code. To use this feature, you may pass in the flag to when launching your application. Then, if you wish to kill an application that is failing repeatedly, you may do so through:

You can find the driver ID through the standalone Master web UI at .

The standalone cluster mode currently only supports a simple FIFO scheduler across applications. However, to allow multiple concurrent users, you can control the maximum number of resources each application will use. By default, it will acquire all cores in the cluster, which only makes sense if you just run one application at a time. You can cap the number of cores by setting in your SparkConf. For example:

In addition, you can configure on the cluster master process to change the default for applications that don’t set to something less than infinite. Do this by adding the following to :

This is useful on shared clusters where users might not have configured a maximum number of cores individually.

The number of cores assigned to each executor is configurable. When is explicitly set, multiple executors from the same application may be launched on the same worker if the worker has enough cores and memory. Otherwise, each executor grabs all the cores available on the worker by default, in which case only one executor per application may be launched on each worker during one single schedule iteration.

Spark’s standalone mode offers a web-based user interface to monitor the cluster. The master and each worker has its own web UI that shows cluster and job statistics. By default, you can access the web UI for the master at port 8080. The port can be changed either in the configuration file or via command-line options.

In addition, detailed log output for each job is also written to the work directory of each worker node ( by default). You will see two files for each job, and , with all output it wrote to its console.

You can run Spark alongside your existing Hadoop cluster by just launching it as a separate service on the same machines. To access Hadoop data from Spark, just use an hdfs:// URL (typically , but you can find the right URL on your Hadoop Namenode’s web UI). Alternatively, you can set up a separate cluster for Spark, and still have it access HDFS over the network; this will be slower than disk-local access, but may not be a concern if you are still running in the same local area network (e.g. you place a few Spark machines on each rack that you have Hadoop on).

Generally speaking, a Spark cluster and its services are not deployed on the public internet. They are generally private services, and should only be accessible within the network of the organization that deploys Spark. Access to the hosts and ports used by Spark services should be limited to origin hosts that need to access the services.

This is particularly important for clusters using the standalone resource manager, as they do not support fine-grained access control in a way that other resource managers do.

For a complete list of ports to configure, see the security page.

By default, standalone scheduling clusters are resilient to Worker failures (insofar as Spark itself is resilient to losing work by moving it to other workers). However, the scheduler uses a Master to make scheduling decisions, and this (by default) creates a single point of failure: if the Master crashes, no new applications can be created. In order to circumvent this, we have two high availability schemes, detailed below.

Standby Masters with ZooKeeper

Overview

Utilizing ZooKeeper to provide leader election and some state storage, you can launch multiple Masters in your cluster connected to the same ZooKeeper instance. One will be elected “leader” and the others will remain in standby mode. If the current leader dies, another Master will be elected, recover the old Master’s state, and then resume scheduling. The entire recovery process (from the time the first leader goes down) should take between 1 and 2 minutes. Note that this delay only affects scheduling new applications – applications that were already running during Master failover are unaffected.

Learn more about getting started with ZooKeeper here.

Configuration

In order to enable this recovery mode, you can set SPARK_DAEMON_JAVA_OPTS in spark-env by configuring and related spark.deploy.zookeeper.* configurations. For more information about these configurations please refer to the configuration doc

Possible gotcha: If you have multiple Masters in your cluster but fail to correctly configure the Masters to use ZooKeeper, the Masters will fail to discover each other and think they’re all leaders. This will not lead to a healthy cluster state (as all Masters will schedule independently).

Details

After you have a ZooKeeper cluster set up, enabling high availability is straightforward. Simply start multiple Master processes on different nodes with the same ZooKeeper configuration (ZooKeeper URL and directory). Masters can be added and removed at any time.

In order to schedule new applications or add Workers to the cluster, they need to know the IP address of the current leader. This can be accomplished by simply passing in a list of Masters where you used to pass in a single one. For example, you might start your SparkContext pointing to . This would cause your SparkContext to try registering with both Masters – if goes down, this configuration would still be correct as we’d find the new leader, .

There’s an important distinction to be made between “registering with a Master” and normal operation. When starting up, an application or Worker needs to be able to find and register with the current lead Master. Once it successfully registers, though, it is “in the system” (i.e., stored in ZooKeeper). If failover occurs, the new leader will contact all previously registered applications and Workers to inform them of the change in leadership, so they need not even have known of the existence of the new Master at startup.

Due to this property, new Masters can be created at any time, and the only thing you need to worry about is that new applications and Workers can find it to register with in case it becomes the leader. Once registered, you’re taken care of.

Single-Node Recovery with Local File System

Overview

ZooKeeper is the best way to go for production-level high availability, but if you just want to be able to restart the Master if it goes down, FILESYSTEM mode can take care of it. When applications and Workers register, they have enough state written to the provided directory so that they can be recovered upon a restart of the Master process.

Configuration

In order to enable this recovery mode, you can set SPARK_DAEMON_JAVA_OPTS in spark-env using this configuration:

System propertyMeaningSince Version
Set to FILESYSTEM to enable single-node recovery mode (default: NONE).0.8.1
The directory in which Spark will store recovery state, accessible from the Master's perspective.0.8.1

Details

  • This solution can be used in tandem with a process monitor/manager like monit, or just to enable manual recovery via restart.
  • While filesystem recovery seems straightforwardly better than not doing any recovery at all, this mode may be suboptimal for certain development or experimental purposes. In particular, killing a master via stop-master.sh does not clean up its recovery state, so whenever you start a new Master, it will enter recovery mode. This could increase the startup time by up to 1 minute if it needs to wait for all previously-registered Workers/clients to timeout.
  • While it’s not officially supported, you could mount an NFS directory as the recovery directory. If the original Master node dies completely, you could then start a Master on a different node, which would correctly recover all previously registered Workers/applications (equivalent to ZooKeeper recovery). Future applications will have to be able to find the new Master, however, in order to register.
Sours: http://spark.apache.org/docs/latest/spark-standalone.html
FLMMBOiiNT FRDii - Are You Dumm? (Official Video)

Chapter 11. Running on a Spark standalone cluster

  • Components of Spark standalone cluster
  • Spinning up the cluster
  • Spark cluster Web UI
  • Running applications
  • Spark History Server
  • Running on Amazon EC2

After describing common aspects of running Spark and examining Spark local modes in chapter 10, now we get to the first “real” Spark cluster type. The Spark standalone cluster is a Spark-specific cluster: it was built specifically for Spark, and it can’t execute any other type of application. It’s relatively simple and efficient and comes with Spark out of the box, so you can use it even if you don’t have a YARN or Mesos installation.

In this chapter, we’ll explain the runtime components of a standalone cluster and how to configure and control those components. A Spark standalone cluster comes with its own web UI, and we’ll show you how to use it to monitor cluster processes and running applications. A useful component for this is Spark’s History Server; we’ll also show you how to use it and explain why you should.

Spark provides scripts for quickly spinning up a standalone cluster on Amazon EC2. (If you aren’t acquainted with it, Amazon EC2 is Amazon’s cloud service, offering virtual servers for rent.) We’ll walk you through how to do that. Let’s get started.

11.1. Spark standalone cluster components

11.2. Starting the standalone cluster

11.3. Standalone cluster web UI

11.4. Running applications in a standalone cluster

11.5. Spark History Server and event logging

11.6. Running on Amazon EC2

11.7. Summary

Sours: https://livebook.manning.com/book/spark-in-action/chapter-11/

Now discussing:

Submitting Applications

The script in Spark’s directory is used to launch applications on a cluster. It can use all of Spark’s supported cluster managers through a uniform interface so you don’t have to configure your application especially for each one.

If your code depends on other projects, you will need to package them alongside your application in order to distribute the code to a Spark cluster. To do this, create an assembly jar (or “uber” jar) containing your code and its dependencies. Both sbt and Maven have assembly plugins. When creating assembly jars, list Spark and Hadoop as dependencies; these need not be bundled since they are provided by the cluster manager at runtime. Once you have an assembled jar you can call the script as shown here while passing your jar.

For Python, you can use the argument of to add , or files to be distributed with your application. If you depend on multiple Python files we recommend packaging them into a or .

Once a user application is bundled, it can be launched using the script. This script takes care of setting up the classpath with Spark and its dependencies, and can support different cluster managers and deploy modes that Spark supports:

Some of the commonly used options are:

  • : The entry point for your application (e.g. )
  • : The master URL for the cluster (e.g. )
  • : Whether to deploy your driver on the worker nodes () or locally as an external client () (default: )
  • : Arbitrary Spark configuration property in key=value format. For values that contain spaces wrap “key=value” in quotes (as shown). Multiple configurations should be passed as separate arguments. (e.g. )
  • : Path to a bundled jar including your application and all dependencies. The URL must be globally visible inside of your cluster, for instance, an path or a path that is present on all nodes.
  • : Arguments passed to the main method of your main class, if any

A common deployment strategy is to submit your application from a gateway machine that is physically co-located with your worker machines (e.g. Master node in a standalone EC2 cluster). In this setup, mode is appropriate. In mode, the driver is launched directly within the process which acts as a client to the cluster. The input and output of the application is attached to the console. Thus, this mode is especially suitable for applications that involve the REPL (e.g. Spark shell).

Alternatively, if your application is submitted from a machine far from the worker machines (e.g. locally on your laptop), it is common to use mode to minimize network latency between the drivers and the executors. Currently, the standalone mode does not support cluster mode for Python applications.

For Python applications, simply pass a file in the place of , and add Python , or files to the search path with .

There are a few options available that are specific to the cluster manager that is being used. For example, with a Spark standalone cluster with deploy mode, you can also specify to make sure that the driver is automatically restarted if it fails with a non-zero exit code. To enumerate all such options available to , run it with . Here are a few examples of common options:

The master URL passed to Spark can be in one of the following formats:

Master URLMeaning
Run Spark locally with one worker thread (i.e. no parallelism at all).
Run Spark locally with K worker threads (ideally, set this to the number of cores on your machine).
Run Spark locally with K worker threads and F maxFailures (see spark.task.maxFailures for an explanation of this variable)
Run Spark locally with as many worker threads as logical cores on your machine.
Run Spark locally with as many worker threads as logical cores on your machine and F maxFailures.
Connect to the given Spark standalone cluster master. The port must be whichever one your master is configured to use, which is 7077 by default.
Connect to the given Spark standalone cluster with standby masters with Zookeeper. The list must have all the master hosts in the high availability cluster set up with Zookeeper. The port must be whichever each master is configured to use, which is 7077 by default.
Connect to the given Mesos cluster. The port must be whichever one your is configured to use, which is 5050 by default. Or, for a Mesos cluster using ZooKeeper, use . To submit with , the HOST:PORT should be configured to connect to the MesosClusterDispatcher.
Connect to a YARN cluster in or mode depending on the value of . The cluster location will be found based on the or variable.
Connect to a Kubernetes cluster in or mode depending on the value of . The and refer to the Kubernetes API Server. It connects using TLS by default. In order to force it to use an unsecured connection, you can use .

The script can load default Spark configuration values from a properties file and pass them on to your application. By default, it will read options from in the Spark directory. For more detail, see the section on loading default configurations.

Loading default Spark configurations this way can obviate the need for certain flags to . For instance, if the property is set, you can safely omit the flag from . In general, configuration values explicitly set on a take the highest precedence, then flags passed to , then values in the defaults file.

If you are ever unclear where configuration options are coming from, you can print out fine-grained debugging information by running with the option.

When using , the application jar along with any jars included with the option will be automatically transferred to the cluster. URLs supplied after must be separated by commas. That list is included in the driver and executor classpaths. Directory expansion does not work with .

Spark uses the following URL scheme to allow different strategies for disseminating jars:

  • file: - Absolute paths and URIs are served by the driver’s HTTP file server, and every executor pulls the file from the driver HTTP server.
  • hdfs:, http:, https:, ftp: - these pull down files and JARs from the URI as expected
  • local: - a URI starting with local:/ is expected to exist as a local file on each worker node. This means that no network IO will be incurred, and works well for large files/JARs that are pushed to each worker, or shared via NFS, GlusterFS, etc.

Note that JARs and files are copied to the working directory for each SparkContext on the executor nodes. This can use up a significant amount of space over time and will need to be cleaned up. With YARN, cleanup is handled automatically, and with Spark standalone, automatic cleanup can be configured with the property.

Users may also include any other dependencies by supplying a comma-delimited list of Maven coordinates with . All transitive dependencies will be handled when using this command. Additional repositories (or resolvers in SBT) can be added in a comma-delimited fashion with the flag . (Note that credentials for password-protected repositories can be supplied in some cases in the repository URI, such as in . Be careful when supplying credentials this way.) These commands can be used with , , and to include Spark Packages.

For Python, the equivalent option can be used to distribute , and libraries to executors.

Once you have deployed your application, the cluster mode overview describes the components involved in distributed execution, and how to monitor and debug applications.

Sours: https://spark.apache.org/docs/latest/submitting-applications.html


1147 1148 1149 1150 1151