blob: eef65b3de3084c6201ee9922beaea34862dcdc98 [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: YARN 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>YARN Setup</h1>
<ul id="markdown-toc">
<li><a href="#quickstart-start-a-long-running-flink-cluster-on-yarn" id="markdown-toc-quickstart-start-a-long-running-flink-cluster-on-yarn">Quickstart: Start a long-running Flink cluster on YARN</a></li>
<li><a href="#quickstart-run-a-flink-job-on-yarn" id="markdown-toc-quickstart-run-a-flink-job-on-yarn">Quickstart: Run a Flink job on YARN</a></li>
<li><a href="#apache-flink-on-hadoop-yarn-using-a-yarn-session" id="markdown-toc-apache-flink-on-hadoop-yarn-using-a-yarn-session">Apache Flink on Hadoop YARN using a YARN Session</a> <ul>
<li><a href="#start-flink-session" id="markdown-toc-start-flink-session">Start Flink Session</a></li>
<li><a href="#submit-job-to-flink" id="markdown-toc-submit-job-to-flink">Submit Job to Flink</a></li>
</ul>
</li>
<li><a href="#run-a-single-flink-job-on-hadoop-yarn" id="markdown-toc-run-a-single-flink-job-on-hadoop-yarn">Run a single Flink job on Hadoop YARN</a></li>
<li><a href="#recovery-behavior-of-flink-on-yarn" id="markdown-toc-recovery-behavior-of-flink-on-yarn">Recovery behavior of Flink on YARN</a></li>
<li><a href="#debugging-a-failed-yarn-session" id="markdown-toc-debugging-a-failed-yarn-session">Debugging a failed YARN session</a> <ul>
<li><a href="#log-files" id="markdown-toc-log-files">Log Files</a></li>
<li><a href="#yarn-client-console--webinterfaces" id="markdown-toc-yarn-client-console--webinterfaces">YARN Client console &amp; Webinterfaces</a></li>
</ul>
</li>
<li><a href="#build-yarn-client-for-a-specific-hadoop-version" id="markdown-toc-build-yarn-client-for-a-specific-hadoop-version">Build YARN client for a specific Hadoop version</a></li>
<li><a href="#background--internals" id="markdown-toc-background--internals">Background / Internals</a></li>
</ul>
<h2 id="quickstart-start-a-long-running-flink-cluster-on-yarn">Quickstart: Start a long-running Flink cluster on YARN</h2>
<p>Start a YARN session with 4 Task Managers (each with 4 GB of Heapspace):</p>
<div class="highlight"><pre><code class="language-bash"><span class="c"># get the hadoop2 package from the Flink download page at</span>
<span class="c"># http://flink.apache.org/downloads.html</span>
curl -O &lt;flink_hadoop2_download_url&gt;
tar xvzf flink-0.10-SNAPSHOT-bin-hadoop2.tgz
<span class="nb">cd </span>flink-0.10-SNAPSHOT/
./bin/yarn-session.sh -n <span class="m">4</span> -jm <span class="m">1024</span> -tm 4096</code></pre></div>
<p>Specify the <code>-s</code> flag for the number of processing slots per Task Manager. We recommend to set the number of slots to the number of processors per machine.</p>
<p>Once the session has been started, you can submit jobs to the cluster using the <code>./bin/flink</code> tool.</p>
<h2 id="quickstart-run-a-flink-job-on-yarn">Quickstart: Run a Flink job on YARN</h2>
<div class="highlight"><pre><code class="language-bash"><span class="c"># get the hadoop2 package from the Flink download page at</span>
<span class="c"># http://flink.apache.org/downloads.html</span>
curl -O &lt;flink_hadoop2_download_url&gt;
tar xvzf flink-0.10-SNAPSHOT-bin-hadoop2.tgz
<span class="nb">cd </span>flink-0.10-SNAPSHOT/
./bin/flink run -m yarn-cluster -yn <span class="m">4</span> -yjm <span class="m">1024</span> -ytm <span class="m">4096</span> ./examples/flink-java-examples-0.10-SNAPSHOT-WordCount.jar</code></pre></div>
<h2 id="apache-flink-on-hadoop-yarn-using-a-yarn-session">Apache Flink on Hadoop YARN using a YARN Session</h2>
<p>Apache <a href="http://hadoop.apache.org/">Hadoop YARN</a> is a cluster resource management framework. It allows to run various distributed applications on top of a cluster. Flink runs on YARN next to other applications. Users do not have to setup or install anything if there is already a YARN setup.</p>
<p><strong>Requirements</strong></p>
<ul>
<li>Apache Hadoop 2.2</li>
<li>HDFS (Hadoop Distributed File System) (or another distributed file system supported by Hadoop)</li>
</ul>
<p>If you have troubles using the Flink YARN client, have a look in the <a href="http://flink.apache.org/docs/master/faq.html">FAQ section</a>.</p>
<h3 id="start-flink-session">Start Flink Session</h3>
<p>Follow these instructions to learn how to launch a Flink Session within your YARN cluster.</p>
<p>A session will start all required Flink services (JobManager and TaskManagers) so that you can submit programs to the cluster. Note that you can run multiple programs per session.</p>
<h4 id="download-flink-for-yarn">Download Flink for YARN</h4>
<p>Download the YARN tgz package on the <a href="http://flink.apache.org/docs/master/downloads.html">download page</a>. It contains the required files.</p>
<p>Extract the package using:</p>
<div class="highlight"><pre><code class="language-bash">tar xvzf flink-0.10-SNAPSHOT-bin-hadoop2.tgz
<span class="nb">cd </span>flink-0.10-SNAPSHOT/</code></pre></div>
<p>If you want to build the YARN .tgz file from sources, follow the <a href="building.html">build instructions</a>. You can find the result of the build in <code>flink-dist/target/flink-0.10-SNAPSHOT-bin/flink-0.10-SNAPSHOT/</code> (<em>Note: The version might be different for you</em> ).</p>
<h4 id="start-a-session">Start a Session</h4>
<p>Use the following command to start a session</p>
<div class="highlight"><pre><code class="language-bash">./bin/yarn-session.sh</code></pre></div>
<p>This command will show you the following overview:</p>
<div class="highlight"><pre><code class="language-bash">Usage:
Required
-n,--container &lt;arg&gt; Number of YARN container to allocate <span class="o">(=</span>Number of Task Managers<span class="o">)</span>
Optional
-D &lt;arg&gt; Dynamic properties
-d,--detached Start detached
-jm,--jobManagerMemory &lt;arg&gt; Memory <span class="k">for</span> JobManager Container <span class="o">[</span>in MB<span class="o">]</span>
-q,--query Display available YARN resources <span class="o">(</span>memory, cores<span class="o">)</span>
-qu,--queue &lt;arg&gt; Specify YARN queue.
-s,--slots &lt;arg&gt; Number of slots per TaskManager
-st,--streaming Start Flink in streaming mode
-tm,--taskManagerMemory &lt;arg&gt; Memory per TaskManager Container <span class="o">[</span>in MB<span class="o">]</span></code></pre></div>
<p>Please note that the Client requires the <code>YARN_CONF_DIR</code> or <code>HADOOP_CONF_DIR</code> environment variable to be set to read the YARN and HDFS configuration.</p>
<p><strong>Example:</strong> Issue the following command to allocate 10 Task Managers, with 8 GB of memory and 32 processing slots each:</p>
<div class="highlight"><pre><code class="language-bash">./bin/yarn-session.sh -n <span class="m">10</span> -tm <span class="m">8192</span> -s 32</code></pre></div>
<p>The system will use the configuration in <code>conf/flink-config.yaml</code>. Please follow our <a href="config.html">configuration guide</a> if you want to change something.</p>
<p>Flink on YARN will overwrite the following configuration parameters <code>jobmanager.rpc.address</code> (because the JobManager is always allocated at different machines), <code>taskmanager.tmp.dirs</code> (we are using the tmp directories given by YARN) and <code>parallelism.default</code> if the number of slots has been specified.</p>
<p>If you don’t want to change the configuration file to set configuration parameters, there is the option to pass dynamic properties via the <code>-D</code> flag. So you can pass parameters this way: <code>-Dfs.overwrite-files=true -Dtaskmanager.network.numberOfBuffers=16368</code>.</p>
<p>The example invocation starts 11 containers, since there is one additional container for the ApplicationMaster and Job Manager.</p>
<p>Once Flink is deployed in your YARN cluster, it will show you the connection details of the Job Manager.</p>
<p>Stop the YARN session by stopping the unix process (using CTRL+C) or by entering ‘stop’ into the client.</p>
<h4 id="detached-yarn-session">Detached YARN session</h4>
<p>If you do not want to keep the Flink YARN client running all the time, its also possible to start a <em>detached</em> YARN session.
The parameter for that is called <code>-d</code> or <code>--detached</code>.</p>
<p>In that case, the Flink YARN client will only submit Flink to the cluster and then close itself.
Note that in this case its not possible to stop the YARN session using Flink.</p>
<p>Use the YARN utilities (<code>yarn application -kill &lt;appId</code>) to stop the YARN session.</p>
<h3 id="submit-job-to-flink">Submit Job to Flink</h3>
<p>Use the following command to submit a Flink program to the YARN cluster:</p>
<div class="highlight"><pre><code class="language-bash">./bin/flink</code></pre></div>
<p>Please refer to the documentation of the <a href="http://flink.apache.org/docs/master/apis/cli.html">commandline client</a>.</p>
<p>The command will show you a help menu like this:</p>
<div class="highlight"><pre><code class="language-bash"><span class="o">[</span>...<span class="o">]</span>
Action <span class="s2">&quot;run&quot;</span> compiles and runs a program.
Syntax: run <span class="o">[</span>OPTIONS<span class="o">]</span> &lt;jar-file&gt; &lt;arguments&gt;
<span class="s2">&quot;run&quot;</span> action arguments:
-c,--class &lt;classname&gt; Class with the program entry point <span class="o">(</span><span class="s2">&quot;main&quot;</span>
method or <span class="s2">&quot;getPlan()&quot;</span> method. Only needed
<span class="k">if</span> the JAR file does not specify the class
in its manifest.
-m,--jobmanager &lt;host:port&gt; Address of the JobManager <span class="o">(</span>master<span class="o">)</span> to
which to connect. Use this flag to connect
to a different JobManager than the one
specified in the configuration.
-p,--parallelism &lt;parallelism&gt; The parallelism with which to run the
program. Optional flag to override the
default value specified in the
configuration</code></pre></div>
<p>Use the <em>run</em> action to submit a job to YARN. The client is able to determine the address of the JobManager. In the rare event of a problem, you can also pass the JobManager address using the <code>-m</code> argument. The JobManager address is visible in the YARN console.</p>
<p><strong>Example</strong></p>
<div class="highlight"><pre><code class="language-bash">wget -O apache-license-v2.txt http://www.apache.org/licenses/LICENSE-2.0.txt
hadoop fs -copyFromLocal LICENSE-2.0.txt hdfs:/// ...
./bin/flink run ./examples/flink-java-examples-0.10-SNAPSHOT-WordCount.jar <span class="se">\</span>
hdfs:///..../apache-license-v2.txt hdfs:///.../wordcount-result.txt</code></pre></div>
<p>If there is the following error, make sure that all TaskManagers started:</p>
<div class="highlight"><pre><code class="language-bash">Exception in thread <span class="s2">&quot;main&quot;</span> org.apache.flink.compiler.CompilerException:
Available instances could not be determined from job manager: Connection timed out.</code></pre></div>
<p>You can check the number of TaskManagers in the JobManager web interface. The address of this interface is printed in the YARN session console.</p>
<p>If the TaskManagers do not show up after a minute, you should investigate the issue using the log files.</p>
<h2 id="run-a-single-flink-job-on-hadoop-yarn">Run a single Flink job on Hadoop YARN</h2>
<p>The documentation above describes how to start a Flink cluster within a Hadoop YARN environment.
It is also possible to launch Flink within YARN only for executing a single job.</p>
<p>Please note that the client then expects the <code>-yn</code> value to be set (number of TaskManagers).</p>
<p><strong><em>Example:</em></strong></p>
<div class="highlight"><pre><code class="language-bash">./bin/flink run -m yarn-cluster -yn <span class="m">2</span> ./examples/flink-java-examples-0.10-SNAPSHOT-WordCount.jar</code></pre></div>
<p>The command line options of the YARN session are also available with the <code>./bin/flink</code> tool. They are prefixed with a <code>y</code> or <code>yarn</code> (for the long argument options).</p>
<h2 id="recovery-behavior-of-flink-on-yarn">Recovery behavior of Flink on YARN</h2>
<p>Flink’s YARN client has the following configuration parameters to control how to behave in case of container failures. These parameters can be set either from the <code>conf/flink-conf.yaml</code> or when starting the YARN session, using <code>-D</code> parameters.</p>
<ul>
<li><code>yarn.reallocate-failed</code>: This parameter controls whether Flink should reallocate failed TaskManager containers. Default: true</li>
<li><code>yarn.maximum-failed-containers</code>: The maximum number of failed containers the ApplicationMaster accepts until it fails the YARN session. Default: The number of initally requested TaskManagers (<code>-n</code>).</li>
<li><code>yarn.application-attempts</code>: The number of ApplicationMaster (+ its TaskManager containers) attempts. If this value is set to 1 (default), the entire YARN session will fail when the Application master fails. Higher values specify the number of restarts of the ApplicationMaster by YARN.</li>
</ul>
<h2 id="debugging-a-failed-yarn-session">Debugging a failed YARN session</h2>
<p>There are many reasons why a Flink YARN session deployment can fail. A misconfigured Hadoop setup (HDFS permissions, YARN configuration), version incompatibilities (running Flink with vanilla Hadoop dependencies on Cloudera Hadoop) or other errors.</p>
<h3 id="log-files">Log Files</h3>
<p>In cases where the Flink YARN session fails during the deployment itself, users have to rely on the logging capabilities of Hadoop YARN. The most useful feature for that is the <a href="http://hortonworks.com/blog/simplifying-user-logs-management-and-access-in-yarn/">YARN log aggregation</a>.
To enable it, users have to set the <code>yarn.log-aggregation-enable</code> property to <code>true</code> in the <code>yarn-site.xml</code> file.
Once that is enabled, users can use the following command to retrieve all log files of a (failed) YARN session.</p>
<div class="highlight"><pre><code>yarn logs -applicationId &lt;application ID&gt;
</code></pre></div>
<p>Note that it takes a few seconds after the session has finished until the logs show up.</p>
<h3 id="yarn-client-console--webinterfaces">YARN Client console &amp; Webinterfaces</h3>
<p>The Flink YARN client also prints error messages in the terminal if errors occur during runtime (for example if a TaskManager stops working after some time).</p>
<p>In addition to that, there is the YARN Resource Manager webinterface (by default on port 8088). The port of the Resource Manager web interface is determined by the <code>yarn.resourcemanager.webapp.address</code> configuration value.</p>
<p>It allows to access log files for running YARN applications and shows diagnostics for failed apps.</p>
<h2 id="build-yarn-client-for-a-specific-hadoop-version">Build YARN client for a specific Hadoop version</h2>
<p>Users using Hadoop distributions from companies like Hortonworks, Cloudera or MapR might have to build Flink against their specific versions of Hadoop (HDFS) and YARN. Please read the <a href="building.html">build instructions</a> for more details.</p>
<h2 id="background--internals">Background / Internals</h2>
<p>This section briefly describes how Flink and YARN interact.</p>
<p><img src="fig/FlinkOnYarn.svg" class="img-responsive" /></p>
<p>The YARN client needs to access the Hadoop configuration to connect to the YARN resource manager and to HDFS. It determines the Hadoop configuration using the following strategy:</p>
<ul>
<li>Test if <code>YARN_CONF_DIR</code>, <code>HADOOP_CONF_DIR</code> or <code>HADOOP_CONF_PATH</code> are set (in that order). If one of these variables are set, they are used to read the configuration.</li>
<li>If the above strategy fails (this should not be the case in a correct YARN setup), the client is using the <code>HADOOP_HOME</code> environment variable. If it is set, the client tries to access <code>$HADOOP_HOME/etc/hadoop</code> (Hadoop 2) and <code>$HADOOP_HOME/conf</code> (Hadoop 1).</li>
</ul>
<p>When starting a new Flink YARN session, the client first checks if the requested resources (containers and memory) are available. After that, it uploads a jar that contains Flink and the configuration to HDFS (step 1).</p>
<p>The next step of the client is to request (step 2) a YARN container to start the <em>ApplicationMaster</em> (step 3). Since the client registered the configuration and jar-file as a resource for the container, the NodeManager of YARN running on that particular machine will take care of preparing the container (e.g. downloading the files). Once that has finished, the <em>ApplicationMaster</em> (AM) is started.</p>
<p>The <em>JobManager</em> and AM are running in the same container. Once they successfully started, the AM knows the address of the JobManager (its own host). It is generating a new Flink configuration file for the TaskManagers (so that they can connect to the JobManager). The file is also uploaded to HDFS. Additionally, the <em>AM</em> container is also serving Flink’s web interface. The ports Flink is using for its services are the standard ports configured by the user + the application id as an offset. This allows users to execute multiple Flink YARN sessions in parallel.</p>
<p>After that, the AM starts allocating the containers for Flink’s TaskManagers, which will download the jar file and the modified configuration from the HDFS. Once these steps are completed, Flink is set up and ready to accept Jobs.</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>