Skip to content

Spark 0.5 Documentation

mateiz edited this page Oct 25, 2012 · 6 revisions

NOTE: This page is for Spark 0.5.x; for the latest docs, see the Spark website

Building

Spark requires Scala 2.9. In addition, to run Spark on a cluster, you will need to install Mesos, using the steps in Running Spark on Mesos. However, if you just want to run Spark on a single machine (possibly using multiple cores), you do not need Mesos.

To build and run Spark, you will need to have Scala's bin directory in your PATH, or you will need to set the SCALA_HOME environment variable to point to where you've installed Scala. Scala must be accessible through one of these methods on Mesos slave nodes as well as on the master.

Spark uses Simple Build Tool, which is bundled with it. To compile the code, go into the top-level Spark directory and run

sbt/sbt package

Testing the Build

Spark comes with a number of sample programs in the examples directory. To run one of the samples, use ./run <class> <params> in the top-level Spark directory (the run script sets up the appropriate paths and launches that program). For example, ./run spark.examples.SparkPi will run a sample program that estimates Pi. Each of the examples prints usage help if no params are given.

Note that all of the sample programs take a <host> parameter that is the Mesos master to connect to. This can be a Mesos master URL, or local to run locally with one thread, or local[N] to run locally with N threads. You should start by using local for testing.

Finally, Spark can be used interactively from a modified version of the Scala interpreter that you can start through ./spark-shell. This is a great way to learn Spark.

A Note About Hadoop Versions

Spark uses the Hadoop core library to talk to HDFS and other Hadoop-supported storage systems. Because the HDFS protocol has changed in different versions of Hadoop, you must build Spark against the same version that your cluster runs. You can change the version by setting the HADOOP_VERSION variable at the top of project/SparkBuild.scala, then rebuilding Spark (sbt/sbt clean package).

Where to Go from Here

Other Resources