blob: 1d9e0c8a634b31bec23791be1b12683c93ce8d3d [file] [log] [blame]
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Running Spark on Mesos - Spark 3.2.4 Documentation</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<style>
body {
padding-top: 60px;
padding-bottom: 40px;
}
</style>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="css/main.css">
<script src="js/vendor/modernizr-2.6.1-respond-1.1.0.min.js"></script>
<link rel="stylesheet" href="css/pygments-default.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" />
<link rel="stylesheet" href="css/docsearch.css">
<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["disableCookies"]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://analytics.apache.org/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '40']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
</head>
<body>
<!--[if lt IE 7]>
<p class="chromeframe">You are using an outdated browser. <a href="https://browsehappy.com/">Upgrade your browser today</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to better experience this site.</p>
<![endif]-->
<!-- This code is taken from http://twitter.github.com/bootstrap/examples/hero.html -->
<nav class="navbar fixed-top navbar-expand-md navbar-light bg-light" id="topbar">
<div class="container">
<div class="navbar-header">
<div class="navbar-brand"><a href="index.html">
<img src="img/spark-logo-hd.png" style="height:50px;"/></a><span class="version">3.2.4</span>
</div>
</div>
<button class="navbar-toggler" type="button" data-toggle="collapse"
data-target="#navbarCollapse" aria-controls="navbarCollapse"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav">
<!--TODO(andyk): Add class="active" attribute to li some how.-->
<li class="nav-item"><a href="index.html" class="nav-link">Overview</a></li>
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" id="navbarQuickStart" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Programming Guides</a>
<div class="dropdown-menu" aria-labelledby="navbarQuickStart">
<a class="dropdown-item" href="quick-start.html">Quick Start</a>
<a class="dropdown-item" href="rdd-programming-guide.html">RDDs, Accumulators, Broadcasts Vars</a>
<a class="dropdown-item" href="sql-programming-guide.html">SQL, DataFrames, and Datasets</a>
<a class="dropdown-item" href="structured-streaming-programming-guide.html">Structured Streaming</a>
<a class="dropdown-item" href="streaming-programming-guide.html">Spark Streaming (DStreams)</a>
<a class="dropdown-item" href="ml-guide.html">MLlib (Machine Learning)</a>
<a class="dropdown-item" href="graphx-programming-guide.html">GraphX (Graph Processing)</a>
<a class="dropdown-item" href="sparkr.html">SparkR (R on Spark)</a>
<a class="dropdown-item" href="api/python/getting_started/index.html">PySpark (Python on Spark)</a>
</div>
</li>
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" id="navbarAPIDocs" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">API Docs</a>
<div class="dropdown-menu" aria-labelledby="navbarAPIDocs">
<a class="dropdown-item" href="api/scala/org/apache/spark/index.html">Scala</a>
<a class="dropdown-item" href="api/java/index.html">Java</a>
<a class="dropdown-item" href="api/python/index.html">Python</a>
<a class="dropdown-item" href="api/R/index.html">R</a>
<a class="dropdown-item" href="api/sql/index.html">SQL, Built-in Functions</a>
</div>
</li>
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" id="navbarDeploying" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Deploying</a>
<div class="dropdown-menu" aria-labelledby="navbarDeploying">
<a class="dropdown-item" href="cluster-overview.html">Overview</a>
<a class="dropdown-item" href="submitting-applications.html">Submitting Applications</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="spark-standalone.html">Spark Standalone</a>
<a class="dropdown-item" href="running-on-mesos.html">Mesos</a>
<a class="dropdown-item" href="running-on-yarn.html">YARN</a>
<a class="dropdown-item" href="running-on-kubernetes.html">Kubernetes</a>
</div>
</li>
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" id="navbarMore" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">More</a>
<div class="dropdown-menu" aria-labelledby="navbarMore">
<a class="dropdown-item" href="configuration.html">Configuration</a>
<a class="dropdown-item" href="monitoring.html">Monitoring</a>
<a class="dropdown-item" href="tuning.html">Tuning Guide</a>
<a class="dropdown-item" href="job-scheduling.html">Job Scheduling</a>
<a class="dropdown-item" href="security.html">Security</a>
<a class="dropdown-item" href="hardware-provisioning.html">Hardware Provisioning</a>
<a class="dropdown-item" href="migration-guide.html">Migration Guide</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="building-spark.html">Building Spark</a>
<a class="dropdown-item" href="https://spark.apache.org/contributing.html">Contributing to Spark</a>
<a class="dropdown-item" href="https://spark.apache.org/third-party-projects.html">Third Party Projects</a>
</div>
</li>
<li class="nav-item">
<input type="text" id="docsearch-input" placeholder="Search the docs…">
</li>
</ul>
<!--<span class="navbar-text navbar-right"><span class="version-text">v3.2.4</span></span>-->
</div>
</div>
</nav>
<div class="container-wrapper">
<div class="content mr-3" id="content">
<h1 class="title">Running Spark on Mesos</h1>
<ul id="markdown-toc">
<li><a href="#security" id="markdown-toc-security">Security</a></li>
<li><a href="#how-it-works" id="markdown-toc-how-it-works">How it Works</a></li>
<li><a href="#installing-mesos" id="markdown-toc-installing-mesos">Installing Mesos</a> <ul>
<li><a href="#from-source" id="markdown-toc-from-source">From Source</a></li>
<li><a href="#third-party-packages" id="markdown-toc-third-party-packages">Third-Party Packages</a></li>
<li><a href="#verification" id="markdown-toc-verification">Verification</a></li>
</ul>
</li>
<li><a href="#connecting-spark-to-mesos" id="markdown-toc-connecting-spark-to-mesos">Connecting Spark to Mesos</a> <ul>
<li><a href="#authenticating-to-mesos" id="markdown-toc-authenticating-to-mesos">Authenticating to Mesos</a> <ul>
<li><a href="#credential-specification-preference-order" id="markdown-toc-credential-specification-preference-order">Credential Specification Preference Order</a></li>
<li><a href="#deploy-to-a-mesos-running-on-secure-sockets" id="markdown-toc-deploy-to-a-mesos-running-on-secure-sockets">Deploy to a Mesos running on Secure Sockets</a></li>
</ul>
</li>
<li><a href="#uploading-spark-package" id="markdown-toc-uploading-spark-package">Uploading Spark Package</a></li>
<li><a href="#using-a-mesos-master-url" id="markdown-toc-using-a-mesos-master-url">Using a Mesos Master URL</a></li>
<li><a href="#client-mode" id="markdown-toc-client-mode">Client Mode</a></li>
<li><a href="#cluster-mode" id="markdown-toc-cluster-mode">Cluster mode</a></li>
</ul>
</li>
<li><a href="#mesos-run-modes" id="markdown-toc-mesos-run-modes">Mesos Run Modes</a> <ul>
<li><a href="#coarse-grained" id="markdown-toc-coarse-grained">Coarse-Grained</a></li>
<li><a href="#fine-grained-deprecated" id="markdown-toc-fine-grained-deprecated">Fine-Grained (deprecated)</a></li>
</ul>
</li>
<li><a href="#mesos-docker-support" id="markdown-toc-mesos-docker-support">Mesos Docker Support</a></li>
<li><a href="#running-alongside-hadoop" id="markdown-toc-running-alongside-hadoop">Running Alongside Hadoop</a></li>
<li><a href="#dynamic-resource-allocation-with-mesos" id="markdown-toc-dynamic-resource-allocation-with-mesos">Dynamic Resource Allocation with Mesos</a></li>
<li><a href="#configuration" id="markdown-toc-configuration">Configuration</a> <ul>
<li><a href="#spark-properties" id="markdown-toc-spark-properties">Spark Properties</a></li>
</ul>
</li>
<li><a href="#troubleshooting-and-debugging" id="markdown-toc-troubleshooting-and-debugging">Troubleshooting and Debugging</a></li>
</ul>
<p><em>Note</em>: Apache Mesos support is deprecated as of Apache Spark 3.2.0. It will be removed in a future version.</p>
<p>Spark can run on hardware clusters managed by <a href="http://mesos.apache.org/">Apache Mesos</a>.</p>
<p>The advantages of deploying Spark with Mesos include:</p>
<ul>
<li>dynamic partitioning between Spark and other
<a href="https://mesos.apache.org/documentation/latest/frameworks/">frameworks</a></li>
<li>scalable partitioning between multiple instances of Spark</li>
</ul>
<h1 id="security">Security</h1>
<p>Security features like authentication are not enabled by default. When deploying a cluster that is open to the internet
or an untrusted network, it&#8217;s important to secure access to the cluster to prevent unauthorized applications
from running on the cluster.
Please see <a href="security.html">Spark Security</a> and the specific security sections in this doc before running Spark.</p>
<h1 id="how-it-works">How it Works</h1>
<p>In a standalone cluster deployment, the cluster manager in the below diagram is a Spark master
instance. When using Mesos, the Mesos master replaces the Spark master as the cluster manager.</p>
<p style="text-align: center;">
<img src="img/cluster-overview.png" title="Spark cluster components" alt="Spark cluster components" />
</p>
<p>Now when a driver creates a job and starts issuing tasks for scheduling, Mesos determines what
machines handle what tasks. Because it takes into account other frameworks when scheduling these
many short-lived tasks, multiple frameworks can coexist on the same cluster without resorting to a
static partitioning of resources.</p>
<p>To get started, follow the steps below to install Mesos and deploy Spark jobs via Mesos.</p>
<h1 id="installing-mesos">Installing Mesos</h1>
<p>Spark 3.2.4 is designed for use with Mesos 1.0.0 or newer and does not
require any special patches of Mesos. File and environment-based secrets support requires Mesos 1.3.0 or
newer.</p>
<p>If you already have a Mesos cluster running, you can skip this Mesos installation step.</p>
<p>Otherwise, installing Mesos for Spark is no different than installing Mesos for use by other
frameworks. You can install Mesos either from source or using prebuilt packages.</p>
<h2 id="from-source">From Source</h2>
<p>To install Apache Mesos from source, follow these steps:</p>
<ol>
<li>Download a Mesos release from a
<a href="http://www.apache.org/dyn/closer.lua/mesos/1.0.0/">mirror</a></li>
<li>Follow the Mesos <a href="http://mesos.apache.org/getting-started">Getting Started</a> page for compiling and
installing Mesos</li>
</ol>
<p><strong>Note:</strong> If you want to run Mesos without installing it into the default paths on your system
(e.g., if you lack administrative privileges to install it), pass the
<code class="language-plaintext highlighter-rouge">--prefix</code> option to <code class="language-plaintext highlighter-rouge">configure</code> to tell it where to install. For example, pass
<code class="language-plaintext highlighter-rouge">--prefix=/home/me/mesos</code>. By default the prefix is <code class="language-plaintext highlighter-rouge">/usr/local</code>.</p>
<h2 id="third-party-packages">Third-Party Packages</h2>
<p>The Apache Mesos project only publishes source releases, not binary packages. But other
third party projects publish binary releases that may be helpful in setting Mesos up.</p>
<p>One of those is Mesosphere. To install Mesos using the binary releases provided by Mesosphere:</p>
<ol>
<li>Download Mesos installation package from <a href="https://open.mesosphere.com/downloads/mesos/">downloads page</a></li>
<li>Follow their instructions for installation and configuration</li>
</ol>
<p>The Mesosphere installation documents suggest setting up ZooKeeper to handle Mesos master failover,
but Mesos can be run without ZooKeeper using a single master as well.</p>
<h2 id="verification">Verification</h2>
<p>To verify that the Mesos cluster is ready for Spark, navigate to the Mesos master webui at port
<code class="language-plaintext highlighter-rouge">:5050</code> Confirm that all expected machines are present in the agents tab.</p>
<h1 id="connecting-spark-to-mesos">Connecting Spark to Mesos</h1>
<p>To use Mesos from Spark, you need a Spark binary package available in a place accessible by Mesos, and
a Spark driver program configured to connect to Mesos.</p>
<p>Alternatively, you can also install Spark in the same location in all the Mesos agents, and configure
<code class="language-plaintext highlighter-rouge">spark.mesos.executor.home</code> (defaults to SPARK_HOME) to point to that location.</p>
<h2 id="authenticating-to-mesos">Authenticating to Mesos</h2>
<p>When Mesos Framework authentication is enabled it is necessary to provide a principal and secret by which to authenticate Spark to Mesos. Each Spark job will register with Mesos as a separate framework.</p>
<p>Depending on your deployment environment you may wish to create a single set of framework credentials that are shared across all users or create framework credentials for each user. Creating and managing framework credentials should be done following the Mesos <a href="http://mesos.apache.org/documentation/latest/authentication/">Authentication documentation</a>.</p>
<p>Framework credentials may be specified in a variety of ways depending on your deployment environment and security requirements. The most simple way is to specify the <code class="language-plaintext highlighter-rouge">spark.mesos.principal</code> and <code class="language-plaintext highlighter-rouge">spark.mesos.secret</code> values directly in your Spark configuration. Alternatively you may specify these values indirectly by instead specifying <code class="language-plaintext highlighter-rouge">spark.mesos.principal.file</code> and <code class="language-plaintext highlighter-rouge">spark.mesos.secret.file</code>, these settings point to files containing the principal and secret. These files must be plaintext files in UTF-8 encoding. Combined with appropriate file ownership and mode/ACLs this provides a more secure way to specify these credentials.</p>
<p>Additionally, if you prefer to use environment variables you can specify all of the above via environment variables instead, the environment variable names are simply the configuration settings uppercased with <code class="language-plaintext highlighter-rouge">.</code> replaced with <code class="language-plaintext highlighter-rouge">_</code> e.g. <code class="language-plaintext highlighter-rouge">SPARK_MESOS_PRINCIPAL</code>.</p>
<h3 id="credential-specification-preference-order">Credential Specification Preference Order</h3>
<p>Please note that if you specify multiple ways to obtain the credentials then the following preference order applies. Spark will use the first valid value found and any subsequent values are ignored:</p>
<ul>
<li><code class="language-plaintext highlighter-rouge">spark.mesos.principal</code> configuration setting</li>
<li><code class="language-plaintext highlighter-rouge">SPARK_MESOS_PRINCIPAL</code> environment variable</li>
<li><code class="language-plaintext highlighter-rouge">spark.mesos.principal.file</code> configuration setting</li>
<li><code class="language-plaintext highlighter-rouge">SPARK_MESOS_PRINCIPAL_FILE</code> environment variable</li>
</ul>
<p>An equivalent order applies for the secret. Essentially we prefer the configuration to be specified directly rather than indirectly by files, and we prefer that configuration settings are used over environment variables.</p>
<h3 id="deploy-to-a-mesos-running-on-secure-sockets">Deploy to a Mesos running on Secure Sockets</h3>
<p>If you want to deploy a Spark Application into a Mesos cluster that is running in a secure mode there are some environment variables that need to be set.</p>
<ul>
<li><code class="language-plaintext highlighter-rouge">LIBPROCESS_SSL_ENABLED=true</code> enables SSL communication</li>
<li><code class="language-plaintext highlighter-rouge">LIBPROCESS_SSL_VERIFY_CERT=false</code> verifies the ssl certificate</li>
<li><code class="language-plaintext highlighter-rouge">LIBPROCESS_SSL_KEY_FILE=pathToKeyFile.key</code> path to key</li>
<li><code class="language-plaintext highlighter-rouge">LIBPROCESS_SSL_CERT_FILE=pathToCRTFile.crt</code> the certificate file to be used</li>
</ul>
<p>All options can be found at http://mesos.apache.org/documentation/latest/ssl/</p>
<p>Then submit happens as described in Client mode or Cluster mode below</p>
<h2 id="uploading-spark-package">Uploading Spark Package</h2>
<p>When Mesos runs a task on a Mesos agent for the first time, that agent must have a Spark binary
package for running the Spark Mesos executor backend.
The Spark package can be hosted at any Hadoop-accessible URI, including HTTP via <code class="language-plaintext highlighter-rouge">http://</code>,
<a href="http://aws.amazon.com/s3">Amazon Simple Storage Service</a> via <code class="language-plaintext highlighter-rouge">s3n://</code>, or HDFS via <code class="language-plaintext highlighter-rouge">hdfs://</code>.</p>
<p>To use a precompiled package:</p>
<ol>
<li>Download a Spark binary package from the Spark <a href="https://spark.apache.org/downloads.html">download page</a></li>
<li>Upload to hdfs/http/s3</li>
</ol>
<p>To host on HDFS, use the Hadoop fs put command: <code class="language-plaintext highlighter-rouge">hadoop fs -put spark-3.2.4.tar.gz
/path/to/spark-3.2.4.tar.gz</code></p>
<p>Or if you are using a custom-compiled version of Spark, you will need to create a package using
the <code class="language-plaintext highlighter-rouge">dev/make-distribution.sh</code> script included in a Spark source tarball/checkout.</p>
<ol>
<li>Download and build Spark using the instructions <a href="index.html">here</a></li>
<li>Create a binary package using <code class="language-plaintext highlighter-rouge">./dev/make-distribution.sh --tgz</code>.</li>
<li>Upload archive to http/s3/hdfs</li>
</ol>
<h2 id="using-a-mesos-master-url">Using a Mesos Master URL</h2>
<p>The Master URLs for Mesos are in the form <code class="language-plaintext highlighter-rouge">mesos://host:5050</code> for a single-master Mesos
cluster, or <code class="language-plaintext highlighter-rouge">mesos://zk://host1:2181,host2:2181,host3:2181/mesos</code> for a multi-master Mesos cluster using ZooKeeper.</p>
<h2 id="client-mode">Client Mode</h2>
<p>In client mode, a Spark Mesos framework is launched directly on the client machine and waits for the driver output.</p>
<p>The driver needs some configuration in <code class="language-plaintext highlighter-rouge">spark-env.sh</code> to interact properly with Mesos:</p>
<ol>
<li>In <code class="language-plaintext highlighter-rouge">spark-env.sh</code> set some environment variables:
<ul>
<li><code class="language-plaintext highlighter-rouge">export MESOS_NATIVE_JAVA_LIBRARY=&lt;path to libmesos.so&gt;</code>. This path is typically
<code class="language-plaintext highlighter-rouge">&lt;prefix&gt;/lib/libmesos.so</code> where the prefix is <code class="language-plaintext highlighter-rouge">/usr/local</code> by default. See Mesos installation
instructions above. On Mac OS X, the library is called <code class="language-plaintext highlighter-rouge">libmesos.dylib</code> instead of
<code class="language-plaintext highlighter-rouge">libmesos.so</code>.</li>
<li><code class="language-plaintext highlighter-rouge">export SPARK_EXECUTOR_URI=&lt;URL of spark-3.2.4.tar.gz uploaded above&gt;</code>.</li>
</ul>
</li>
<li>Also set <code class="language-plaintext highlighter-rouge">spark.executor.uri</code> to <code class="language-plaintext highlighter-rouge">&lt;URL of spark-3.2.4.tar.gz&gt;</code>.</li>
</ol>
<p>Now when starting a Spark application against the cluster, pass a <code class="language-plaintext highlighter-rouge">mesos://</code>
URL as the master when creating a <code class="language-plaintext highlighter-rouge">SparkContext</code>. For example:</p>
<figure class="highlight"><pre><code class="language-scala" data-lang="scala"><span class="k">val</span> <span class="nv">conf</span> <span class="k">=</span> <span class="k">new</span> <span class="nc">SparkConf</span><span class="o">()</span>
<span class="o">.</span><span class="py">setMaster</span><span class="o">(</span><span class="s">"mesos://HOST:5050"</span><span class="o">)</span>
<span class="o">.</span><span class="py">setAppName</span><span class="o">(</span><span class="s">"My app"</span><span class="o">)</span>
<span class="o">.</span><span class="py">set</span><span class="o">(</span><span class="s">"spark.executor.uri"</span><span class="o">,</span> <span class="s">"&lt;path to spark-3.2.4.tar.gz uploaded above&gt;"</span><span class="o">)</span>
<span class="k">val</span> <span class="nv">sc</span> <span class="k">=</span> <span class="k">new</span> <span class="nc">SparkContext</span><span class="o">(</span><span class="n">conf</span><span class="o">)</span></code></pre></figure>
<p>(You can also use <a href="submitting-applications.html"><code class="language-plaintext highlighter-rouge">spark-submit</code></a> and configure <code class="language-plaintext highlighter-rouge">spark.executor.uri</code>
in the <a href="configuration.html#loading-default-configurations">conf/spark-defaults.conf</a> file.)</p>
<p>When running a shell, the <code class="language-plaintext highlighter-rouge">spark.executor.uri</code> parameter is inherited from <code class="language-plaintext highlighter-rouge">SPARK_EXECUTOR_URI</code>, so
it does not need to be redundantly passed in as a system property.</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">./bin/spark-shell <span class="nt">--master</span> mesos://host:5050</code></pre></figure>
<h2 id="cluster-mode">Cluster mode</h2>
<p>Spark on Mesos also supports cluster mode, where the driver is launched in the cluster and the client
can find the results of the driver from the Mesos Web UI.</p>
<p>To use cluster mode, you must start the <code class="language-plaintext highlighter-rouge">MesosClusterDispatcher</code> in your cluster via the <code class="language-plaintext highlighter-rouge">sbin/start-mesos-dispatcher.sh</code> script,
passing in the Mesos master URL (e.g: mesos://host:5050). This starts the <code class="language-plaintext highlighter-rouge">MesosClusterDispatcher</code> as a daemon running on the host.
Note that the <code class="language-plaintext highlighter-rouge">MesosClusterDispatcher</code> does not support authentication. You should ensure that all network access to it is
protected (port 7077 by default).</p>
<p>By setting the Mesos proxy config property (requires mesos version &gt;= 1.4), <code class="language-plaintext highlighter-rouge">--conf spark.mesos.proxy.baseURL=http://localhost:5050</code> when launching the dispatcher, the mesos sandbox URI for each driver is added to the mesos dispatcher UI.</p>
<p>If you like to run the <code class="language-plaintext highlighter-rouge">MesosClusterDispatcher</code> with Marathon, you need to run the <code class="language-plaintext highlighter-rouge">MesosClusterDispatcher</code> in the foreground (i.e: <code class="language-plaintext highlighter-rouge">./bin/spark-class org.apache.spark.deploy.mesos.MesosClusterDispatcher</code>). Note that the <code class="language-plaintext highlighter-rouge">MesosClusterDispatcher</code> not yet supports multiple instances for HA.</p>
<p>The <code class="language-plaintext highlighter-rouge">MesosClusterDispatcher</code> also supports writing recovery state into Zookeeper. This will allow the <code class="language-plaintext highlighter-rouge">MesosClusterDispatcher</code> to be able to recover all submitted and running containers on relaunch. In order to enable this recovery mode, you can set SPARK_DAEMON_JAVA_OPTS in spark-env by configuring <code class="language-plaintext highlighter-rouge">spark.deploy.recoveryMode</code> and related spark.deploy.zookeeper.* configurations.
For more information about these configurations please refer to the configurations <a href="configuration.html#deploy">doc</a>.</p>
<p>You can also specify any additional jars required by the <code class="language-plaintext highlighter-rouge">MesosClusterDispatcher</code> in the classpath by setting the environment variable SPARK_DAEMON_CLASSPATH in spark-env.</p>
<p>From the client, you can submit a job to Mesos cluster by running <code class="language-plaintext highlighter-rouge">spark-submit</code> and specifying the master URL
to the URL of the <code class="language-plaintext highlighter-rouge">MesosClusterDispatcher</code> (e.g: mesos://dispatcher:7077). You can view driver statuses on the
Spark cluster Web UI.</p>
<p>For example:</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">./bin/spark-submit <span class="se">\</span>
<span class="nt">--class</span> org.apache.spark.examples.SparkPi <span class="se">\</span>
<span class="nt">--master</span> mesos://207.184.161.138:7077 <span class="se">\</span>
<span class="nt">--deploy-mode</span> cluster <span class="se">\</span>
<span class="nt">--supervise</span> <span class="se">\</span>
<span class="nt">--executor-memory</span> 20G <span class="se">\</span>
<span class="nt">--total-executor-cores</span> 100 <span class="se">\</span>
http://path/to/examples.jar <span class="se">\</span>
1000</code></pre></figure>
<p>Note that jars or python files that are passed to spark-submit should be URIs reachable by Mesos agents, as the Spark driver doesn&#8217;t automatically upload local jars.</p>
<h1 id="mesos-run-modes">Mesos Run Modes</h1>
<p>Spark can run over Mesos in two modes: &#8220;coarse-grained&#8221; (default) and
&#8220;fine-grained&#8221; (deprecated).</p>
<h2 id="coarse-grained">Coarse-Grained</h2>
<p>In &#8220;coarse-grained&#8221; mode, each Spark executor runs as a single Mesos
task. Spark executors are sized according to the following
configuration variables:</p>
<ul>
<li>Executor memory: <code class="language-plaintext highlighter-rouge">spark.executor.memory</code></li>
<li>Executor cores: <code class="language-plaintext highlighter-rouge">spark.executor.cores</code></li>
<li>Number of executors: <code class="language-plaintext highlighter-rouge">spark.cores.max</code>/<code class="language-plaintext highlighter-rouge">spark.executor.cores</code></li>
</ul>
<p>Please see the <a href="configuration.html">Spark Configuration</a> page for
details and default values.</p>
<p>Executors are brought up eagerly when the application starts, until
<code class="language-plaintext highlighter-rouge">spark.cores.max</code> is reached. If you don&#8217;t set <code class="language-plaintext highlighter-rouge">spark.cores.max</code>, the
Spark application will consume all resources offered to it by Mesos,
so we, of course, urge you to set this variable in any sort of
multi-tenant cluster, including one which runs multiple concurrent
Spark applications.</p>
<p>The scheduler will start executors round-robin on the offers Mesos
gives it, but there are no spread guarantees, as Mesos does not
provide such guarantees on the offer stream.</p>
<p>In this mode Spark executors will honor port allocation if such is
provided from the user. Specifically, if the user defines
<code class="language-plaintext highlighter-rouge">spark.blockManager.port</code> in Spark configuration,
the mesos scheduler will check the available offers for a valid port
range containing the port numbers. If no such range is available it will
not launch any task. If no restriction is imposed on port numbers by the
user, ephemeral ports are used as usual. This port honouring implementation
implies one task per host if the user defines a port. In the future network,
isolation shall be supported.</p>
<p>The benefit of coarse-grained mode is much lower startup overhead, but
at the cost of reserving Mesos resources for the complete duration of
the application. To configure your job to dynamically adjust to its
resource requirements, look into
<a href="#dynamic-resource-allocation-with-mesos">Dynamic Allocation</a>.</p>
<h2 id="fine-grained-deprecated">Fine-Grained (deprecated)</h2>
<p><strong>NOTE:</strong> Fine-grained mode is deprecated as of Spark 2.0.0. Consider
using <a href="#dynamic-resource-allocation-with-mesos">Dynamic Allocation</a>
for some of the benefits. For a full explanation see
<a href="https://issues.apache.org/jira/browse/SPARK-11857">SPARK-11857</a></p>
<p>In &#8220;fine-grained&#8221; mode, each Spark task inside the Spark executor runs
as a separate Mesos task. This allows multiple instances of Spark (and
other frameworks) to share cores at a very fine granularity, where
each application gets more or fewer cores as it ramps up and down, but
it comes with an additional overhead in launching each task. This mode
may be inappropriate for low-latency requirements like interactive
queries or serving web requests.</p>
<p>Note that while Spark tasks in fine-grained will relinquish cores as
they terminate, they will not relinquish memory, as the JVM does not
give memory back to the Operating System. Neither will executors
terminate when they&#8217;re idle.</p>
<p>To run in fine-grained mode, set the <code class="language-plaintext highlighter-rouge">spark.mesos.coarse</code> property to false in your
<a href="configuration.html#spark-properties">SparkConf</a>:</p>
<figure class="highlight"><pre><code class="language-scala" data-lang="scala"><span class="nv">conf</span><span class="o">.</span><span class="py">set</span><span class="o">(</span><span class="s">"spark.mesos.coarse"</span><span class="o">,</span> <span class="s">"false"</span><span class="o">)</span></code></pre></figure>
<p>You may also make use of <code class="language-plaintext highlighter-rouge">spark.mesos.constraints</code> to set
attribute-based constraints on Mesos resource offers. By default, all
resource offers will be accepted.</p>
<figure class="highlight"><pre><code class="language-scala" data-lang="scala"><span class="nv">conf</span><span class="o">.</span><span class="py">set</span><span class="o">(</span><span class="s">"spark.mesos.constraints"</span><span class="o">,</span> <span class="s">"os:centos7;us-east-1:false"</span><span class="o">)</span></code></pre></figure>
<p>For example, Let&#8217;s say <code class="language-plaintext highlighter-rouge">spark.mesos.constraints</code> is set to <code class="language-plaintext highlighter-rouge">os:centos7;us-east-1:false</code>, then the resource offers will
be checked to see if they meet both these constraints and only then will be accepted to start new executors.</p>
<p>To constrain where driver tasks are run, use <code class="language-plaintext highlighter-rouge">spark.mesos.driver.constraints</code></p>
<h1 id="mesos-docker-support">Mesos Docker Support</h1>
<p>Spark can make use of a Mesos Docker containerizer by setting the property <code class="language-plaintext highlighter-rouge">spark.mesos.executor.docker.image</code>
in your <a href="configuration.html#spark-properties">SparkConf</a>.</p>
<p>The Docker image used must have an appropriate version of Spark already part of the image, or you can
have Mesos download Spark via the usual methods.</p>
<p>Requires Mesos version 0.20.1 or later.</p>
<p>Note that by default Mesos agents will not pull the image if it already exists on the agent. If you use mutable image
tags you can set <code class="language-plaintext highlighter-rouge">spark.mesos.executor.docker.forcePullImage</code> to <code class="language-plaintext highlighter-rouge">true</code> in order to force the agent to always pull the
image before running the executor. Force pulling images is only available in Mesos version 0.22 and above.</p>
<h1 id="running-alongside-hadoop">Running Alongside Hadoop</h1>
<p>You can run Spark and Mesos alongside your existing Hadoop cluster by just launching them as a
separate service on the machines. To access Hadoop data from Spark, a full <code class="language-plaintext highlighter-rouge">hdfs://</code> URL is required
(typically <code class="language-plaintext highlighter-rouge">hdfs://&lt;namenode&gt;:9000/path</code>, but you can find the right URL on your Hadoop Namenode web
UI).</p>
<p>In addition, it is possible to also run Hadoop MapReduce on Mesos for better resource isolation and
sharing between the two. In this case, Mesos will act as a unified scheduler that assigns cores to
either Hadoop or Spark, as opposed to having them share resources via the Linux scheduler on each
node. Please refer to <a href="https://github.com/mesos/hadoop">Hadoop on Mesos</a>.</p>
<p>In either case, HDFS runs separately from Hadoop MapReduce, without being scheduled through Mesos.</p>
<h1 id="dynamic-resource-allocation-with-mesos">Dynamic Resource Allocation with Mesos</h1>
<p>Mesos supports dynamic allocation only with coarse-grained mode, which can resize the number of
executors based on statistics of the application. For general information,
see <a href="job-scheduling.html#dynamic-resource-allocation">Dynamic Resource Allocation</a>.</p>
<p>The External Shuffle Service to use is the Mesos Shuffle Service. It provides shuffle data cleanup functionality
on top of the Shuffle Service since Mesos doesn&#8217;t yet support notifying another framework&#8217;s
termination. To launch it, run <code class="language-plaintext highlighter-rouge">$SPARK_HOME/sbin/start-mesos-shuffle-service.sh</code> on all agent nodes, with <code class="language-plaintext highlighter-rouge">spark.shuffle.service.enabled</code> set to <code class="language-plaintext highlighter-rouge">true</code>.</p>
<p>This can also be achieved through Marathon, using a unique host constraint, and the following command: <code class="language-plaintext highlighter-rouge">./bin/spark-class org.apache.spark.deploy.mesos.MesosExternalShuffleService</code>.</p>
<h1 id="configuration">Configuration</h1>
<p>See the <a href="configuration.html">configuration page</a> for information on Spark configurations. The following configs are specific for Spark on Mesos.</p>
<h4 id="spark-properties">Spark Properties</h4>
<table class="table">
<tr><th>Property Name</th><th>Default</th><th>Meaning</th><th>Since Version</th></tr>
<tr>
<td><code>spark.mesos.coarse</code></td>
<td>true</td>
<td>
If set to <code>true</code>, runs over Mesos clusters in "coarse-grained" sharing mode, where Spark acquires one long-lived Mesos task on each machine.
If set to <code>false</code>, runs over Mesos cluster in "fine-grained" sharing mode, where one Mesos task is created per Spark task.
Detailed information in <a href="running-on-mesos.html#mesos-run-modes">'Mesos Run Modes'</a>.
</td>
<td>0.6.0</td>
</tr>
<tr>
<td><code>spark.mesos.extra.cores</code></td>
<td><code>0</code></td>
<td>
Set the extra number of cores for an executor to advertise. This
does not result in more cores allocated. It instead means that an
executor will "pretend" it has more cores, so that the driver will
send it more tasks. Use this to increase parallelism. This
setting is only used for Mesos coarse-grained mode.
</td>
<td>0.6.0</td>
</tr>
<tr>
<td><code>spark.mesos.mesosExecutor.cores</code></td>
<td><code>1.0</code></td>
<td>
(Fine-grained mode only) Number of cores to give each Mesos executor. This does not
include the cores used to run the Spark tasks. In other words, even if no Spark task
is being run, each Mesos executor will occupy the number of cores configured here.
The value can be a floating point number.
</td>
<td>1.4.0</td>
</tr>
<tr>
<td><code>spark.mesos.executor.docker.image</code></td>
<td>(none)</td>
<td>
Set the name of the docker image that the Spark executors will run in. The selected
image must have Spark installed, as well as a compatible version of the Mesos library.
The installed path of Spark in the image can be specified with <code>spark.mesos.executor.home</code>;
the installed path of the Mesos library can be specified with <code>spark.executorEnv.MESOS_NATIVE_JAVA_LIBRARY</code>.
</td>
<td>1.4.0</td>
</tr>
<tr>
<td><code>spark.mesos.executor.docker.forcePullImage</code></td>
<td>false</td>
<td>
Force Mesos agents to pull the image specified in <code>spark.mesos.executor.docker.image</code>.
By default Mesos agents will not pull images they already have cached.
</td>
<td>2.1.0</td>
</tr>
<tr>
<td><code>spark.mesos.executor.docker.parameters</code></td>
<td>(none)</td>
<td>
Set the list of custom parameters which will be passed into the <code>docker run</code> command when launching the Spark executor on Mesos using the docker containerizer. The format of this property is a comma-separated list of
key/value pairs. Example:
<pre>key1=val1,key2=val2,key3=val3</pre>
</td>
<td>2.2.0</td>
</tr>
<tr>
<td><code>spark.mesos.executor.docker.volumes</code></td>
<td>(none)</td>
<td>
Set the list of volumes which will be mounted into the Docker image, which was set using
<code>spark.mesos.executor.docker.image</code>. The format of this property is a comma-separated list of
mappings following the form passed to <code>docker run -v</code>. That is they take the form:
<pre>[host_path:]container_path[:ro|:rw]</pre>
</td>
<td>1.4.0</td>
</tr>
<tr>
<td><code>spark.mesos.task.labels</code></td>
<td>(none)</td>
<td>
Set the Mesos labels to add to each task. Labels are free-form key-value pairs.
Key-value pairs should be separated by a colon, and commas used to
list more than one. If your label includes a colon or comma, you
can escape it with a backslash. Ex. key:value,key2:a\:b.
</td>
<td>2.2.0</td>
</tr>
<tr>
<td><code>spark.mesos.executor.home</code></td>
<td>driver side <code>SPARK_HOME</code></td>
<td>
Set the directory in which Spark is installed on the executors in Mesos. By default, the
executors will simply use the driver's Spark home directory, which may not be visible to
them. Note that this is only relevant if a Spark binary package is not specified through
<code>spark.executor.uri</code>.
</td>
<td>1.1.1</td>
</tr>
<tr>
<td><code>spark.mesos.executor.memoryOverhead</code></td>
<td>executor memory * 0.10, with minimum of 384</td>
<td>
The amount of additional memory, specified in MiB, to be allocated per executor. By default,
the overhead will be larger of either 384 or 10% of <code>spark.executor.memory</code>. If set,
the final overhead will be this value.
</td>
<td>1.1.1</td>
</tr>
<tr>
<td><code>spark.mesos.driver.memoryOverhead</code></td>
<td>driver memory * 0.10, with minimum of 384</td>
<td>
The amount of additional memory, specified in MB, to be allocated to the driver. By default,
the overhead will be larger of either 384 or 10% of <code>spark.driver.memory</code>. If set,
the final overhead will be this value. Only applies to cluster mode.
</td>
</tr>
<tr>
<td><code>spark.mesos.uris</code></td>
<td>(none)</td>
<td>
A comma-separated list of URIs to be downloaded to the sandbox
when driver or executor is launched by Mesos. This applies to
both coarse-grained and fine-grained mode.
</td>
<td>1.5.0</td>
</tr>
<tr>
<td><code>spark.mesos.principal</code></td>
<td>(none)</td>
<td>
Set the principal with which Spark framework will use to authenticate with Mesos. You can also specify this via the environment variable `SPARK_MESOS_PRINCIPAL`.
</td>
<td>1.5.0</td>
</tr>
<tr>
<td><code>spark.mesos.principal.file</code></td>
<td>(none)</td>
<td>
Set the file containing the principal with which Spark framework will use to authenticate with Mesos. Allows specifying the principal indirectly in more security conscious deployments. The file must be readable by the user launching the job and be UTF-8 encoded plaintext. You can also specify this via the environment variable `SPARK_MESOS_PRINCIPAL_FILE`.
</td>
<td>2.4.0</td>
</tr>
<tr>
<td><code>spark.mesos.secret</code></td>
<td>(none)</td>
<td>
Set the secret with which Spark framework will use to authenticate with Mesos. Used, for example, when
authenticating with the registry. You can also specify this via the environment variable `SPARK_MESOS_SECRET`.
</td>
<td>1.5.0</td>
</tr>
<tr>
<td><code>spark.mesos.secret.file</code></td>
<td>(none)</td>
<td>
Set the file containing the secret with which Spark framework will use to authenticate with Mesos. Used, for example, when
authenticating with the registry. Allows for specifying the secret indirectly in more security conscious deployments. The file must be readable by the user launching the job and be UTF-8 encoded plaintext. You can also specify this via the environment variable `SPARK_MESOS_SECRET_FILE`.
</td>
<td>2.4.0</td>
</tr>
<tr>
<td><code>spark.mesos.role</code></td>
<td><code>*</code></td>
<td>
Set the role of this Spark framework for Mesos. Roles are used in Mesos for reservations
and resource weight sharing.
</td>
<td>1.5.0</td>
</tr>
<tr>
<td><code>spark.mesos.constraints</code></td>
<td>(none)</td>
<td>
Attribute-based constraints on mesos resource offers. By default, all resource offers will be accepted. This setting
applies only to executors. Refer to <a href="http://mesos.apache.org/documentation/attributes-resources/">Mesos
Attributes &amp; Resources</a> for more information on attributes.
<ul>
<li>Scalar constraints are matched with "less than equal" semantics i.e. value in the constraint must be less than or equal to the value in the resource offer.</li>
<li>Range constraints are matched with "contains" semantics i.e. value in the constraint must be within the resource offer's value.</li>
<li>Set constraints are matched with "subset of" semantics i.e. value in the constraint must be a subset of the resource offer's value.</li>
<li>Text constraints are matched with "equality" semantics i.e. value in the constraint must be exactly equal to the resource offer's value.</li>
<li>In case there is no value present as a part of the constraint any offer with the corresponding attribute will be accepted (without value check).</li>
</ul>
</td>
<td>1.5.0</td>
</tr>
<tr>
<td><code>spark.mesos.driver.constraints</code></td>
<td>(none)</td>
<td>
Same as <code>spark.mesos.constraints</code> except applied to drivers when launched through the dispatcher. By default,
all offers with sufficient resources will be accepted.
</td>
<td>2.2.1</td>
</tr>
<tr>
<td><code>spark.mesos.containerizer</code></td>
<td><code>docker</code></td>
<td>
This only affects docker containers, and must be one of "docker"
or "mesos". Mesos supports two types of
containerizers for docker: the "docker" containerizer, and the preferred
"mesos" containerizer. Read more here: http://mesos.apache.org/documentation/latest/container-image/
</td>
<td>2.1.0</td>
</tr>
<tr>
<td><code>spark.mesos.driver.webui.url</code></td>
<td><code>(none)</code></td>
<td>
Set the Spark Mesos driver webui_url for interacting with the framework.
If unset it will point to Spark's internal web UI.
</td>
<td>2.0.0</td>
</tr>
<tr>
<td><code>spark.mesos.driver.labels</code></td>
<td><code>(none)</code></td>
<td>
Mesos labels to add to the driver. See <code>spark.mesos.task.labels</code>
for formatting information.
</td>
<td>2.3.0</td>
</tr>
<tr>
<td>
<code>spark.mesos.driver.secret.values</code>,
<code>spark.mesos.driver.secret.names</code>,
<code>spark.mesos.executor.secret.values</code>,
<code>spark.mesos.executor.secret.names</code>,
</td>
<td><code>(none)</code></td>
<td>
<p>
A secret is specified by its contents and destination. These properties
specify a secret's contents. To specify a secret's destination, see the cell below.
</p>
<p>
You can specify a secret's contents either (1) by value or (2) by reference.
</p>
<p>
(1) To specify a secret by value, set the
<code>spark.mesos.[driver|executor].secret.values</code>
property, to make the secret available in the driver or executors.
For example, to make a secret password "guessme" available to the driver process, set:
<pre>spark.mesos.driver.secret.values=guessme</pre>
</p>
<p>
(2) To specify a secret that has been placed in a secret store
by reference, specify its name within the secret store
by setting the <code>spark.mesos.[driver|executor].secret.names</code>
property. For example, to make a secret password named "password" in a secret store
available to the driver process, set:
<pre>spark.mesos.driver.secret.names=password</pre>
</p>
<p>
Note: To use a secret store, make sure one has been integrated with Mesos via a custom
<a href="http://mesos.apache.org/documentation/latest/secrets/">SecretResolver
module</a>.
</p>
<p>
To specify multiple secrets, provide a comma-separated list:
<pre>spark.mesos.driver.secret.values=guessme,passwd123</pre>
or
<pre>spark.mesos.driver.secret.names=password1,password2</pre>
</p>
</td>
<td>2.3.0</td>
</tr>
<tr>
<td>
<code>spark.mesos.driver.secret.envkeys</code>,
<code>spark.mesos.driver.secret.filenames</code>,
<code>spark.mesos.executor.secret.envkeys</code>,
<code>spark.mesos.executor.secret.filenames</code>,
</td>
<td><code>(none)</code></td>
<td>
<p>
A secret is specified by its contents and destination. These properties
specify a secret's destination. To specify a secret's contents, see the cell above.
</p>
<p>
You can specify a secret's destination in the driver or
executors as either (1) an environment variable or (2) as a file.
</p>
<p>
(1) To make an environment-based secret, set the
<code>spark.mesos.[driver|executor].secret.envkeys</code> property.
The secret will appear as an environment variable with the
given name in the driver or executors. For example, to make a secret password available
to the driver process as $PASSWORD, set:
<pre>spark.mesos.driver.secret.envkeys=PASSWORD</pre>
</p>
<p>
(2) To make a file-based secret, set the
<code>spark.mesos.[driver|executor].secret.filenames</code> property.
The secret will appear in the contents of a file with the given file name in
the driver or executors. For example, to make a secret password available in a
file named "pwdfile" in the driver process, set:
<pre>spark.mesos.driver.secret.filenames=pwdfile</pre>
</p>
<p>
Paths are relative to the container's work directory. Absolute paths must
already exist. Note: File-based secrets require a custom
<a href="http://mesos.apache.org/documentation/latest/secrets/">SecretResolver
module</a>.
</p>
<p>
To specify env vars or file names corresponding to multiple secrets,
provide a comma-separated list:
<pre>spark.mesos.driver.secret.envkeys=PASSWORD1,PASSWORD2</pre>
or
<pre>spark.mesos.driver.secret.filenames=pwdfile1,pwdfile2</pre>
</p>
</td>
<td>2.3.0</td>
</tr>
<tr>
<td><code>spark.mesos.driverEnv.[EnvironmentVariableName]</code></td>
<td><code>(none)</code></td>
<td>
This only affects drivers submitted in cluster mode. Add the
environment variable specified by EnvironmentVariableName to the
driver process. The user can specify multiple of these to set
multiple environment variables.
</td>
<td>2.1.0</td>
</tr>
<tr>
<td><code>spark.mesos.dispatcher.webui.url</code></td>
<td><code>(none)</code></td>
<td>
Set the Spark Mesos dispatcher webui_url for interacting with the framework.
If unset it will point to Spark's internal web UI.
</td>
<td>2.0.0</td>
</tr>
<tr>
<td><code>spark.mesos.dispatcher.driverDefault.[PropertyName]</code></td>
<td><code>(none)</code></td>
<td>
Set default properties for drivers submitted through the
dispatcher. For example,
spark.mesos.dispatcher.driverProperty.spark.executor.memory=32g
results in the executors for all drivers submitted in cluster mode
to run in 32g containers.
</td>
<td>2.1.0</td>
</tr>
<tr>
<td><code>spark.mesos.dispatcher.historyServer.url</code></td>
<td><code>(none)</code></td>
<td>
Set the URL of the <a href="monitoring.html#viewing-after-the-fact">history
server</a>. The dispatcher will then link each driver to its entry
in the history server.
</td>
<td>2.1.0</td>
</tr>
<tr>
<td><code>spark.mesos.dispatcher.queue</code></td>
<td><code>(none)</code></td>
<td>
Set the name of the dispatcher queue to which the application is submitted.
The specified queue must be added to the dispatcher with <code>spark.mesos.dispatcher.queue.[QueueName]</code>.
If no queue is specified, then the application is submitted to the "default" queue with 0.0 priority.
</td>
<td>3.1.0</td>
</tr>
<tr>
<td><code>spark.mesos.dispatcher.queue.[QueueName]</code></td>
<td><code>0.0</code></td>
<td>
Add a new queue for submitted drivers with the specified priority.
Higher numbers indicate higher priority.
The user can specify multiple queues to define a workload management policy for queued drivers in the dispatcher.
A driver can then be submitted to a specific queue with <code>spark.mesos.dispatcher.queue</code>.
By default, the dispatcher has a single queue with 0.0 priority (cannot be overridden).
It is possible to implement a consistent and overall workload management policy throughout the lifecycle of drivers
by mapping priority queues to weighted Mesos roles, and by specifying a
<code>spark.mesos.role</code> along with a <code>spark.mesos.dispatcher.queue</code> when submitting an application.
For example, with the URGENT Mesos role:
<pre>
spark.mesos.dispatcher.queue.URGENT=1.0
spark.mesos.dispatcher.queue=URGENT
spark.mesos.role=URGENT
</pre>
</td>
<td>3.1.0</td>
</tr>
<tr>
<td><code>spark.mesos.gpus.max</code></td>
<td><code>0</code></td>
<td>
Set the maximum number GPU resources to acquire for this job. Note that executors will still launch when no GPU resources are found
since this configuration is just an upper limit and not a guaranteed amount.
</td>
<td>2.1.0</td>
</tr>
<tr>
<td><code>spark.mesos.network.name</code></td>
<td><code>(none)</code></td>
<td>
Attach containers to the given named network. If this job is
launched in cluster mode, also launch the driver in the given named
network. See
<a href="http://mesos.apache.org/documentation/latest/cni/">the Mesos CNI docs</a>
for more details.
</td>
<td>2.1.0</td>
</tr>
<tr>
<td><code>spark.mesos.network.labels</code></td>
<td><code>(none)</code></td>
<td>
Pass network labels to CNI plugins. This is a comma-separated list
of key-value pairs, where each key-value pair has the format key:value.
Example:
<pre>key1:val1,key2:val2</pre>
See
<a href="http://mesos.apache.org/documentation/latest/cni/#mesos-meta-data-to-cni-plugins">the Mesos CNI docs</a>
for more details.
</td>
<td>2.3.0</td>
</tr>
<tr>
<td><code>spark.mesos.fetcherCache.enable</code></td>
<td><code>false</code></td>
<td>
If set to `true`, all URIs (example: `spark.executor.uri`,
`spark.mesos.uris`) will be cached by the <a href="http://mesos.apache.org/documentation/latest/fetcher/">Mesos
Fetcher Cache</a>
</td>
<td>2.1.0</td>
</tr>
<tr>
<td><code>spark.mesos.driver.failoverTimeout</code></td>
<td><code>0.0</code></td>
<td>
The amount of time (in seconds) that the master will wait for the
driver to reconnect, after being temporarily disconnected, before
it tears down the driver framework by killing all its
executors. The default value is zero, meaning no timeout: if the
driver disconnects, the master immediately tears down the framework.
</td>
<td>2.3.0</td>
</tr>
<tr>
<td><code>spark.mesos.rejectOfferDuration</code></td>
<td><code>120s</code></td>
<td>
Time to consider unused resources refused, serves as a fallback of
`spark.mesos.rejectOfferDurationForUnmetConstraints`,
`spark.mesos.rejectOfferDurationForReachedMaxCores`
</td>
<td>2.2.0</td>
</tr>
<tr>
<td><code>spark.mesos.rejectOfferDurationForUnmetConstraints</code></td>
<td><code>spark.mesos.rejectOfferDuration</code></td>
<td>
Time to consider unused resources refused with unmet constraints
</td>
<td>1.6.0</td>
</tr>
<tr>
<td><code>spark.mesos.rejectOfferDurationForReachedMaxCores</code></td>
<td><code>spark.mesos.rejectOfferDuration</code></td>
<td>
Time to consider unused resources refused when maximum number of cores
<code>spark.cores.max</code> is reached
</td>
<td>2.0.0</td>
</tr>
<tr>
<td><code>spark.mesos.appJar.local.resolution.mode</code></td>
<td><code>host</code></td>
<td>
Provides support for the `local:///` scheme to reference the app jar resource in cluster mode.
If user uses a local resource (`local:///path/to/jar`) and the config option is not used it defaults to `host` e.g.
the mesos fetcher tries to get the resource from the host's file system.
If the value is unknown it prints a warning msg in the dispatcher logs and defaults to `host`.
If the value is `container` then spark submit in the container will use the jar in the container's path:
`/path/to/jar`.
</td>
<td>2.4.0</td>
</tr>
</table>
<h1 id="troubleshooting-and-debugging">Troubleshooting and Debugging</h1>
<p>A few places to look during debugging:</p>
<ul>
<li>Mesos master on port <code class="language-plaintext highlighter-rouge">:5050</code>
<ul>
<li>Agents should appear in the agents tab</li>
<li>Spark applications should appear in the frameworks tab</li>
<li>Tasks should appear in the details of a framework</li>
<li>Check the stdout and stderr of the sandbox of failed tasks</li>
</ul>
</li>
<li>Mesos logs
<ul>
<li>Master and agent logs are both in <code class="language-plaintext highlighter-rouge">/var/log/mesos</code> by default</li>
</ul>
</li>
</ul>
<p>And common pitfalls:</p>
<ul>
<li>Spark assembly not reachable/accessible
<ul>
<li>Agents must be able to download the Spark binary package from the <code class="language-plaintext highlighter-rouge">http://</code>, <code class="language-plaintext highlighter-rouge">hdfs://</code> or <code class="language-plaintext highlighter-rouge">s3n://</code> URL you gave</li>
</ul>
</li>
<li>Firewall blocking communications
<ul>
<li>Check for messages about failed connections</li>
<li>Temporarily disable firewalls for debugging and then poke appropriate holes</li>
</ul>
</li>
</ul>
</div>
<!-- /container -->
</div>
<script src="js/vendor/jquery-3.5.1.min.js"></script>
<script src="js/vendor/bootstrap.bundle.min.js"></script>
<script src="js/vendor/anchor.min.js"></script>
<script src="js/main.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
<script type="text/javascript">
// DocSearch is entirely free and automated. DocSearch is built in two parts:
// 1. a crawler which we run on our own infrastructure every 24 hours. It follows every link
// in your website and extract content from every page it traverses. It then pushes this
// content to an Algolia index.
// 2. a JavaScript snippet to be inserted in your website that will bind this Algolia index
// to your search input and display its results in a dropdown UI. If you want to find more
// details on how works DocSearch, check the docs of DocSearch.
docsearch({
apiKey: 'd62f962a82bc9abb53471cb7b89da35e',
appId: 'RAI69RXRSK',
indexName: 'apache_spark',
inputSelector: '#docsearch-input',
enhancedSearchInput: true,
algoliaOptions: {
'facetFilters': ["version:3.2.4"]
},
debug: false // Set debug to true if you want to inspect the dropdown
});
</script>
<!-- MathJax Section -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { equationNumbers: { autoNumber: "AMS" } }
});
</script>
<script>
// Note that we load MathJax this way to work with local file (file://), HTTP and HTTPS.
// We could use "//cdn.mathjax...", but that won't support "file://".
(function(d, script) {
script = d.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.onload = function(){
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ["$", "$"], ["\\\\(","\\\\)"] ],
displayMath: [ ["$$","$$"], ["\\[", "\\]"] ],
processEscapes: true,
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre']
}
});
};
script.src = ('https:' == document.location.protocol ? 'https://' : 'http://') +
'cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js' +
'?config=TeX-AMS-MML_HTMLorMML';
d.getElementsByTagName('head')[0].appendChild(script);
}(document));
</script>
</body>
</html>