summaryrefslogtreecommitdiff
path: root/site/docs/0.6.1/ec2-scripts.html
diff options
context:
space:
mode:
Diffstat (limited to 'site/docs/0.6.1/ec2-scripts.html')
-rw-r--r--site/docs/0.6.1/ec2-scripts.html320
1 files changed, 320 insertions, 0 deletions
diff --git a/site/docs/0.6.1/ec2-scripts.html b/site/docs/0.6.1/ec2-scripts.html
new file mode 100644
index 000000000..c12d85ee7
--- /dev/null
+++ b/site/docs/0.6.1/ec2-scripts.html
@@ -0,0 +1,320 @@
+<!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 EC2 - Spark 0.6.1 Documentation</title>
+ <meta name="description" content="">
+
+ <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">
+ <script type="text/javascript">
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-32518208-1']);
+ _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-77x50px-hd.png" /></a><span class="version">0.6.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="scala-programming-guide.html">Scala</a></li>
+ <li><a href="java-programming-guide.html">Java</a></li>
+ </ul>
+ </li>
+
+ <li><a href="api/core/index.html">API (Scaladoc)</a></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="ec2-scripts.html">Amazon EC2</a></li>
+ <li><a href="spark-standalone.html">Standalone Mode</a></li>
+ <li><a href="running-on-mesos.html">Mesos</a></li>
+ <li><a href="running-on-yarn.html">YARN</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="tuning.html">Tuning Guide</a></li>
+ <li><a href="bagel-programming-guide.html">Bagel (Pregel on Spark)</a></li>
+ <li><a href="contributing-to-spark.html">Contributing to Spark</a></li>
+ </ul>
+ </li>
+ </ul>
+ <!--<p class="navbar-text pull-right"><span class="version-text">v0.6.1</span></p>-->
+ </div>
+ </div>
+ </div>
+
+ <div class="container" id="content">
+ <h1 class="title">Running Spark on EC2</h1>
+
+ <p>The <code>spark-ec2</code> script, located in Spark&rsquo;s <code>ec2</code> directory, allows you
+to launch, manage and shut down Spark clusters on Amazon EC2. It automatically sets up Mesos, Spark and HDFS
+on the cluster for you.
+This guide describes how to use <code>spark-ec2</code> to launch clusters, how to run jobs on them, and how to shut them down.
+It assumes you&rsquo;ve already signed up for an EC2 account on the <a href="http://aws.amazon.com/">Amazon Web Services site</a>.</p>
+
+<p><code>spark-ec2</code> is designed to manage multiple named clusters. You can
+launch a new cluster (telling the script its size and giving it a name),
+shutdown an existing cluster, or log into a cluster. Each cluster is
+identified by placing its machines into EC2 security groups whose names
+are derived from the name of the cluster. For example, a cluster named
+<code>test</code> will contain a master node in a security group called
+<code>test-master</code>, and a number of slave nodes in a security group called
+<code>test-slaves</code>. The <code>spark-ec2</code> script will create these security groups
+for you based on the cluster name you request. You can also use them to
+identify machines belonging to each cluster in the Amazon EC2 Console.</p>
+
+<h1 id="before-you-start">Before You Start</h1>
+
+<ul>
+ <li>Create an Amazon EC2 key pair for yourself. This can be done by
+logging into your Amazon Web Services account through the <a href="http://aws.amazon.com/console/">AWS
+console</a>, clicking Key Pairs on the
+left sidebar, and creating and downloading a key. Make sure that you
+set the permissions for the private key file to <code>600</code> (i.e. only you
+can read and write it) so that <code>ssh</code> will work.</li>
+ <li>Whenever you want to use the <code>spark-ec2</code> script, set the environment
+variables <code>AWS_ACCESS_KEY_ID</code> and <code>AWS_SECRET_ACCESS_KEY</code> to your
+Amazon EC2 access key ID and secret access key. These can be
+obtained from the <a href="http://aws.amazon.com/">AWS homepage</a> by clicking
+Account &gt; Security Credentials &gt; Access Credentials.</li>
+</ul>
+
+<h1 id="launching-a-cluster">Launching a Cluster</h1>
+
+<ul>
+ <li>Go into the <code>ec2</code> directory in the release of Spark you downloaded.</li>
+ <li>Run
+<code>./spark-ec2 -k &lt;keypair&gt; -i &lt;key-file&gt; -s &lt;num-slaves&gt; launch &lt;cluster-name&gt;</code>,
+where <code>&lt;keypair&gt;</code> is the name of your EC2 key pair (that you gave it
+when you created it), <code>&lt;key-file&gt;</code> is the private key file for your
+key pair, <code>&lt;num-slaves&gt;</code> is the number of slave nodes to launch (try
+1 at first), and <code>&lt;cluster-name&gt;</code> is the name to give to your
+cluster.</li>
+ <li>After everything launches, check that Mesos is up and sees all the
+slaves by going to the Mesos Web UI link printed at the end of the
+script (<code>http://&lt;master-hostname&gt;:8080</code>).</li>
+</ul>
+
+<p>You can also run <code>./spark-ec2 --help</code> to see more usage options. The
+following options are worth pointing out:</p>
+
+<ul>
+ <li><code>--instance-type=&lt;INSTANCE_TYPE&gt;</code> can be used to specify an EC2
+instance type to use. For now, the script only supports 64-bit instance
+types, and the default type is <code>m1.large</code> (which has 2 cores and 7.5 GB
+RAM). Refer to the Amazon pages about <a href="http://aws.amazon.com/ec2/instance-types">EC2 instance
+types</a> and <a href="http://aws.amazon.com/ec2/#pricing">EC2
+pricing</a> for information about other
+instance types. </li>
+ <li><code>--zone=&lt;EC2_ZONE&gt;</code> can be used to specify an EC2 availability zone
+to launch instances in. Sometimes, you will get an error because there
+is not enough capacity in one zone, and you should try to launch in
+another. This happens mostly with the <code>m1.large</code> instance types;
+extra-large (both <code>m1.xlarge</code> and <code>c1.xlarge</code>) instances tend to be more
+available.</li>
+ <li><code>--ebs-vol-size=GB</code> will attach an EBS volume with a given amount
+of space to each node so that you can have a persistent HDFS cluster
+on your nodes across cluster restarts (see below).</li>
+ <li>If one of your launches fails due to e.g. not having the right
+permissions on your private key file, you can run <code>launch</code> with the
+<code>--resume</code> option to restart the setup process on an existing cluster.</li>
+</ul>
+
+<h1 id="running-jobs">Running Jobs</h1>
+
+<ul>
+ <li>Go into the <code>ec2</code> directory in the release of Spark you downloaded.</li>
+ <li>Run <code>./spark-ec2 -k &lt;keypair&gt; -i &lt;key-file&gt; login &lt;cluster-name&gt;</code> to
+SSH into the cluster, where <code>&lt;keypair&gt;</code> and <code>&lt;key-file&gt;</code> are as
+above. (This is just for convenience; you could also use
+the EC2 console.)</li>
+ <li>To deploy code or data within your cluster, you can log in and use the
+provided script <code>~/mesos-ec2/copy-dir</code>, which,
+given a directory path, RSYNCs it to the same location on all the slaves.</li>
+ <li>If your job needs to access large datasets, the fastest way to do
+that is to load them from Amazon S3 or an Amazon EBS device into an
+instance of the Hadoop Distributed File System (HDFS) on your nodes.
+The <code>spark-ec2</code> script already sets up a HDFS instance for you. It&rsquo;s
+installed in <code>/root/ephemeral-hdfs</code>, and can be accessed using the
+<code>bin/hadoop</code> script in that directory. Note that the data in this
+HDFS goes away when you stop and restart a machine.</li>
+ <li>There is also a <em>persistent HDFS</em> instance in
+<code>/root/presistent-hdfs</code> that will keep data across cluster restarts.
+Typically each node has relatively little space of persistent data
+(about 3 GB), but you can use the <code>--ebs-vol-size</code> option to
+<code>spark-ec2</code> to attach a persistent EBS volume to each node for
+storing the persistent HDFS.</li>
+ <li>Finally, if you get errors while running your jobs, look at the slave&rsquo;s logs
+for that job using the Mesos web UI (<code>http://&lt;master-hostname&gt;:8080</code>).</li>
+</ul>
+
+<h1 id="configuration">Configuration</h1>
+
+<p>You can edit <code>/root/spark/conf/spark-env.sh</code> on each machine to set Spark configuration options, such
+as JVM options and, most crucially, the amount of memory to use per machine (<code>SPARK_MEM</code>).
+This file needs to be copied to <strong>every machine</strong> to reflect the change. The easiest way to do this
+is to use a script we provide called <code>copy-dir</code>. First edit your <code>spark-env.sh</code> file on the master,
+then run <code>~/mesos-ec2/copy-dir /root/spark/conf</code> to RSYNC it to all the workers.</p>
+
+<p>The <a href="configuration.html">configuration guide</a> describes the available configuration options.</p>
+
+<h1 id="terminating-a-cluster">Terminating a Cluster</h1>
+
+<p><strong><em>Note that there is no way to recover data on EC2 nodes after shutting
+them down! Make sure you have copied everything important off the nodes
+before stopping them.</em></strong></p>
+
+<ul>
+ <li>Go into the <code>ec2</code> directory in the release of Spark you downloaded.</li>
+ <li>Run <code>./spark-ec2 destroy &lt;cluster-name&gt;</code>.</li>
+</ul>
+
+<h1 id="pausing-and-restarting-clusters">Pausing and Restarting Clusters</h1>
+
+<p>The <code>spark-ec2</code> script also supports pausing a cluster. In this case,
+the VMs are stopped but not terminated, so they
+<strong><em>lose all data on ephemeral disks</em></strong> but keep the data in their
+root partitions and their <code>persistent-hdfs</code>. Stopped machines will not
+cost you any EC2 cycles, but <strong><em>will</em></strong> continue to cost money for EBS
+storage.</p>
+
+<ul>
+ <li>To stop one of your clusters, go into the <code>ec2</code> directory and run
+<code>./spark-ec2 stop &lt;cluster-name&gt;</code>.</li>
+ <li>To restart it later, run
+<code>./spark-ec2 -i &lt;key-file&gt; start &lt;cluster-name&gt;</code>.</li>
+ <li>To ultimately destroy the cluster and stop consuming EBS space, run
+<code>./spark-ec2 destroy &lt;cluster-name&gt;</code> as described in the previous
+section.</li>
+</ul>
+
+<h1 id="limitations">Limitations</h1>
+
+<ul>
+ <li><code>spark-ec2</code> currently only launches machines in the US-East region of EC2.
+It should not be hard to make it launch VMs in other zones, but you will need
+to create your own AMIs in them.</li>
+ <li>Support for &ldquo;cluster compute&rdquo; nodes is limited &ndash; there&rsquo;s no way to specify a
+locality group. However, you can launch slave nodes in your
+<code>&lt;clusterName&gt;-slaves</code> group manually and then use <code>spark-ec2 launch
+--resume</code> to start a cluster with them.</li>
+ <li>Support for spot instances is limited.</li>
+</ul>
+
+<p>If you have a patch or suggestion for one of these limitations, feel free to
+<a href="contributing-to-spark.html">contribute</a> it!</p>
+
+<h1 id="using-a-newer-spark-version">Using a Newer Spark Version</h1>
+
+<p>The Spark EC2 machine images may not come with the latest version of Spark. To use a newer version, you can run <code>git pull</code> to pull in <code>/root/spark</code> to pull in the latest version of Spark from <code>git</code>, and build it using <code>sbt/sbt compile</code>. You will also need to copy it to all the other nodes in the cluster using <code>~/mesos-ec2/copy-dir /root/spark</code>.</p>
+
+<h1 id="accessing-data-in-s3">Accessing Data in S3</h1>
+
+<p>Spark&rsquo;s file interface allows it to process data in Amazon S3 using the same URI formats that are supported for Hadoop. You can specify a path in S3 as input through a URI of the form <code>s3n://&lt;id&gt;:&lt;secret&gt;@&lt;bucket&gt;/path</code>, where <code>&lt;id&gt;</code> is your Amazon access key ID and <code>&lt;secret&gt;</code> is your Amazon secret access key. Note that you should escape any <code>/</code> characters in the secret key as <code>%2F</code>. Full instructions can be found on the <a href="http://wiki.apache.org/hadoop/AmazonS3">Hadoop S3 page</a>.</p>
+
+<p>In addition to using a single input file, you can also use a directory of files as input by simply giving the path to the directory.</p>
+
+ <!-- Main hero unit for a primary marketing message or call to action -->
+ <!--<div class="hero-unit">
+ <h1>Hello, world!</h1>
+ <p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
+ <p><a class="btn btn-primary btn-large">Learn more &raquo;</a></p>
+ </div>-->
+
+ <!-- Example row of columns -->
+ <!--<div class="row">
+ <div class="span4">
+ <h2>Heading</h2>
+ <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
+ <p><a class="btn" href="#">View details &raquo;</a></p>
+ </div>
+ <div class="span4">
+ <h2>Heading</h2>
+ <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
+ <p><a class="btn" href="#">View details &raquo;</a></p>
+ </div>
+ <div class="span4">
+ <h2>Heading</h2>
+ <p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
+ <p><a class="btn" href="#">View details &raquo;</a></p>
+ </div>
+ </div>
+
+ <hr>-->
+
+ <!--<footer>
+ <p></p>
+ </footer>-->
+
+ </div> <!-- /container -->
+
+ <script src="js/vendor/jquery-1.8.0.min.js"></script>
+ <script src="js/vendor/bootstrap.min.js"></script>
+ <script src="js/main.js"></script>
+
+ <!-- A script to fix internal hash links because we have an overlapping top bar.
+ Based on https://github.com/twitter/bootstrap/issues/193#issuecomment-2281510 -->
+ <script>
+ $(function() {
+ function maybeScrollToHash() {
+ if (window.location.hash && $(window.location.hash).length) {
+ var newTop = $(window.location.hash).offset().top - $('#topbar').height() - 5;
+ $(window).scrollTop(newTop);
+ }
+ }
+ $(window).bind('hashchange', function() {
+ maybeScrollToHash();
+ });
+ // Scroll now too in case we had opened the page on a hash, but wait 1 ms because some browsers
+ // will try to do *their* initial scroll after running the onReady handler.
+ setTimeout(function() { maybeScrollToHash(); }, 1)
+ })
+ </script>
+
+ </body>
+</html>