summaryrefslogblamecommitdiff
path: root/site/docs/1.5.1/running-on-mesos.html
blob: 13e803f58fa1137250c0e409100561d02f8c8198 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575






























































































































































































































































































































































































































































































































































































                                                                                                                                                                                                                                                                                                                                                                             
<!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 1.5.1 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/bootstrap-responsive.min.css">
        <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">

        
        <!-- Google analytics script -->
        <script type="text/javascript">
          var _gaq = _gaq || [];
          _gaq.push(['_setAccount', 'UA-32518208-2']);
          _gaq.push(['_trackPageview']);

          (function() {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
          })();
        </script>
        

    </head>
    <body>
        <!--[if lt IE 7]>
            <p class="chromeframe">You are using an outdated browser. <a href="http://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 -->

        <div class="navbar navbar-fixed-top" id="topbar">
            <div class="navbar-inner">
                <div class="container">
                    <div class="brand"><a href="index.html">
                      <img src="img/spark-logo-hd.png" style="height:50px;"/></a><span class="version">1.5.1</span>
                    </div>
                    <ul class="nav">
                        <!--TODO(andyk): Add class="active" attribute to li some how.-->
                        <li><a href="index.html">Overview</a></li>

                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Programming Guides<b class="caret"></b></a>
                            <ul class="dropdown-menu">
                                <li><a href="quick-start.html">Quick Start</a></li>
                                <li><a href="programming-guide.html">Spark Programming Guide</a></li>
                                <li class="divider"></li>
                                <li><a href="streaming-programming-guide.html">Spark Streaming</a></li>
                                <li><a href="sql-programming-guide.html">DataFrames and SQL</a></li>
                                <li><a href="mllib-guide.html">MLlib (Machine Learning)</a></li>
                                <li><a href="graphx-programming-guide.html">GraphX (Graph Processing)</a></li>
                                <li><a href="bagel-programming-guide.html">Bagel (Pregel on Spark)</a></li>
                                <li><a href="sparkr.html">SparkR (R on Spark)</a></li>
                            </ul>
                        </li>

                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">API Docs<b class="caret"></b></a>
                            <ul class="dropdown-menu">
                                <li><a href="api/scala/index.html#org.apache.spark.package">Scala</a></li>
                                <li><a href="api/java/index.html">Java</a></li>
                                <li><a href="api/python/index.html">Python</a></li>
                                <li><a href="api/R/index.html">R</a></li>
                            </ul>
                        </li>

                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Deploying<b class="caret"></b></a>
                            <ul class="dropdown-menu">
                                <li><a href="cluster-overview.html">Overview</a></li>
                                <li><a href="submitting-applications.html">Submitting Applications</a></li>
                                <li class="divider"></li>
                                <li><a href="spark-standalone.html">Spark Standalone</a></li>
                                <li><a href="running-on-mesos.html">Mesos</a></li>
                                <li><a href="running-on-yarn.html">YARN</a></li>
                                <li class="divider"></li>
                                <li><a href="ec2-scripts.html">Amazon EC2</a></li>
                            </ul>
                        </li>

                        <li class="dropdown">
                            <a href="api.html" class="dropdown-toggle" data-toggle="dropdown">More<b class="caret"></b></a>
                            <ul class="dropdown-menu">
                                <li><a href="configuration.html">Configuration</a></li>
                                <li><a href="monitoring.html">Monitoring</a></li>
                                <li><a href="tuning.html">Tuning Guide</a></li>
                                <li><a href="job-scheduling.html">Job Scheduling</a></li>
                                <li><a href="security.html">Security</a></li>
                                <li><a href="hardware-provisioning.html">Hardware Provisioning</a></li>
                                <li><a href="hadoop-third-party-distributions.html">3<sup>rd</sup>-Party Hadoop Distros</a></li>
                                <li class="divider"></li>
                                <li><a href="building-spark.html">Building Spark</a></li>
                                <li><a href="https://cwiki.apache.org/confluence/display/SPARK/Contributing+to+Spark">Contributing to Spark</a></li>
                                <li><a href="https://cwiki.apache.org/confluence/display/SPARK/Supplemental+Spark+Projects">Supplemental Projects</a></li>
                            </ul>
                        </li>
                    </ul>
                    <!--<p class="navbar-text pull-right"><span class="version-text">v1.5.1</span></p>-->
                </div>
            </div>
        </div>

        <div class="container" id="content">
          
            <h1 class="title">Running Spark on Mesos</h1>
          

          <ul id="markdown-toc">
  <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="#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></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>
</ul>

<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/mesos-frameworks/">frameworks</a></li>
  <li>scalable partitioning between multiple instances of Spark</li>
</ul>

<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 1.5.1 is designed for use with Mesos 0.21.0 and does not
require any special patches of Mesos.</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/0.21.0/">mirror</a></li>
  <li>Follow the Mesos <a href="http://mesos.apache.org/gettingstarted">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>--prefix</code> option to <code>configure</code> to tell it where to install. For example, pass
