Hadoop 0.18.1 API

Hadoop is a distributed computing platform.

See:
          Description

Core
org.apache.hadoop  
org.apache.hadoop.conf Configuration of system parameters.
org.apache.hadoop.dfs A distributed implementation of FileSystem.
org.apache.hadoop.dfs.datanode.metrics  
org.apache.hadoop.dfs.namenode.metrics  
org.apache.hadoop.filecache  
org.apache.hadoop.fs An abstract file system API.
org.apache.hadoop.fs.ftp  
org.apache.hadoop.fs.kfs A client for the Kosmos filesystem (KFS)
org.apache.hadoop.fs.permission  
org.apache.hadoop.fs.s3 A distributed, block-based implementation of FileSystem that uses Amazon S3 as a backing store.
org.apache.hadoop.fs.s3native A distributed implementation of FileSystem for reading and writing files on Amazon S3.
org.apache.hadoop.fs.shell  
org.apache.hadoop.io Generic i/o code for use when reading and writing data to the network, to databases, and to files.
org.apache.hadoop.io.compress  
org.apache.hadoop.io.compress.lzo  
org.apache.hadoop.io.compress.zlib  
org.apache.hadoop.io.retry A mechanism for selectively retrying methods that throw exceptions under certain circumstances.
org.apache.hadoop.io.serializer This package provides a mechanism for using different serialization frameworks in Hadoop.
org.apache.hadoop.ipc Tools to help define network clients and servers.
org.apache.hadoop.ipc.metrics  
org.apache.hadoop.log  
org.apache.hadoop.mapred A software framework for easily writing applications which process vast amounts of data (multi-terabyte data-sets) parallelly on large clusters (thousands of nodes) built of commodity hardware in a reliable, fault-tolerant manner.
org.apache.hadoop.mapred.jobcontrol Utilities for managing dependent jobs.
org.apache.hadoop.mapred.join Given a set of sorted datasets keyed with the same class and yielding equal partitions, it is possible to effect a join of those datasets prior to the map.
org.apache.hadoop.mapred.lib Library of generally useful mappers, reducers, and partitioners.
org.apache.hadoop.mapred.lib.aggregate Classes for performing various counting and aggregations.
org.apache.hadoop.mapred.pipes Hadoop Pipes allows C++ code to use Hadoop DFS and map/reduce.
org.apache.hadoop.metrics This package defines an API for reporting performance metric information.
org.apache.hadoop.metrics.file Implementation of the metrics package that writes the metrics to a file.
org.apache.hadoop.metrics.ganglia Implementation of the metrics package that sends metric data to Ganglia.
org.apache.hadoop.metrics.jvm  
org.apache.hadoop.metrics.spi The Service Provider Interface for the Metrics API.
org.apache.hadoop.metrics.util  
org.apache.hadoop.net Network-related classes.
org.apache.hadoop.record Hadoop record I/O contains classes and a record description language translator for simplifying serialization and deserialization of records in a language-neutral manner.
org.apache.hadoop.record.compiler This package contains classes needed for code generation from the hadoop record compiler.
org.apache.hadoop.record.compiler.ant  
org.apache.hadoop.record.compiler.generated This package contains code generated by JavaCC from the Hadoop record syntax file rcc.jj.
org.apache.hadoop.record.meta  
org.apache.hadoop.security  
org.apache.hadoop.util Common utilities.

 

Examples
org.apache.hadoop.examples Hadoop example code.
org.apache.hadoop.examples.dancing This package is a distributed implementation of Knuth's dancing links algorithm that can run under Hadoop.

 

