blob: db1201d29500d484d673c9c7f06c996d8ca0e978 [file] [log] [blame]
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Apache Flink 0.10-SNAPSHOT Documentation: Local Setup</title>
<link rel="shortcut icon" href="http://flink.apache.org/docs/master/page/favicon.ico" type="image/x-icon">
<link rel="icon" href="http://flink.apache.org/docs/master/page/favicon.ico" type="image/x-icon">
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" href="http://flink.apache.org/docs/master/page/css/flink.css">
<link rel="stylesheet" href="http://flink.apache.org/docs/master/page/css/syntax.css">
<link rel="stylesheet" href="http://flink.apache.org/docs/master/page/css/codetabs.css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Top navbar. -->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<!-- The logo. -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-logo">
<a href="http://flink.apache.org"><img alt="Apache Flink" src="http://flink.apache.org/docs/master/page/img/navbar-brand-logo.jpg"></a>
</div>
</div><!-- /.navbar-header -->
<!-- The navigation links. -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="http://flink.apache.org/docs/master/index.html">Overview<span class="hidden-sm hidden-xs"> 0.10</span></a></li>
<!-- Setup -->
<li class="dropdown">
<a href="http://flink.apache.org/docs/master/setup" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Setup <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="http://flink.apache.org/docs/master/setup/building.html">Get Flink 0.10-SNAPSHOT</a></li>
<li class="divider"></li>
<li role="presentation" class="dropdown-header"><strong>Deployment</strong></li>
<li><a href="http://flink.apache.org/docs/master/setup/local_setup.html" class="active">Local</a></li>
<li><a href="http://flink.apache.org/docs/master/setup/cluster_setup.html">Cluster (Standalone)</a></li>
<li><a href="http://flink.apache.org/docs/master/setup/yarn_setup.html">YARN</a></li>
<li><a href="http://flink.apache.org/docs/master/setup/gce_setup.html">GCloud</a></li>
<li><a href="http://flink.apache.org/docs/master/setup/flink_on_tez.html">Flink on Tez <span class="badge">Beta</span></a></li>
<li class="divider"></li>
<li><a href="http://flink.apache.org/docs/master/setup/config.html">Configuration</a></li>
</ul>
</li>
<!-- Programming Guides -->
<li class="dropdown">
<a href="http://flink.apache.org/docs/master/apis" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Programming Guides <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="http://flink.apache.org/docs/master/apis/programming_guide.html"><strong>Batch: DataSet API</strong></a></li>
<li><a href="http://flink.apache.org/docs/master/apis/streaming_guide.html"><strong>Streaming: DataStream API</strong> <span class="badge">Beta</span></a></li>
<li><a href="http://flink.apache.org/docs/master/apis/python.html">Python API <span class="badge">Beta</span></a></li>
<li class="divider"></li>
<li><a href="scala_shell.html">Interactive Scala Shell</a></li>
<li><a href="http://flink.apache.org/docs/master/apis/dataset_transformations.html">Dataset Transformations</a></li>
<li><a href="http://flink.apache.org/docs/master/apis/best_practices.html">Best Practices</a></li>
<li><a href="http://flink.apache.org/docs/master/apis/example_connectors.html">Connectors</a></li>
<li><a href="http://flink.apache.org/docs/master/apis/examples.html">Examples</a></li>
<li><a href="http://flink.apache.org/docs/master/apis/local_execution.html">Local Execution</a></li>
<li><a href="http://flink.apache.org/docs/master/apis/cluster_execution.html">Cluster Execution</a></li>
<li><a href="http://flink.apache.org/docs/master/apis/cli.html">Command Line Interface</a></li>
<li><a href="http://flink.apache.org/docs/master/apis/web_client.html">Web Client</a></li>
<li><a href="http://flink.apache.org/docs/master/apis/iterations.html">Iterations</a></li>
<li><a href="http://flink.apache.org/docs/master/apis/java8.html">Java 8</a></li>
<li><a href="http://flink.apache.org/docs/master/apis/hadoop_compatibility.html">Hadoop Compatability <span class="badge">Beta</span></a></li>
</ul>
</li>
<!-- Libraries -->
<li class="dropdown">
<a href="http://flink.apache.org/docs/master/libs" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Libraries <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="http://flink.apache.org/docs/master/libs/spargel_guide.html">Graphs: Spargel</a></li>
<li><a href="http://flink.apache.org/docs/master/libs/gelly_guide.html">Graphs: Gelly <span class="badge">Beta</span></a></li>
<li><a href="http://flink.apache.org/docs/master/libs/ml/">Machine Learning <span class="badge">Beta</span></a></li>
<li><a href="http://flink.apache.org/docs/master/libs/table.html">Relational: Table <span class="badge">Beta</span></a></li>
</ul>
</li>
<!-- Internals -->
<li class="dropdown">
<a href="http://flink.apache.org/docs/master/internals" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Internals <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li role="presentation" class="dropdown-header"><strong>Contribute</strong></li>
<li><a href="http://flink.apache.org/docs/master/internals/how_to_contribute.html">How to Contribute</a></li>
<li><a href="http://flink.apache.org/docs/master/internals/coding_guidelines.html">Coding Guidelines</a></li>
<li><a href="http://flink.apache.org/docs/master/internals/ide_setup.html">IDE Setup</a></li>
<li><a href="http://flink.apache.org/docs/master/internals/logging.html">Logging</a></li>
<li class="divider"></li>
<li role="presentation" class="dropdown-header"><strong>Internals</strong></li>
<li><a href="http://flink.apache.org/docs/master/internals/general_arch.html">Architecture &amp; Process Model</a></li>
<li><a href="http://flink.apache.org/docs/master/internals/types_serialization.html">Type Extraction &amp; Serialization</a></li>
<li><a href="http://flink.apache.org/docs/master/internals/job_scheduling.html">Jobs &amp; Scheduling</a></li>
<li><a href="http://flink.apache.org/docs/master/internals/add_operator.html">How-To: Add an Operator</a></li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-right hidden-sm hidden-md" role="search" action="http://flink.apache.org/docs/master/search-results.html">
<div class="form-group">
<input type="text" class="form-control" name="q" placeholder="Search all pages">
</div>
<button type="submit" class="btn btn-default">Search</button>
</form>
</div><!-- /.navbar-collapse -->
</div><!-- /.container -->
</nav>
<!-- Main content. -->
<div class="container">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h1>Local Setup</h1>
<p>This documentation is intended to provide instructions on how to run Flink locally on a single machine.</p>
<ul id="markdown-toc">
<li><a href="#download" id="markdown-toc-download">Download</a></li>
<li><a href="#requirements" id="markdown-toc-requirements">Requirements</a></li>
<li><a href="#configuration" id="markdown-toc-configuration">Configuration</a></li>
<li><a href="#starting-flink" id="markdown-toc-starting-flink">Starting Flink</a></li>
<li><a href="#flink-on-windows" id="markdown-toc-flink-on-windows">Flink on Windows</a> <ul>
<li><a href="#starting-with-windows-batch-files" id="markdown-toc-starting-with-windows-batch-files">Starting with Windows Batch Files</a></li>
<li><a href="#starting-with-cygwin-and-unix-scripts" id="markdown-toc-starting-with-cygwin-and-unix-scripts">Starting with Cygwin and Unix Scripts</a></li>
<li><a href="#installing-flink-from-git" id="markdown-toc-installing-flink-from-git">Installing Flink from Git</a></li>
</ul>
</li>
</ul>
<h2 id="download">Download</h2>
<p>Go to the <a href="http://flink.apache.org/downloads.html">downloads page</a> and get the ready to run package. If you want to interact with Hadoop (e.g. HDFS or HBase), make sure to pick the Flink package <strong>matching your Hadoop version</strong>. When in doubt or you plan to just work with the local file system pick the package for Hadoop 1.2.x.</p>
<h2 id="requirements">Requirements</h2>
<p>Flink runs on <strong>Linux</strong>, <strong>Mac OS X</strong> and <strong>Windows</strong>. The only requirement for a local setup is <strong>Java 1.6.x</strong> or higher. The following manual assumes a <em>UNIX-like environment</em>, for Windows see <a href="#flink-on-windows">Flink on Windows</a>.</p>
<p>You can check the correct installation of Java by issuing the following command:</p>
<div class="highlight"><pre><code class="language-bash">java -version</code></pre></div>
<p>The command should output something comparable to the following:</p>
<div class="highlight"><pre><code class="language-bash">java version <span class="s2">&quot;1.6.0_22&quot;</span>
Java<span class="o">(</span>TM<span class="o">)</span> SE Runtime Environment <span class="o">(</span>build 1.6.0_22-b04<span class="o">)</span>
Java HotSpot<span class="o">(</span>TM<span class="o">)</span> 64-Bit Server VM <span class="o">(</span>build 17.1-b03, mixed mode<span class="o">)</span></code></pre></div>
<h2 id="configuration">Configuration</h2>
<p><strong>For local mode Flink is ready to go out of the box and you don’t need to change the default configuration.</strong></p>
<p>The out of the box configuration will use your default Java installation. You can manually set the environment variable <code>JAVA_HOME</code> or the configuration key <code>env.java.home</code> in <code>conf/flink-conf.yaml</code> if you want to manually override the Java runtime to use. Consult the <a href="config.html">configuration page</a> for further details about configuring Flink.</p>
<h2 id="starting-flink">Starting Flink</h2>
<p><strong>You are now ready to start Flink.</strong> Unpack the downloaded archive and change to the newly created <code>flink</code> directory. There you can start Flink in local mode:</p>
<div class="highlight"><pre><code class="language-bash"><span class="nv">$ </span>tar xzf flink-*.tgz
<span class="nv">$ </span><span class="nb">cd </span>flink
<span class="nv">$ </span>bin/start-local.sh
Starting job manager</code></pre></div>
<p>You can check that the system is running by checking the log files in the <code>logs</code> directory:</p>
<div class="highlight"><pre><code class="language-bash"><span class="nv">$ </span>tail log/flink-*-jobmanager-*.log
INFO ... - Initializing memory manager with <span class="m">409</span> megabytes of memory
INFO ... - Trying to load org.apache.flinknephele.jobmanager.scheduler.local.LocalScheduler as scheduler
INFO ... - Setting up web info server, using web-root directory ...
INFO ... - Web info server will display information about nephele job-manager on localhost, port 8081.
INFO ... - Starting web info server <span class="k">for</span> JobManager on port 8081</code></pre></div>
<p>The JobManager will also start a web frontend on port 8081, which you can check with your browser at <code>http://localhost:8081</code>.</p>
<p>Instead of starting Flink with <code>bin/start-local.sh</code> you can also start Flink in an streaming optimized
mode, using <code>bin/start-local-streaming.sh</code>.</p>
<h2 id="flink-on-windows">Flink on Windows</h2>
<p>If you want to run Flink on Windows you need to download, unpack and configure the Flink archive as mentioned above. After that you can either use the <strong>Windows Batch</strong> file (<code>.bat</code>) or use <strong>Cygwin</strong> to run the Flink Jobmanager.</p>
<h3 id="starting-with-windows-batch-files">Starting with Windows Batch Files</h3>
<p>To start Flink in local mode from the <em>Windows Batch</em>, open the command window, navigate to the <code>bin/</code> directory of Flink and run <code>start-local.bat</code>.</p>
<p>Note: The <code>bin</code> folder of your Java Runtime Environment must be included in Window’s <code>%PATH%</code> variable. Follow this <a href="http://www.java.com/en/download/help/path.xml">guide</a> to add Java to the <code>%PATH%</code> variable.</p>
<div class="highlight"><pre><code class="language-bash"><span class="nv">$ </span><span class="nb">cd </span>flink
<span class="nv">$ </span><span class="nb">cd </span>bin
<span class="nv">$ </span>start-local.bat
Starting Flink job manager. Webinterface by default on http://localhost:8081/.
Do not close this batch window. Stop job manager by pressing Ctrl+C.</code></pre></div>
<p>After that, you need to open a second terminal to run jobs using <code>flink.bat</code>.</p>
<h3 id="starting-with-cygwin-and-unix-scripts">Starting with Cygwin and Unix Scripts</h3>
<p>With <em>Cygwin</em> you need to start the Cygwin Terminal, navigate to your Flink directory and run the <code>start-local.sh</code> script:</p>
<div class="highlight"><pre><code class="language-bash"><span class="nv">$ </span><span class="nb">cd </span>flink
<span class="nv">$ </span>bin/start-local.sh
Starting Nephele job manager</code></pre></div>
<h3 id="installing-flink-from-git">Installing Flink from Git</h3>
<p>If you are installing Flink from the git repository and you are using the Windows git shell, Cygwin can produce a failure similiar to this one:</p>
<div class="highlight"><pre><code class="language-bash">c:/flink/bin/start-local.sh: line 30: <span class="s1">$&#39;\r&#39;</span>: <span class="nb">command </span>not found</code></pre></div>
<p>This error occurs, because git is automatically transforming UNIX line endings to Windows style line endings when running in Windows. The problem is, that Cygwin can only deal with UNIX style line endings. The solution is to adjust the Cygwin settings to deal with the correct line endings by following these three steps:</p>
<ol>
<li>
<p>Start a Cygwin shell.</p>
</li>
<li>
<p>Determine your home directory by entering</p>
</li>
</ol>
<div class="highlight"><pre><code class="language-bash"><span class="nb">cd</span><span class="p">;</span> <span class="nb">pwd</span></code></pre></div>
<p>It will return a path under the Cygwin root path.</p>
<ol>
<li>Using NotePad, WordPad or a different text editor open the file <code>.bash_profile</code> in the home directory and append the following: (If the file does not exist you have to create it)</li>
</ol>
<div class="highlight"><pre><code class="language-bash"><span class="nb">export </span>SHELLOPTS
<span class="nb">set</span> -o igncr</code></pre></div>
<p>Save the file and open a new bash shell.</p>
</div>
<div class="col-sm-10 col-sm-offset-1">
<!-- Disqus thread and some vertical offset -->
<div style="margin-top: 75px; margin-bottom: 50px" id="disqus_thread"></div>
</div>
</div>
</div><!-- /.container -->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="http://flink.apache.org/docs/master/page/js/codetabs.js"></script>
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-52545728-1', 'auto');
ga('send', 'pageview');
</script>
<!-- Disqus -->
<script type="text/javascript">
var disqus_shortname = 'stratosphere-eu';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
</body>
</html>