<code>--prefix=/home/me/mesos</code>. By default the prefix is <code>/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="http://mesosphere.io/downloads/">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>:5050</code>  Confirm that all expected machines are present in the slaves 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 slaves, and configure
<code>spark.mesos.executor.home</code> (defaults to SPARK_HOME) to point to that location.</p>

<h2 id="uploading-spark-package">Uploading Spark Package</h2>

<p>When Mesos runs a task on a Mesos slave for the first time, that slave 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>http://</code>,
<a href="http://aws.amazon.com/s3">Amazon Simple Storage Service</a> via <code>s3n://</code>, or HDFS via <code>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>hadoop fs -put spark-1.5.1.tar.gz
/path/to/spark-1.5.1.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>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>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>mesos://host:5050</code> for a single-master Mesos
cluster, or <code>mesos://zk://host:2181</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>spark-env.sh</code> to interact properly with Mesos:</p>

<ol>
  <li>In <code>spark-env.sh</code> set some environment variables:
    <ul>
      <li><code>export MESOS_NATIVE_JAVA_LIBRARY=&lt;path to libmesos.so&gt;</code>. This path is typically
<code>&lt;prefix&gt;/lib/libmesos.so</code> where the prefix is <code>/usr/local</code> by default. See Mesos installation
instructions above. On Mac OS X, the library is called <code>libmesos.dylib</code> instead of
<code>libmesos.so</code>.</li>
      <li><code>export SPARK_EXECUTOR_URI=&lt;URL of spark-1.5.1.tar.gz uploaded above&gt;</code>.</li>
    </ul>
  </li>
  <li>Also set <code>spark.executor.uri</code> to <code>&lt;URL of spark-1.5.1.tar.gz&gt;</code>.</li>
</ol>

<p>Now when starting a Spark application against the cluster, pass a <code>mesos://</code>
URL as the master when creating a <code>SparkContext</code>. For example:</p>

