blob: 3471915eb9f35579ab8d28e4a159d717207a1e81 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="Apache Forrest" name="Generator">
<meta name="Forrest-version" content="0.8">
<meta name="Forrest-skin-name" content="pelt">
<title>Hadoop Quickstart</title>
<link type="text/css" href="skin/basic.css" rel="stylesheet">
<link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
<link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
<link type="text/css" href="skin/profile.css" rel="stylesheet">
<script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
<link rel="shortcut icon" href="images/favicon.ico">
</head>
<body onload="init()">
<script type="text/javascript">ndeSetTextSize();</script>
<div id="top">
<!--+
|breadtrail
+-->
<div class="breadtrail">
<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://hadoop.apache.org/">Hadoop</a> &gt; <a href="http://hadoop.apache.org/core/">Core</a><script src="skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
</div>
<!--+
|header
+-->
<div class="header">
<!--+
|start group logo
+-->
<div class="grouplogo">
<a href="http://hadoop.apache.org/"><img class="logoImage" alt="Hadoop" src="images/hadoop-logo.jpg" title="Apache Hadoop"></a>
</div>
<!--+
|end group logo
+-->
<!--+
|start Project Logo
+-->
<div class="projectlogo">
<a href="http://hadoop.apache.org/core/"><img class="logoImage" alt="Hadoop" src="images/core-logo.gif" title="Scalable Computing Platform"></a>
</div>
<!--+
|end Project Logo
+-->
<!--+
|start Search
+-->
<div class="searchbox">
<form action="http://www.google.com/search" method="get" class="roundtopsmall">
<input value="hadoop.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">&nbsp;
<input name="Search" value="Search" type="submit">
</form>
</div>
<!--+
|end search
+-->
<!--+
|start Tabs
+-->
<ul id="tabs">
<li>
<a class="unselected" href="http://hadoop.apache.org/core/">Project</a>
</li>
<li>
<a class="unselected" href="http://wiki.apache.org/hadoop">Wiki</a>
</li>
<li class="current">
<a class="selected" href="index.html">Hadoop 0.17 Documentation</a>
</li>
</ul>
<!--+
|end Tabs
+-->
</div>
</div>
<div id="main">
<div id="publishedStrip">
<!--+
|start Subtabs
+-->
<div id="level2tabs"></div>
<!--+
|end Endtabs
+-->
<script type="text/javascript"><!--
document.write("Last Published: " + document.lastModified);
// --></script>
</div>
<!--+
|breadtrail
+-->
<div class="breadtrail">
&nbsp;
</div>
<!--+
|start Menu, mainarea
+-->
<!--+
|start Menu
+-->
<div id="menu">
<div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Documentation</div>
<div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
<div class="menuitem">
<a href="index.html">Overview</a>
</div>
<div class="menupage">
<div class="menupagetitle">Quickstart</div>
</div>
<div class="menuitem">
<a href="cluster_setup.html">Cluster Setup</a>
</div>
<div class="menuitem">
<a href="hdfs_design.html">HDFS Architecture</a>
</div>
<div class="menuitem">
<a href="hdfs_user_guide.html">HDFS User Guide</a>
</div>
<div class="menuitem">
<a href="hdfs_shell.html">HDFS Shell Guide</a>
</div>
<div class="menuitem">
<a href="hdfs_permissions_guide.html">HDFS Permissions Guide</a>
</div>
<div class="menuitem">
<a href="mapred_tutorial.html">Map-Reduce Tutorial</a>
</div>
<div class="menuitem">
<a href="native_libraries.html">Native Hadoop Libraries</a>
</div>
<div class="menuitem">
<a href="streaming.html">Streaming</a>
</div>
<div class="menuitem">
<a href="hod.html">Hadoop On Demand</a>
</div>
<div class="menuitem">
<a href="api/index.html">API Docs</a>
</div>
<div class="menuitem">
<a href="http://wiki.apache.org/hadoop/">Wiki</a>
</div>
<div class="menuitem">
<a href="http://wiki.apache.org/hadoop/FAQ">FAQ</a>
</div>
<div class="menuitem">
<a href="http://hadoop.apache.org/core/mailing_lists.html">Mailing Lists</a>
</div>
<div class="menuitem">
<a href="releasenotes.html">Release Notes</a>
</div>
<div class="menuitem">
<a href="changes.html">All Changes</a>
</div>
</div>
<div id="credit"></div>
<div id="roundbottom">
<img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
<!--+
|alternative credits
+-->
<div id="credit2"></div>
</div>
<!--+
|end Menu
+-->
<!--+
|start content
+-->
<div id="content">
<div title="Portable Document Format" class="pdflink">
<a class="dida" href="quickstart.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br>
PDF</a>
</div>
<h1>Hadoop Quickstart</h1>
<div id="minitoc-area">
<ul class="minitoc">
<li>
<a href="#Purpose">Purpose</a>
</li>
<li>
<a href="#PreReqs">Pre-requisites</a>
<ul class="minitoc">
<li>
<a href="#Supported+Platforms">Supported Platforms</a>
</li>
<li>
<a href="#Required+Software">Required Software</a>
<ul class="minitoc">
<li>
<a href="#Additional+requirements+for+Windows">Additional requirements for Windows</a>
</li>
</ul>
</li>
<li>
<a href="#Installing+Software">Installing Software</a>
</li>
</ul>
</li>
<li>
<a href="#Download">Download</a>
</li>
<li>
<a href="#Prepare+to+Start+the+Hadoop+Cluster">Prepare to Start the Hadoop Cluster</a>
</li>
<li>
<a href="#Local">Standalone Operation</a>
</li>
<li>
<a href="#PseudoDistributed">Pseudo-Distributed Operation</a>
<ul class="minitoc">
<li>
<a href="#Configuration">Configuration</a>
</li>
<li>
<a href="#Setup+passphraseless">Setup passphraseless ssh</a>
</li>
<li>
<a href="#Execution">Execution</a>
</li>
</ul>
</li>
<li>
<a href="#FullyDistributed">Fully-Distributed Operation</a>
</li>
</ul>
</div>
<a name="N1000D"></a><a name="Purpose"></a>
<h2 class="h3">Purpose</h2>
<div class="section">
<p>The purpose of this document is to help users get a single-node Hadoop
installation up and running very quickly so that users can get a flavour
of the <a href="hdfs_design.html">Hadoop Distributed File System
(<acronym title="Hadoop Distributed File System">HDFS</acronym>)</a> and
the Map-Reduce framework i.e. perform simple operations on HDFS, run
example/simple jobs etc.</p>
</div>
<a name="N1001F"></a><a name="PreReqs"></a>
<h2 class="h3">Pre-requisites</h2>
<div class="section">
<a name="N10025"></a><a name="Supported+Platforms"></a>
<h3 class="h4">Supported Platforms</h3>
<ul>
<li>
Hadoop has been demonstrated on GNU/Linux clusters with 2000 nodes.
</li>
<li>
Win32 is supported as a <em>development platform</em>. Distributed
operation has not been well tested on Win32, so this is not a
<em>production platform</em>.
</li>
</ul>
<a name="N1003B"></a><a name="Required+Software"></a>
<h3 class="h4">Required Software</h3>
<ol>
<li>
Java<sup>TM</sup> 1.5.x, preferably from Sun, must be installed.
</li>
<li>
<strong>ssh</strong> must be installed and <strong>sshd</strong> must
be running to use the Hadoop scripts that manage remote Hadoop
daemons.
</li>
</ol>
<a name="N10053"></a><a name="Additional+requirements+for+Windows"></a>
<h4>Additional requirements for Windows</h4>
<ol>
<li>
<a href="http://www.cygwin.com/">Cygwin</a> - Required for shell
support in addition to the required software above.
</li>
</ol>
<a name="N10065"></a><a name="Installing+Software"></a>
<h3 class="h4">Installing Software</h3>
<p>If your cluster doesn't have the requisite software you will need to
install it.</p>
<p>For example on Ubuntu Linux:</p>
<p>
<span class="codefrag">$ sudo apt-get install ssh</span>
<br>
<span class="codefrag">$ sudo apt-get install rsync</span>
</p>
<p>On Windows, if you did not install the required software when you
installed cygwin, start the cygwin installer and select the packages:</p>
<ul>
<li>openssh - the <em>Net</em> category</li>
</ul>
</div>
<a name="N10089"></a><a name="Download"></a>
<h2 class="h3">Download</h2>
<div class="section">
<p>
To get a Hadoop distribution, download a recent
<a href="http://hadoop.apache.org/core/releases.html">stable release</a> from one of the Apache Download
Mirrors.
</p>
</div>
<a name="N10097"></a><a name="Prepare+to+Start+the+Hadoop+Cluster"></a>
<h2 class="h3">Prepare to Start the Hadoop Cluster</h2>
<div class="section">
<p>
Unpack the downloaded Hadoop distribution. In the distribution, edit the
file <span class="codefrag">conf/hadoop-env.sh</span> to define at least
<span class="codefrag">JAVA_HOME</span> to be the root of your Java installation.
</p>
<p>
Try the following command:<br>
<span class="codefrag">$ bin/hadoop</span>
<br>
This will display the usage documentation for the <strong>hadoop</strong>
script.
</p>
<p>Now you are ready to start your Hadoop cluster in one of the three supported
modes:
</p>
<ul>
<li>Local (Standalone) Mode</li>
<li>Pseudo-Distributed Mode</li>
<li>Fully-Distributed Mode</li>
</ul>
</div>
<a name="N100C2"></a><a name="Local"></a>
<h2 class="h3">Standalone Operation</h2>
<div class="section">
<p>By default, Hadoop is configured to run things in a non-distributed
mode, as a single Java process. This is useful for debugging.</p>
<p>
The following example copies the unpacked <span class="codefrag">conf</span> directory to
use as input and then finds and displays every match of the given regular
expression. Output is written to the given <span class="codefrag">output</span> directory.
<br>
<span class="codefrag">$ mkdir input</span>
<br>
<span class="codefrag">$ cp conf/*.xml input</span>
<br>
<span class="codefrag">
$ bin/hadoop jar hadoop-*-examples.jar grep input output 'dfs[a-z.]+'
</span>
<br>
<span class="codefrag">$ cat output/*</span>
</p>
</div>
<a name="N100E6"></a><a name="PseudoDistributed"></a>
<h2 class="h3">Pseudo-Distributed Operation</h2>
<div class="section">
<p>Hadoop can also be run on a single-node in a pseudo-distributed mode
where each Hadoop daemon runs in a separate Java process.</p>
<a name="N100EF"></a><a name="Configuration"></a>
<h3 class="h4">Configuration</h3>
<p>Use the following <span class="codefrag">conf/hadoop-site.xml</span>:</p>
<table class="ForrestTable" cellspacing="1" cellpadding="4">
<tr>
<td colspan="1" rowspan="1">&lt;configuration&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1">&nbsp;&nbsp;&lt;property&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1">&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;fs.default.name&lt;/name&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1">&nbsp;&nbsp;&nbsp;&nbsp;&lt;value&gt;localhost:9000&lt;/value&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1">&nbsp;&nbsp;&lt;/property&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1">&nbsp;&nbsp;&lt;property&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1">&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;mapred.job.tracker&lt;/name&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1">&nbsp;&nbsp;&nbsp;&nbsp;&lt;value&gt;localhost:9001&lt;/value&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1">&nbsp;&nbsp;&lt;/property&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1">&nbsp;&nbsp;&lt;property&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1">&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;dfs.replication&lt;/name&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1">&nbsp;&nbsp;&nbsp;&nbsp;&lt;value&gt;1&lt;/value&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1">&nbsp;&nbsp;&lt;/property&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1">&lt;/configuration&gt;</td>
</tr>
</table>
<a name="N10153"></a><a name="Setup+passphraseless"></a>
<h3 class="h4">Setup passphraseless ssh</h3>
<p>
Now check that you can ssh to the localhost without a passphrase:<br>
<span class="codefrag">$ ssh localhost</span>
</p>
<p>
If you cannot ssh to localhost without a passphrase, execute the
following commands:<br>
<span class="codefrag">$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa</span>
<br>
<span class="codefrag">$ cat ~/.ssh/id_dsa.pub &gt;&gt; ~/.ssh/authorized_keys</span>
</p>
<a name="N10170"></a><a name="Execution"></a>
<h3 class="h4">Execution</h3>
<p>
Format a new distributed-filesystem:<br>
<span class="codefrag">$ bin/hadoop namenode -format</span>
</p>
<p>
Start The hadoop daemons:<br>
<span class="codefrag">$ bin/start-all.sh</span>
</p>
<p>The hadoop daemon log output is written to the
<span class="codefrag">${HADOOP_LOG_DIR}</span> directory (defaults to
<span class="codefrag">${HADOOP_HOME}/logs</span>).</p>
<p>Browse the web-interface for the NameNode and the JobTracker, by
default they are available at:</p>
<ul>
<li>
<span class="codefrag">NameNode</span> -
<a href="http://localhost:50070/">http://localhost:50070/</a>
</li>
<li>
<span class="codefrag">JobTracker</span> -
<a href="http://localhost:50030/">http://localhost:50030/</a>
</li>
</ul>
<p>
Copy the input files into the distributed filesystem:<br>
<span class="codefrag">$ bin/hadoop dfs -put conf input</span>
</p>
<p>
Run some of the examples provided:<br>
<span class="codefrag">
$ bin/hadoop jar hadoop-*-examples.jar grep input output 'dfs[a-z.]+'
</span>
</p>
<p>Examine the output files:</p>
<p>
Copy the output files from the distributed filesystem to the local
filesytem and examine them:<br>
<span class="codefrag">$ bin/hadoop dfs -get output output</span>
<br>
<span class="codefrag">$ cat output/*</span>
</p>
<p> or </p>
<p>
View the output files on the distributed filesystem:<br>
<span class="codefrag">$ bin/hadoop dfs -cat output/*</span>
</p>
<p>
When you're done, stop the daemons with:<br>
<span class="codefrag">$ bin/stop-all.sh</span>
</p>
</div>
<a name="N101DD"></a><a name="FullyDistributed"></a>
<h2 class="h3">Fully-Distributed Operation</h2>
<div class="section">
<p>Information on setting up fully-distributed, non-trivial clusters
can be found <a href="cluster_setup.html">here</a>.</p>
</div>
<p>
<em>Java and JNI are trademarks or registered trademarks of
Sun Microsystems, Inc. in the United States and other countries.</em>
</p>
</div>
<!--+
|end content
+-->
<div class="clearboth">&nbsp;</div>
</div>
<div id="footer">
<!--+
|start bottomstrip
+-->
<div class="lastmodified">
<script type="text/javascript"><!--
document.write("Last Published: " + document.lastModified);
// --></script>
</div>
<div class="copyright">
Copyright &copy;
2007 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a>
</div>
<!--+
|end bottomstrip
+-->
</div>
</body>
</html>