diff options
-rwxr-xr-x | docs/_layouts/global.html | 2 | ||||
-rwxr-xr-x | docs/css/main.css | 2 | ||||
-rw-r--r-- | docs/index.md | 2 | ||||
-rw-r--r-- | docs/running-a-spark-standalone-cluster.md | 41 | ||||
-rw-r--r-- | docs/running-on-yarn.md | 42 | ||||
-rw-r--r-- | docs/spark-standalone.md | 80 |
6 files changed, 126 insertions, 43 deletions
diff --git a/docs/_layouts/global.html b/docs/_layouts/global.html index 8bfd0e7284..5861257e61 100755 --- a/docs/_layouts/global.html +++ b/docs/_layouts/global.html @@ -63,7 +63,7 @@ </div> </div> - <div class="container"> + <div class="container" id="content"> <h1 class="title">{{ page.title }}</h1> {{ content }} diff --git a/docs/css/main.css b/docs/css/main.css index cf56399376..fdc0872279 100755 --- a/docs/css/main.css +++ b/docs/css/main.css @@ -11,7 +11,7 @@ } */ -body { +body #content { line-height: 1.6; /* Inspired by Github's wiki style */ } diff --git a/docs/index.md b/docs/index.md index a3ad2d11ce..1face73515 100644 --- a/docs/index.md +++ b/docs/index.md @@ -53,6 +53,8 @@ of `project/SparkBuild.scala`, then rebuilding Spark (`sbt/sbt clean compile`). * [Spark Programming Guide]({{HOME_PATH}}programming-guide.html): how to get started using Spark, and details on the API * [Running Spark on Amazon EC2]({{HOME_PATH}}running-on-amazon-ec2.html): scripts that let you launch a cluster on EC2 in about 5 minutes * [Running Spark on Mesos]({{HOME_PATH}}running-on-mesos.html): instructions on how to deploy to a private cluster +* [Running Spark on YARN]({{HOME_PATH}}running-on-yarn.html): instructions on how to run Spark on top of a YARN cluster +* [Spark Standalone Mode]({{HOME_PATH}}spark-standalone.html): instructions on running Spark without Mesos * [Configuration]({{HOME_PATH}}configuration.html) * [Bagel Programming Guide]({{HOME_PATH}}bagel-programming-guide.html): implementation of Google's Pregel on Spark * [Spark Debugger]({{HOME_PATH}}spark-debugger.html): experimental work on a debugger for Spark jobs diff --git a/docs/running-a-spark-standalone-cluster.md b/docs/running-a-spark-standalone-cluster.md deleted file mode 100644 index cd1aaf3d6c..0000000000 --- a/docs/running-a-spark-standalone-cluster.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -layout: global -title: Running a Spark Standalone Cluster ---- -**Note**: Standalone mode is only supported on the dev branch right now. - -## Before you Start - -- Download and compile Spark as described in the [README](https://github.com/mesos/spark/wiki). -- If you wish to use the EC2 Scripts (described below), you must have an Amazon AWS Account and an EC2 key pair. - -## Configuration - -In order to run a Spark cluster there are two main points of configuration, the `conf/spark-env.sh` file, and the `conf/slaves` file. the `conf/spark-env.sh` file lets you specify settings for the master and slave instances, such as memory, or port numbers to bind on. The file itself is well documented and all configuration variables are explained. - -The `conf/slaves` file contains a list of all machines where you would like to start a Spark slave (worker) instance when using then scripts below. The master machine must be able to access each of the slave machines via ssh. For testing purposes, you can have a single `localhost` entry in the slaves file. - -## Scripts - -In order to make starting master and slave instances easier, we have provided Hadoop-style shell scripts. The scripts can be found in the `bin` directory. A quick overview: - -- `bin/start_master` - Starts a master instance on the machine the script is executed on. -- `bin/start_slaves` - Starts a slave instance on each machine specified in the `conf/slaves` file. -- `bin/start_all` - Starts both a master and a number of slaves as described above. -- `bin/stop_master` - Stops the master that was started via the `bin/start_master` script. -- `bin/stop_slaves` - Stops the slave intances that were started via the `bin/start_slaves` script. -- `bin/stop_all` - Stops both the master and the slaves as described above. - -Note that the scripts must be executed on the machine you want to start the Spark master on, not your local machine. By default, both the master and slaves write their log files to the `logs` in the Spark home directory. - -## Connecting to the Cluster - -To run a job against a standalone cluster, pass a URI of the form `spark://<SPARK_MASTER_IP>:<SPARK_MASTER_PORT>` as the Master's URI when setting up a Spark Context (or using the interactive shell). - -## Spark Web Interface - -In order to allow for easy debugging of your cluster we have provided a simple web interface that described the current state of the cluster and jobs. By default you can access it via `http://<SPARK_MASTER_IP>:8080`, but you can specify a different port number in`conf/spark_env.sh`. - -## EC2 Scripts - -To save you from needing to set up a cluster of Spark machines yourself, we provide a set of scripts that launch Amazon EC2 instances with a preinstalled Spark distribution. These scripts are identical to the [EC2 Mesos Scripts](https://github.com/mesos/spark/wiki/EC2-Scripts), except that you need to execute `ec2/spark-ec2` with the following additional parameters: `--cluster-type standalone -a standalone --user ec2-user`. Note that the Spark version on these machines may not reflect the latest changes, so it may be a good idea to ssh into the machines and merge the latest version from github. diff --git a/docs/running-on-yarn.md b/docs/running-on-yarn.md new file mode 100644 index 0000000000..3c0e54671b --- /dev/null +++ b/docs/running-on-yarn.md @@ -0,0 +1,42 @@ +--- +layout: global +title: Launching Spark on YARN +--- + +Spark allows you to launch jobs on an existing [YARN](http://hadoop.apache.org/common/docs/r0.23.1/hadoop-yarn/hadoop-yarn-site/YARN.html) cluster. + +## Preparations + +- In order to distribute Spark within the cluster it must be packaged into a single JAR file. This can be done by running `sbt/sbt assembly` +- Your application code must be packaged into a separate jar file. + +If you want to test out the YARN deployment mode, you can use the current spark examples. A `spark-examples_2.9.1-0.6.0-SNAPSHOT.jar` file can be generated by running `sbt/sbt package`. + +## Launching Spark on YARN + +The command to launch the YARN Client is as follows: + + SPARK_JAR=<SPARK_YAR_FILE> ./run spark.deploy.yarn.Client + --jar <YOUR_APP_JAR_FILE> + --class <APP_MAIN_CLASS> + --args <APP_MAIN_ARGUMENTS> + --num-workers <NUMBER_OF_WORKER_MACHINES> + --worker-memory <MEMORY_PER_WORKER> + --worker-cores <CORES_PER_WORKER> + +For example: + + SPARK_JAR=./core/target/spark-core-assembly-0.6.0-SNAPSHOT.jar ./run spark.deploy.yarn.Client + --jar examples/target/scala-2.9.1/spark-examples_2.9.1-0.6.0-SNAPSHOT.jar + --class spark.examples.SparkPi + --args standalone + --num-workers 3 + --worker-memory 2g + --worker-cores 2 + +The above starts a YARN Client programs which periodically polls the Application Master for status updates and displays them in the console. The client will exit once your application has finished running. + +## Important Notes + +- When your application instantiates a Spark context it must use a special "standalone" master url. This starts the scheduler without forcing it to connect to a cluster. A good way to handle this is to pass "standalone" as an argument to your program, as shown in the example above. +- YARN does not support requesting container resources based on the number of cores. Thus the numbers of cores given via command line arguments cannot be guaranteed. diff --git a/docs/spark-standalone.md b/docs/spark-standalone.md new file mode 100644 index 0000000000..cc9c1f4fc9 --- /dev/null +++ b/docs/spark-standalone.md @@ -0,0 +1,80 @@ +--- +layout: global +title: Spark Standalone Mode +--- + +In addition to running on top of [Mesos](https://github.com/mesos/mesos), Spark also supports a standalone mode, consisting of one Spark master and several Spark worker processes. You can run the Spark standalone mode either locally or on a cluster. If you wish to run an Spark Amazon EC2 cluster using standalone mode we have provided a set of scripts that make it easy to do so. + +## Getting Started + +Download and compile Spark as described in the [README](https://github.com/mesos/spark/wiki). You do not need to install mesos on your machine if you are using the standalone mode. + +## Standalone Mode Configuration + +The `conf/spark_env.sh` file contains several configuration parameters for the standalone mode. Here is a quick overview: + +- SPARK\_MASTER\_IP - Use this to bind the master to a particular ip address, for example a public one. (Default: local ip address) +- SPARK\_MASTER\_PORT - Start the spark master on a different port (Default: 7077) +- SPARK\_MASTER\_WEBUI\_POR - Specify a different port for the Master WebUI (Default: 8080) +- SPARK\_WORKER\_PORT - Start the spark worker on a specific port (Default: random) +- SPARK\_WORKER\_CORES - Specify the number of cores to use (Default: all available cores) +- SPARK\_WORKER\_MEMORY - Specify how much memory to use, e.g. 1000M, 2G (Default: MAX(Available - 1024MB, 512MB)) +- SPARK\_WORKER\_WEBUI\_PORT - Specify a different port for the Worker WebUI (Default: 8081) + +## Starting the standalone Master + +You can start a standalone master server by executing: + + ./run spark.deploy.master.Master + +The program takes additional arguments that will overwrite the configuration values: + + -i IP, --ip IP IP address or DNS name to listen on + -p PORT, --port PORT Port to listen on (default: 7077) + --webui-port PORT Port for web UI (default: 8080) + +The master process should print out the Master's URL of the form `spark://IP:PORT` which you can use to create a `SparkContext` in your applications. + +## Starting standalone Workers + +Similar to the master, you can start one or more standalone workers via: + +`./run spark.deploy.worker.Worker spark://IP:PORT` + +The following options can be passed to the worker: + + -c CORES, --cores CORES Number of cores to use + -m MEM, --memory MEM Amount of memory to use (e.g. 1000M, 2G) + -i IP, --ip IP IP address or DNS name to listen on + -p PORT, --port PORT Port to listen on (default: random) + --webui-port PORT Port for web UI (default: 8081) + +## Debugging a standalone cluster + +Spark offers a web-based user interface in the standalone mode. The master and each worker has its own WebUI that shows cluster and job statistics. By default you can access the WebUI for the master at port 8080. The port can be changed either in the configuration file or via command-line options. + +Detailed log output for the jobs is by default written to the `work/` by default. + +## Running on a Cluster + +In order to run a Spark standalone cluster there are two main points of configuration, the `conf/spark-env.sh` file (described above), and the `conf/slaves` file. the `conf/spark-env.sh` file lets you specify global settings for the master and slave instances, such as memory, or port numbers to bind to. We are assuming that all your machines share the same configuration parameters. + +The `conf/slaves` file contains a list of all machines where you would like to start a Spark slave (worker) instance when using then scripts below. The master machine must be able to access each of the slave machines via ssh. For testing purposes, you can have a single `localhost` entry in the slaves file. + +In order to make starting master and slave instances easier, we have provided Hadoop-style shell scripts. The scripts can be found in the `bin` directory. A quick overview: + +- `bin/start_master` - Starts a master instance on the machine the script is executed on. +- `bin/start_slaves` - Starts a slave instance on each machine specified in the `conf/slaves` file. +- `bin/start_all` - Starts both a master and a number of slaves as described above. +- `bin/stop_master` - Stops the master that was started via the `bin/start_master` script. +- `bin/stop_slaves` - Stops the slave intances that were started via the `bin/start_slaves` script. +- `bin/stop_all` - Stops both the master and the slaves as described above. + +Note that the scripts must be executed on the machine you want to start the Spark master on, not your local machine. + +## EC2 Scripts + +To save you from needing to set up a cluster of Spark machines yourself, we provide a set of scripts that launch Amazon EC2 instances with a preinstalled Spark distribution. These scripts are identical to the [EC2 Mesos Scripts](https://github.com/mesos/spark/wiki/EC2-Scripts), except that you need to execute `ec2/spark-ec2` with the following additional parameters: `--cluster-type standalone -a standalone`. Note that the Spark version on these machines may not reflect the latest changes, so it may be a good idea to ssh into the machines and merge the latest version from github. + + + |