blob: 964d12ae72ec234cf2997c17fc4f1255ad3d64ac [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
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
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
Hadoop is a distributed computing platform.
<p>Hadoop primarily consists of the <a
href="org/apache/hadoop/hdfs/package-summary.html">Hadoop Distributed FileSystem
(HDFS)</a> and an
implementation of the <a href="org/apache/hadoop/mapred/package-summary.html">
Map-Reduce</a> programming paradigm.</p>
<p>Hadoop is a software framework that lets one easily write and run applications
that process vast amounts of data. Here's what makes Hadoop especially useful:</p>
<b>Scalable</b>: Hadoop can reliably store and process petabytes.
<b>Economical</b>: It distributes the data and processing across clusters
of commonly available computers. These clusters can number into the thousands
of nodes.
<b>Efficient</b>: By distributing the data, Hadoop can process it in parallel
on the nodes where the data is located. This makes it extremely rapid.
<b>Reliable</b>: Hadoop automatically maintains multiple copies of data and
automatically redeploys computing tasks based on failures.
Hadoop was been demonstrated on GNU/Linux clusters with 2000 nodes.
Win32 is supported as a <i>development</i> platform. Distributed operation
has not been well tested on Win32, so this is not a <i>production</i>
<h3>Requisite Software</h3>
Java 1.6.x, preferably from
<a href="">Sun</a>.
Set <tt>JAVA_HOME</tt> to the root of your Java installation.
ssh must be installed and sshd must be running to use Hadoop's
scripts to manage remote Hadoop daemons.
rsync may be installed to use Hadoop's scripts to manage remote
Hadoop installations.
<h4>Additional requirements for Windows</h4>
<a href="">Cygwin</a> - Required for shell support in
addition to the required software above.
<h3>Installing Required Software</h3>
<p>If your platform does not have the required software listed above, you
will have to install it.</p>
<p>For example on Ubuntu Linux:</p>
$ sudo apt-get install ssh<br>
$ sudo apt-get install rsync<br>
<p>On Windows, if you did not install the required software when you
installed cygwin, start the cygwin installer and select the packages:</p>
<li>openssh - the "Net" category</li>
<li>rsync - the "Net" category</li>
<h2>Getting Started</h2>
<p>First, you need to get a copy of the Hadoop code.</p>
<p>Edit the file <tt>conf/</tt> to define at least
<p>Try the following command:</p>
<p>This will display the documentation for the Hadoop command script.</p>
<h2>Standalone operation</h2>
<p>By default, Hadoop is configured to run things in a non-distributed
mode, as a single Java process. This is useful for debugging, and can
be demonstrated as follows:</p>
mkdir input<br>
cp conf/*.xml input<br>
bin/hadoop jar hadoop-*-examples.jar grep input output 'dfs[a-z.]+'<br>
cat output/*
<p>This will display counts for each match of the <a
regular expression.</a></p>
<p>Note that input is specified as a <em>directory</em> containing input
files and that output is also specified as a directory where parts are
<h2>Distributed operation</h2>
To configure Hadoop for distributed operation you must specify the
<li>The NameNode (Distributed Filesystem master) host. This is
specified with the configuration property <tt><a
<li>The {@link org.apache.hadoop.mapred.JobTracker} (MapReduce master)
host and port. This is specified with the configuration property
<li>A <em>slaves</em> file that lists the names of all the hosts in
the cluster. The default slaves file is <tt>conf/slaves</tt>.
<h3>Pseudo-distributed configuration</h3>
You can in fact run everything on a single host. To run things this
way, put the following in:
<p>(We also set the HDFS replication level to 1 in order to
reduce warnings when running on a single node.)</p>
<p>Now check that the command <br><tt>ssh localhost</tt><br> does not
require a password. If it does, execute the following commands:</p>
<p><tt>ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa<br>
cat ~/.ssh/ >> ~/.ssh/authorized_keys
<p>A new distributed filesystem must be formatted with the following
command, run on the master node:</p>
<p><tt>bin/hadoop namenode -format</tt></p>
<p>The Hadoop daemons are started with the following command:</p>
<p>Daemon log output is written to the <tt>logs/</tt> directory.</p>
<p>Input files are copied into the distributed filesystem as follows:</p>
<p><tt>bin/hadoop fs -put input input</tt></p>
<h3>Distributed execution</h3>
<p>Things are run as before, but output must be copied locally to
examine it:</p>
bin/hadoop jar hadoop-*-examples.jar grep input output 'dfs[a-z.]+'<br>
bin/hadoop fs -get output output
cat output/*
<p>When you're done, stop the daemons with:</p>
<h3>Fully-distributed operation</h3>
<p>Fully distributed operation is just like the pseudo-distributed operation
described above, except, specify:</p>
<li>The hostname or IP address of your master server in the value
for <tt><a
as <tt><em>hdfs://</em></tt> in <tt>conf/core-site.xml</tt>.</li>
<li>The host and port of the your master server in the value
of <tt><a href="../mapred-default.html#mapreduce.jobtracker.address">mapreduce.jobtracker.address</a></tt>
as <tt><em></em>:<em>port</em></tt> in <tt>conf/mapred-site.xml</tt>.</li>
<li>Directories for <tt><a
href="../"></a></tt> and
<tt><a href="../"></a>
in <tt>conf/hdfs-site.xml</tt>.
</tt>These are local directories used to hold distributed filesystem
data on the master node and slave nodes respectively. Note
that <tt></tt> may contain a space- or comma-separated
list of directory names, so that data may be stored on multiple local
<li><tt><a href="../mapred-default.html#mapreduce.cluster.local.dir">mapreduce.cluster.local.dir</a></tt>
in <tt>conf/mapred-site.xml</tt>, the local directory where temporary
MapReduce data is stored. It also may be a list of directories.</li>
and <tt><a
in <tt>conf/mapred-site.xml</tt>.
As a rule of thumb, use 10x the
number of slave processors for <tt>mapreduce.job.maps</tt>, and 2x the
number of slave processors for <tt>mapreduce.job.reduces</tt>.</li>
<p>Finally, list all slave hostnames or IP addresses in your
<tt>conf/slaves</tt> file, one per line. Then format your filesystem
and start your cluster on your master node, as above.