aboutsummaryrefslogtreecommitdiff
path: root/docs/running-on-yarn.md
diff options
context:
space:
mode:
authorJacek Laskowski <jacek.laskowski@deepsense.io>2015-09-21 19:46:39 +0100
committerSean Owen <sowen@cloudera.com>2015-09-21 19:46:39 +0100
commitca9fe540fe04e2e230d1e76526b5502bab152914 (patch)
tree48b2bde988e1162e2528aae9452f1b84d3680148 /docs/running-on-yarn.md
parentebbf85f07bb8de0d566f1ae4b41f26421180bebe (diff)
downloadspark-ca9fe540fe04e2e230d1e76526b5502bab152914.tar.gz
spark-ca9fe540fe04e2e230d1e76526b5502bab152914.tar.bz2
spark-ca9fe540fe04e2e230d1e76526b5502bab152914.zip
[SPARK-10662] [DOCS] Code snippets are not properly formatted in tables
* Backticks are processed properly in Spark Properties table * Removed unnecessary spaces * See http://people.apache.org/~pwendell/spark-nightly/spark-master-docs/latest/running-on-yarn.html Author: Jacek Laskowski <jacek.laskowski@deepsense.io> Closes #8795 from jaceklaskowski/docs-yarn-formatting.
Diffstat (limited to 'docs/running-on-yarn.md')
-rw-r--r--docs/running-on-yarn.md106
1 files changed, 54 insertions, 52 deletions
diff --git a/docs/running-on-yarn.md b/docs/running-on-yarn.md
index 3a961d245f..0e25ccf512 100644
--- a/docs/running-on-yarn.md
+++ b/docs/running-on-yarn.md
@@ -23,7 +23,7 @@ Unlike [Spark standalone](spark-standalone.html) and [Mesos](running-on-mesos.ht
To launch a Spark application in `yarn-cluster` mode:
$ ./bin/spark-submit --class path.to.your.Class --master yarn-cluster [options] <app jar> [app options]
-
+
For example:
$ ./bin/spark-submit --class org.apache.spark.examples.SparkPi \
@@ -43,7 +43,7 @@ To launch a Spark application in `yarn-client` mode, do the same, but replace `y
## Adding Other JARs
-In `yarn-cluster` mode, the driver runs on a different machine than the client, so `SparkContext.addJar` won't work out of the box with files that are local to the client. To make files on the client available to `SparkContext.addJar`, include them with the `--jars` option in the launch command.
+In `yarn-cluster` mode, the driver runs on a different machine than the client, so `SparkContext.addJar` won't work out of the box with files that are local to the client. To make files on the client available to `SparkContext.addJar`, include them with the `--jars` option in the launch command.
$ ./bin/spark-submit --class my.main.Class \
--master yarn-cluster \
@@ -64,16 +64,16 @@ Most of the configs are the same for Spark on YARN as for other deployment modes
# Debugging your Application
-In YARN terminology, executors and application masters run inside "containers". YARN has two modes for handling container logs after an application has completed. If log aggregation is turned on (with the `yarn.log-aggregation-enable` config), container logs are copied to HDFS and deleted on the local machine. These logs can be viewed from anywhere on the cluster with the "yarn logs" command.
+In YARN terminology, executors and application masters run inside "containers". YARN has two modes for handling container logs after an application has completed. If log aggregation is turned on (with the `yarn.log-aggregation-enable` config), container logs are copied to HDFS and deleted on the local machine. These logs can be viewed from anywhere on the cluster with the `yarn logs` command.
yarn logs -applicationId <app ID>
-
+
will print out the contents of all log files from all containers from the given application. You can also view the container log files directly in HDFS using the HDFS shell or API. The directory where they are located can be found by looking at your YARN configs (`yarn.nodemanager.remote-app-log-dir` and `yarn.nodemanager.remote-app-log-dir-suffix`). The logs are also available on the Spark Web UI under the Executors Tab. You need to have both the Spark history server and the MapReduce history server running and configure `yarn.log.server.url` in `yarn-site.xml` properly. The log URL on the Spark history server UI will redirect you to the MapReduce history server to show the aggregated logs.
When log aggregation isn't turned on, logs are retained locally on each machine under `YARN_APP_LOGS_DIR`, which is usually configured to `/tmp/logs` or `$HADOOP_HOME/logs/userlogs` depending on the Hadoop version and installation. Viewing logs for a container requires going to the host that contains them and looking in this directory. Subdirectories organize log files by application ID and container ID. The logs are also available on the Spark Web UI under the Executors Tab and doesn't require running the MapReduce history server.
To review per-container launch environment, increase `yarn.nodemanager.delete.debug-delay-sec` to a
-large value (e.g. 36000), and then access the application cache through `yarn.nodemanager.local-dirs`
+large value (e.g. `36000`), and then access the application cache through `yarn.nodemanager.local-dirs`
on the nodes on which containers are launched. This directory contains the launch script, JARs, and
all environment variables used for launching each container. This process is useful for debugging
classpath problems in particular. (Note that enabling this requires admin privileges on cluster
@@ -92,7 +92,7 @@ Note that for the first option, both executors and the application master will s
log4j configuration, which may cause issues when they run on the same node (e.g. trying to write
to the same log file).
-If you need a reference to the proper location to put log files in the YARN so that YARN can properly display and aggregate them, use `spark.yarn.app.container.log.dir` in your log4j.properties. For example, `log4j.appender.file_appender.File=${spark.yarn.app.container.log.dir}/spark.log`. For streaming application, configuring `RollingFileAppender` and setting file location to YARN's log directory will avoid disk overflow caused by large log file, and logs can be accessed using YARN's log utility.
+If you need a reference to the proper location to put log files in the YARN so that YARN can properly display and aggregate them, use `spark.yarn.app.container.log.dir` in your `log4j.properties`. For example, `log4j.appender.file_appender.File=${spark.yarn.app.container.log.dir}/spark.log`. For streaming applications, configuring `RollingFileAppender` and setting file location to YARN's log directory will avoid disk overflow caused by large log files, and logs can be accessed using YARN's log utility.
#### Spark Properties
@@ -100,24 +100,26 @@ If you need a reference to the proper location to put log files in the YARN so t
<tr><th>Property Name</th><th>Default</th><th>Meaning</th></tr>
<tr>
<td><code>spark.yarn.am.memory</code></td>
- <td>512m</td>
+ <td><code>512m</code></td>
<td>
Amount of memory to use for the YARN Application Master in client mode, in the same format as JVM memory strings (e.g. <code>512m</code>, <code>2g</code>).
In cluster mode, use <code>spark.driver.memory</code> instead.
+ <p/>
+ Use lower-case suffixes, e.g. <code>k</code>, <code>m</code>, <code>g</code>, <code>t</code>, and <code>p</code>, for kibi-, mebi-, gibi-, tebi-, and pebibytes, respectively.
</td>
</tr>
<tr>
<td><code>spark.driver.cores</code></td>
- <td>1</td>
+ <td><code>1</code></td>
<td>
Number of cores used by the driver in YARN cluster mode.
- Since the driver is run in the same JVM as the YARN Application Master in cluster mode, this also controls the cores used by the YARN AM.
- In client mode, use <code>spark.yarn.am.cores</code> to control the number of cores used by the YARN AM instead.
+ Since the driver is run in the same JVM as the YARN Application Master in cluster mode, this also controls the cores used by the YARN Application Master.
+ In client mode, use <code>spark.yarn.am.cores</code> to control the number of cores used by the YARN Application Master instead.
</td>
</tr>
<tr>
<td><code>spark.yarn.am.cores</code></td>
- <td>1</td>
+ <td><code>1</code></td>
<td>
Number of cores to use for the YARN Application Master in client mode.
In cluster mode, use <code>spark.driver.cores</code> instead.
@@ -125,39 +127,39 @@ If you need a reference to the proper location to put log files in the YARN so t
</tr>
<tr>
<td><code>spark.yarn.am.waitTime</code></td>
- <td>100s</td>
+ <td><code>100s</code></td>
<td>
- In `yarn-cluster` mode, time for the application master to wait for the
- SparkContext to be initialized. In `yarn-client` mode, time for the application master to wait
+ In <code>yarn-cluster</code> mode, time for the YARN Application Master to wait for the
+ SparkContext to be initialized. In <code>yarn-client</code> mode, time for the YARN Application Master to wait
for the driver to connect to it.
</td>
</tr>
<tr>
<td><code>spark.yarn.submit.file.replication</code></td>
- <td>The default HDFS replication (usually 3)</td>
+ <td>The default HDFS replication (usually <code>3</code>)</td>
<td>
HDFS replication level for the files uploaded into HDFS for the application. These include things like the Spark jar, the app jar, and any distributed cache files/archives.
</td>
</tr>
<tr>
<td><code>spark.yarn.preserve.staging.files</code></td>
- <td>false</td>
+ <td><code>false</code></td>
<td>
- Set to true to preserve the staged files (Spark jar, app jar, distributed cache files) at the end of the job rather than delete them.
+ Set to <code>true</code> to preserve the staged files (Spark jar, app jar, distributed cache files) at the end of the job rather than delete them.
</td>
</tr>
<tr>
<td><code>spark.yarn.scheduler.heartbeat.interval-ms</code></td>
- <td>3000</td>
+ <td><code>3000</code></td>
<td>
The interval in ms in which the Spark application master heartbeats into the YARN ResourceManager.
- The value is capped at half the value of YARN's configuration for the expiry interval
- (<code>yarn.am.liveness-monitor.expiry-interval-ms</code>).
+ The value is capped at half the value of YARN's configuration for the expiry interval, i.e.
+ <code>yarn.am.liveness-monitor.expiry-interval-ms</code>.
</td>
</tr>
<tr>
<td><code>spark.yarn.scheduler.initial-allocation.interval</code></td>
- <td>200ms</td>
+ <td><code>200ms</code></td>
<td>
The initial interval in which the Spark application master eagerly heartbeats to the YARN ResourceManager
when there are pending container allocation requests. It should be no larger than
@@ -177,8 +179,8 @@ If you need a reference to the proper location to put log files in the YARN so t
<td><code>spark.yarn.historyServer.address</code></td>
<td>(none)</td>
<td>
- The address of the Spark history server (i.e. host.com:18080). The address should not contain a scheme (http://). Defaults to not being set since the history server is an optional service. This address is given to the YARN ResourceManager when the Spark application finishes to link the application from the ResourceManager UI to the Spark history server UI.
- For this property, YARN properties can be used as variables, and these are substituted by Spark at runtime. For eg, if the Spark history server runs on the same node as the YARN ResourceManager, it can be set to `${hadoopconf-yarn.resourcemanager.hostname}:18080`.
+ The address of the Spark history server, e.g. <code>host.com:18080</code>. The address should not contain a scheme (<code>http://</code>). Defaults to not being set since the history server is an optional service. This address is given to the YARN ResourceManager when the Spark application finishes to link the application from the ResourceManager UI to the Spark history server UI.
+ For this property, YARN properties can be used as variables, and these are substituted by Spark at runtime. For example, if the Spark history server runs on the same node as the YARN ResourceManager, it can be set to <code>${hadoopconf-yarn.resourcemanager.hostname}:18080</code>.
</td>
</tr>
<tr>
@@ -197,42 +199,42 @@ If you need a reference to the proper location to put log files in the YARN so t
</tr>
<tr>
<td><code>spark.executor.instances</code></td>
- <td>2</td>
+ <td><code>2</code></td>
<td>
- The number of executors. Note that this property is incompatible with <code>spark.dynamicAllocation.enabled</code>. If both <code>spark.dynamicAllocation.enabled</code> and <code>spark.executor.instances</code> are specified, dynamic allocation is turned off and the specified number of <code>spark.executor.instances</code> is used.
+ The number of executors. Note that this property is incompatible with <code>spark.dynamicAllocation.enabled</code>. If both <code>spark.dynamicAllocation.enabled</code> and <code>spark.executor.instances</code> are specified, dynamic allocation is turned off and the specified number of <code>spark.executor.instances</code> is used.
</td>
</tr>
<tr>
<td><code>spark.yarn.executor.memoryOverhead</code></td>
<td>executorMemory * 0.10, with minimum of 384 </td>
<td>
- The amount of off heap memory (in megabytes) to be allocated per executor. This is memory that accounts for things like VM overheads, interned strings, other native overheads, etc. This tends to grow with the executor size (typically 6-10%).
+ The amount of off-heap memory (in megabytes) to be allocated per executor. This is memory that accounts for things like VM overheads, interned strings, other native overheads, etc. This tends to grow with the executor size (typically 6-10%).
</td>
</tr>
<tr>
<td><code>spark.yarn.driver.memoryOverhead</code></td>
<td>driverMemory * 0.10, with minimum of 384 </td>
<td>
- The amount of off heap memory (in megabytes) to be allocated per driver in cluster mode. This is memory that accounts for things like VM overheads, interned strings, other native overheads, etc. This tends to grow with the container size (typically 6-10%).
+ The amount of off-heap memory (in megabytes) to be allocated per driver in cluster mode. This is memory that accounts for things like VM overheads, interned strings, other native overheads, etc. This tends to grow with the container size (typically 6-10%).
</td>
</tr>
<tr>
<td><code>spark.yarn.am.memoryOverhead</code></td>
<td>AM memory * 0.10, with minimum of 384 </td>
<td>
- Same as <code>spark.yarn.driver.memoryOverhead</code>, but for the Application Master in client mode.
+ Same as <code>spark.yarn.driver.memoryOverhead</code>, but for the YARN Application Master in client mode.
</td>
</tr>
<tr>
<td><code>spark.yarn.am.port</code></td>
<td>(random)</td>
<td>
- Port for the YARN Application Master to listen on. In YARN client mode, this is used to communicate between the Spark driver running on a gateway and the Application Master running on YARN. In YARN cluster mode, this is used for the dynamic executor feature, where it handles the kill from the scheduler backend.
+ Port for the YARN Application Master to listen on. In YARN client mode, this is used to communicate between the Spark driver running on a gateway and the YARN Application Master running on YARN. In YARN cluster mode, this is used for the dynamic executor feature, where it handles the kill from the scheduler backend.
</td>
</tr>
<tr>
<td><code>spark.yarn.queue</code></td>
- <td>default</td>
+ <td><code>default</code></td>
<td>
The name of the YARN queue to which the application is submitted.
</td>
@@ -245,18 +247,18 @@ If you need a reference to the proper location to put log files in the YARN so t
By default, Spark on YARN will use a Spark jar installed locally, but the Spark jar can also be
in a world-readable location on HDFS. This allows YARN to cache it on nodes so that it doesn't
need to be distributed each time an application runs. To point to a jar on HDFS, for example,
- set this configuration to "hdfs:///some/path".
+ set this configuration to <code>hdfs:///some/path</code>.
</td>
</tr>
<tr>
<td><code>spark.yarn.access.namenodes</code></td>
<td>(none)</td>
<td>
- A list of secure HDFS namenodes your Spark application is going to access. For
- example, `spark.yarn.access.namenodes=hdfs://nn1.com:8032,hdfs://nn2.com:8032`.
- The Spark application must have acess to the namenodes listed and Kerberos must
- be properly configured to be able to access them (either in the same realm or in
- a trusted realm). Spark acquires security tokens for each of the namenodes so that
+ A comma-separated list of secure HDFS namenodes your Spark application is going to access. For
+ example, <code>spark.yarn.access.namenodes=hdfs://nn1.com:8032,hdfs://nn2.com:8032</code>.
+ The Spark application must have access to the namenodes listed and Kerberos must
+ be properly configured to be able to access them (either in the same realm or in
+ a trusted realm). Spark acquires security tokens for each of the namenodes so that
the Spark application can access those remote HDFS clusters.
</td>
</tr>
@@ -264,18 +266,18 @@ If you need a reference to the proper location to put log files in the YARN so t
<td><code>spark.yarn.appMasterEnv.[EnvironmentVariableName]</code></td>
<td>(none)</td>
<td>
- Add the environment variable specified by <code>EnvironmentVariableName</code> to the
- Application Master process launched on YARN. The user can specify multiple of
- these and to set multiple environment variables. In `yarn-cluster` mode this controls
- the environment of the SPARK driver and in `yarn-client` mode it only controls
- the environment of the executor launcher.
+ Add the environment variable specified by <code>EnvironmentVariableName</code> to the
+ Application Master process launched on YARN. The user can specify multiple of
+ these and to set multiple environment variables. In <code>yarn-cluster</code> mode this controls
+ the environment of the Spark driver and in <code>yarn-client</code> mode it only controls
+ the environment of the executor launcher.
</td>
</tr>
<tr>
<td><code>spark.yarn.containerLauncherMaxThreads</code></td>
- <td>25</td>
+ <td><code>25</code></td>
<td>
- The maximum number of threads to use in the application master for launching executor containers.
+ The maximum number of threads to use in the YARN Application Master for launching executor containers.
</td>
</tr>
<tr>
@@ -283,19 +285,19 @@ If you need a reference to the proper location to put log files in the YARN so t
<td>(none)</td>
<td>
A string of extra JVM options to pass to the YARN Application Master in client mode.
- In cluster mode, use `spark.driver.extraJavaOptions` instead.
+ In cluster mode, use <code>spark.driver.extraJavaOptions</code> instead.
</td>
</tr>
<tr>
<td><code>spark.yarn.am.extraLibraryPath</code></td>
<td>(none)</td>
<td>
- Set a special library path to use when launching the application master in client mode.
+ Set a special library path to use when launching the YARN Application Master in client mode.
</td>
</tr>
<tr>
<td><code>spark.yarn.maxAppAttempts</code></td>
- <td>yarn.resourcemanager.am.max-attempts in YARN</td>
+ <td><code>yarn.resourcemanager.am.max-attempts</code> in YARN</td>
<td>
The maximum number of attempts that will be made to submit the application.
It should be no larger than the global number of max attempts in the YARN configuration.
@@ -303,10 +305,10 @@ If you need a reference to the proper location to put log files in the YARN so t
</tr>
<tr>
<td><code>spark.yarn.submit.waitAppCompletion</code></td>
- <td>true</td>
+ <td><code>true</code></td>
<td>
In YARN cluster mode, controls whether the client waits to exit until the application completes.
- If set to true, the client process will stay alive reporting the application's status.
+ If set to <code>true</code>, the client process will stay alive reporting the application's status.
Otherwise, the client process will exit after submission.
</td>
</tr>
@@ -332,7 +334,7 @@ If you need a reference to the proper location to put log files in the YARN so t
<td>(none)</td>
<td>
The full path to the file that contains the keytab for the principal specified above.
- This keytab will be copied to the node running the Application Master via the Secure Distributed Cache,
+ This keytab will be copied to the node running the YARN Application Master via the Secure Distributed Cache,
for renewing the login tickets and the delegation tokens periodically.
</td>
</tr>
@@ -371,14 +373,14 @@ If you need a reference to the proper location to put log files in the YARN so t
</tr>
<tr>
<td><code>spark.yarn.security.tokens.${service}.enabled</code></td>
- <td>true</td>
+ <td><code>true</code></td>
<td>
Controls whether to retrieve delegation tokens for non-HDFS services when security is enabled.
By default, delegation tokens for all supported services are retrieved when those services are
configured, but it's possible to disable that behavior if it somehow conflicts with the
application being run.
<p/>
- Currently supported services are: hive, hbase
+ Currently supported services are: <code>hive</code>, <code>hbase</code>
</td>
</tr>
</table>
@@ -387,5 +389,5 @@ If you need a reference to the proper location to put log files in the YARN so t
- Whether core requests are honored in scheduling decisions depends on which scheduler is in use and how it is configured.
- In `yarn-cluster` mode, the local directories used by the Spark executors and the Spark driver will be the local directories configured for YARN (Hadoop YARN config `yarn.nodemanager.local-dirs`). If the user specifies `spark.local.dir`, it will be ignored. In `yarn-client` mode, the Spark executors will use the local directories configured for YARN while the Spark driver will use those defined in `spark.local.dir`. This is because the Spark driver does not run on the YARN cluster in `yarn-client` mode, only the Spark executors do.
-- The `--files` and `--archives` options support specifying file names with the # similar to Hadoop. For example you can specify: `--files localtest.txt#appSees.txt` and this will upload the file you have locally named localtest.txt into HDFS but this will be linked to by the name `appSees.txt`, and your application should use the name as `appSees.txt` to reference it when running on YARN.
+- The `--files` and `--archives` options support specifying file names with the # similar to Hadoop. For example you can specify: `--files localtest.txt#appSees.txt` and this will upload the file you have locally named `localtest.txt` into HDFS but this will be linked to by the name `appSees.txt`, and your application should use the name as `appSees.txt` to reference it when running on YARN.
- The `--jars` option allows the `SparkContext.addJar` function to work if you are using it with local files and running in `yarn-cluster` mode. It does not need to be used if you are using it with HDFS, HTTP, HTTPS, or FTP files.