<div class="highlight"><pre><code class="language-scala" data-lang="scala"><span class="k">val</span> <span class="n">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="n">setMaster</span><span class="o">(</span><span class="s">&quot;mesos://HOST:5050&quot;</span><span class="o">)</span>
  <span class="o">.</span><span class="n">setAppName</span><span class="o">(</span><span class="s">&quot;My app&quot;</span><span class="o">)</span>
  <span class="o">.</span><span class="n">set</span><span class="o">(</span><span class="s">&quot;spark.executor.uri&quot;</span><span class="o">,</span> <span class="s">&quot;&lt;path to spark-1.5.1.tar.gz uploaded above&gt;&quot;</span><span class="o">)</span>
<span class="k">val</span> <span class="n">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></div>

<p>(You can also use <a href="submitting-applications.html"><code>spark-submit</code></a> and configure <code>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>spark.executor.uri</code> parameter is inherited from <code>SPARK_EXECUTOR_URI</code>, so
it does not need to be redundantly passed in as a system property.</p>

<div class="highlight"><pre><code class="language-bash" data-lang="bash">./bin/spark-shell --master mesos://host:5050</code></pre></div>

<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 MesosClusterDispatcher in your cluster via the <code>sbin/start-mesos-dispatcher.sh</code> script,
passing in the Mesos master url (e.g: mesos://host:5050).</p>

<p>From the client, you can submit a job to Mesos cluster by running <code>spark-submit</code> and specifying the master url
to the url of the MesosClusterDispatcher (e.g: mesos://dispatcher:7077). You can view driver statuses on the
Spark cluster Web UI.</p>

<h1 id="mesos-run-modes">Mesos Run Modes</h1>

<p>Spark can run over Mesos in two modes: &#8220;fine-grained&#8221; (default) and &#8220;coarse-grained&#8221;.</p>

<p>In &#8220;fine-grained&#8221; mode (default), each Spark task runs as a separate Mesos task. This allows
multiple instances of Spark (and other frameworks) to share machines at a very fine granularity,
where each application gets more or fewer machines 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>The &#8220;coarse-grained&#8221; mode will instead launch only <em>one</em> long-running Spark task on each Mesos
machine, and dynamically schedule its own &#8220;mini-tasks&#8221; within it. The benefit is much lower startup
overhead, but at the cost of reserving the Mesos resources for the complete duration of the
application.</p>

<p>To run in coarse-grained mode, set the <code>spark.mesos.coarse</code> property in your
<a href="configuration.html#spark-properties">SparkConf</a>:</p>

<div class="highlight"><pre><code class="language-scala" data-lang="scala"><span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="o">(</span><span class="s">&quot;spark.mesos.coarse&quot;</span><span class="o">,</span> <span class="s">&quot;true&quot;</span><span class="o">)</span></code></pre></div>

<p>In addition, for coarse-grained mode, you can control the maximum number of resources Spark will
acquire. By default, it will acquire <em>all</em> cores in the cluster (that get offered by Mesos), which
only makes sense if you run just one application at a time. You can cap the maximum number of cores
using <code>conf.set("spark.cores.max", "10")</code> (for example).</p>

<p>You may also make use of <code>spark.mesos.constraints</code> to set attribute based constraints on mesos resource offers. By default, all resource offers will be accepted.</p>

<div class="highlight"><pre><code class="language-scala" data-lang="scala"><span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="o">(</span><span class="s">&quot;spark.mesos.constraints&quot;</span><span class="o">,</span> <span class="s">&quot;tachyon:true;us-east-1:false&quot;</span><span class="o">)</span></code></pre></div>

<p>For example, Let&#8217;s say <code>spark.mesos.constraints</code> is set to <code>tachyon:true;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>

<h1 id="mesos-docker-support">Mesos Docker Support</h1>

<p>Spark can make use of a Mesos Docker containerizer by setting the property <code>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>

<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>hdfs://</code> URL is required
(typically <code>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 grain mode, which can resize the number of executors based on statistics
of the application. While dynamic allocation supports both scaling up and scaling down the number of executors, the coarse grain scheduler only supports scaling down
since it is already designed to run one executor per slave with the configured amount of resources. However, after scaling down the number of executors the coarse grain scheduler
can scale back up to the same amount of executors when Spark signals more executors are needed.</p>

<p>Users that like to utilize this feature should launch the Mesos Shuffle Service that
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/stop the Mesos Shuffle Service please use the provided sbin/start-mesos-shuffle-service.sh and sbin/stop-mesos-shuffle-service.sh
scripts accordingly.</p>

<p>The Shuffle Service is expected to be running on each slave node that will run Spark executors. One way to easily achieve this with Mesos
is to launch the Shuffle Service with Marathon with a unique host constraint.</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></tr>
<tr>
  <td><code>spark.mesos.coarse</code></td>
  <td>false</td>
  <td>
    If set to "true", runs over Mesos clusters in
    <a href="running-on-mesos.html#mesos-run-modes">"coarse-grained" sharing mode</a>,
    where Spark acquires one long-lived Mesos task on each machine instead of one Mesos task per
    Spark task. This gives lower-latency scheduling for short queries, but leaves resources in use
    for the whole duration of the Spark job.
  </td>
</tr>
<tr>
  <td><code>spark.mesos.extra.cores</code></td>
  <td>0</td>
  <td>
    Set the extra amount of cpus to request per task. This setting is only used for Mesos coarse grain mode.
    The total amount of cores requested per task is the number of cores in the offer plus the extra cores configured.
    Note that total amount of cores the executor will request in total will not exceed the spark.cores.max setting.
  </td>
</tr>
<tr>
  <td><code>spark.mesos.mesosExecutor.cores</code></td>
  <td>1.0</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>
</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_LIBRARY</code>.
  </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 <tt>docker run -v</tt>. That is they take the form:

    <pre>[host_path:]container_path[:ro|:rw]</pre>
  </td>
</tr>
<tr>
  <td><code>spark.mesos.executor.docker.portmaps</code></td>
  <td>(none)</td>
  <td>
    Set the list of incoming ports exposed by 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 which take the form:

    <pre>host_port:container_port[:tcp|:udp]</pre>
  </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>
</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 MB, to be allocated per executor. By default,
    the overhead will be larger of either 384 or 10% of `spark.executor.memory`. If it's set,
    the final overhead will be this value.
  </td>
</tr>
<tr>
  <td><code>spark.mesos.uris</code></td>
  <td>(none)</td>
  <td>
    A list of URIs to be downloaded to the sandbox when driver or executor is launched by Mesos.
    This applies to both coarse-grain and fine-grain mode.
  </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.
  </td>
</tr>
<tr>
  <td><code>spark.mesos.secret</code></td>
  <td>(none)/td&gt;
  <td>
    Set the secret with which Spark framework will use to authenticate with Mesos.
  </td>

<tr>
  <td><code>spark.mesos.role</code></td>
  <td>*</td>
  <td>
    Set the role of this Spark framework for Mesos. Roles are used in Mesos for reservations
    and resource weight sharing.
  </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. 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 metched 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>
</tr>


# Troubleshooting and Debugging

A few places to look during debugging:

- Mesos master on port `:5050`
  - Slaves should appear in the slaves tab
  - Spark applications should appear in the frameworks tab
  - Tasks should appear in the details of a framework
  - Check the stdout and stderr of the sandbox of failed tasks
- Mesos logs
  - Master and slave logs are both in `/var/log/mesos` by default

And common pitfalls:

- Spark assembly not reachable/accessible
  - Slaves must be able to download the Spark binary package from the `http://`, `hdfs://` or `s3n://` URL you gave
- Firewall blocking communications
  - Check for messages about failed connections
  - Temporarily disable firewalls for debugging and then poke appropriate holes
</td></tr></table>


        </div> <!-- /container -->

        <script src="js/vendor/jquery-1.8.0.min.js"></script>
        <script src="js/vendor/bootstrap.min.js"></script>
        <script src="js/vendor/anchor.min.js"></script>
        <script src="js/main.js"></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://') +
                    'cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
                d.getElementsByTagName('head')[0].appendChild(script);
            }(document));
        </script>
    </body>
</html>