contrib: Streaming
org.apache.hadoop.streaming Hadoop Streaming is a utility which allows users to create and run Map-Reduce jobs with any executables (e.g.

 

contrib: DataJoin
org.apache.hadoop.contrib.utils.join  

 

contrib: Index
org.apache.hadoop.contrib.index.example  
org.apache.hadoop.contrib.index.lucene  
org.apache.hadoop.contrib.index.main  
org.apache.hadoop.contrib.index.mapred  

 

Hadoop is a distributed computing platform.

Hadoop primarily consists of the Hadoop Distributed FileSystem (HDFS) and an implementation of the Map-Reduce programming paradigm.

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:

Requirements

Platforms

Requisite Software

  1. Java 1.5.x, preferably from Sun. Set JAVA_HOME to the root of your Java installation.
  2. ssh must be installed and sshd must be running to use Hadoop's scripts to manage remote Hadoop daemons.
  3. rsync may be installed to use Hadoop's scripts to manage remote Hadoop installations.

Additional requirements for Windows

  1. Cygwin - Required for shell support in addition to the required software above.

Installing Required Software

If your platform does not have the required software listed above, you will have to install it.

For example on Ubuntu Linux:

$ sudo apt-get install ssh
$ sudo apt-get install rsync

On Windows, if you did not install the required software when you installed cygwin, start the cygwin installer and select the packages:

Getting Started

First, you need to get a copy of the Hadoop code.

Edit the file conf/hadoop-env.sh to define at least JAVA_HOME.

Try the following command:

bin/hadoop

This will display the documentation for the Hadoop command script.

Standalone operation

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:

mkdir input
cp conf/*.xml input
bin/hadoop jar hadoop-*-examples.jar grep input output 'dfs[a-z.]+'
cat output/*

This will display counts for each match of the regular expression.

Note that input is specified as a directory containing input files and that output is also specified as a directory where parts are written.

Distributed operation

To configure Hadoop for distributed operation you must specify the following:
  1. The NameNode (Distributed Filesystem master) host. This is specified with the configuration property fs.default.name.
  2. The JobTracker (MapReduce master) host and port. This is specified with the configuration property mapred.job.tracker.
  3. A slaves file that lists the names of all the hosts in the cluster. The default slaves file is conf/slaves.

Pseudo-distributed configuration

You can in fact run everything on a single host. To run things this way, put the following in conf/hadoop-site.xml: <configuration> <property> <name>fs.default.name</name> <value>hdfs://localhost/</value> </property> <property> <name>mapred.job.tracker</name> <value>localhost:9001</value> </property> <property> <name>dfs.replication</name> <value>1</value> </property> </configuration>

(We also set the HDFS replication level to 1 in order to reduce warnings when running on a single node.)

Now check that the command
ssh localhost
does not require a password. If it does, execute the following commands:

ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

Bootstrapping

A new distributed filesystem must be formatted with the following command, run on the master node:

bin/hadoop namenode -format

The Hadoop daemons are started with the following command:

bin/start-all.sh

Daemon log output is written to the logs/ directory.

Input files are copied into the distributed filesystem as follows:

bin/hadoop fs -put input input

Distributed execution

Things are run as before, but output must be copied locally to examine it:

bin/hadoop jar hadoop-*-examples.jar grep input output 'dfs[a-z.]+'
bin/hadoop fs -get output output cat output/*

When you're done, stop the daemons with:

bin/stop-all.sh

Fully-distributed operation

Fully distributed operation is just like the pseudo-distributed operation described above, except, in conf/hadoop-site.xml, specify:

  1. The hostname or IP address of your master server in the value for fs.default.name, as hdfs://master.example.com/.
  2. The host and port of the your master server in the value of mapred.job.tracker as master.example.com:port.
  3. Directories for dfs.name.dir and dfs.data.dir. These are local directories used to hold distributed filesystem data on the master node and slave nodes respectively. Note that dfs.data.dir may contain a space- or comma-separated list of directory names, so that data may be stored on multiple local devices.
  4. mapred.local.dir, the local directory where temporary MapReduce data is stored. It also may be a list of directories.
  5. mapred.map.tasks and mapred.reduce.tasks. As a rule of thumb, use 10x the number of slave processors for mapred.map.tasks, and 2x the number of slave processors for mapred.reduce.tasks.

Finally, list all slave hostnames or IP addresses in your conf/slaves file, one per line. Then format your filesystem and start your cluster on your master node, as above.



Copyright © 2008 The Apache Software Foundation