How to set up Hadoop on single node and multi node?

We will describe Hadoop setup on single node and multi node. The Hadoop  environment setup and configuration will be described in details. First you need to download the following software (rpm).

  • Java JDK RPM
  • Apache Hadoop RPM

A)  Single node system Hadoop setup

1) Install JDK on a Red Hat or CentOS 5+ system.

$ ./

Java is installed and set JAVA_HOME to /usr/java/default

2) Install Apache Hadoop 0.20.204.

$ rpm -i hadoop-

3) Setup Apache Hadoop configuration and start Hadoop processes.

$ /usr/sbin/

The setup wizard will guide you through a list of questions to setup Hadoop. Hadoop should be running after answering ‘Y’ to all questions.

Create a user account on HDFS for yourself.

$ /usr/sbin/ -u $USER

B)  Multi-nodes Hadoop setup

1) Install both the JDK and Hadoop RPMs on all nodes

2) Generate hadoop configuration on all nodes:

$ /usr/sbin/ \
  --namenode-url=hdfs://${namenode}:9000/ \
  --jobtracker-url=${jobtracker}:9001 \
  --conf-dir=/etc/hadoop \
  --hdfs-dir=/var/lib/hadoop/hdfs \
  --namenode-dir=/var/lib/hadoop/hdfs/namenode \
  --mapred-dir=/var/lib/hadoop/mapred \
  --datanode-dir=/var/lib/hadoop/hdfs/data \
  --log-dir=/var/log/hadoop \

Where ${namenode} and ${jobtracker} should be replaced with hostname of namenode and jobtracker.

3) Format namenode and setup default HDFS layout.

$ /usr/sbin/

4) Start all data nodes.

$ /etc/init.d/hadoop-datanode start

5) Start job tracker node.

$ /etc/init.d/hadoop-jobtracker start

6) Start task tracker nodes.

$ /etc/init.d/hadoop-tasktracker start

7) Create a user account on HDFS for yourself.

$ /usr/sbin/ -u $USER

C)  Setup Environment for Hadoop

$ vi ~/.bash_profile

In INSERT mode set path for JAVA_HOME


Save file by clicking esc:wq

Run the .bash_profile

$ source ~/.bash_profile

Set JAVA_HOME path in Hadoop Environment file

$ /etc/hadoop/

D) Configuration for Hadoop

Use the following:







E) Hadoop Commands

$ hadoop
$ hadoop namenode –format (Format the namenode, If ask to
answer press ‘Y’)
$ hadoop namenode (Start the namenode)
$ find / -name (find the file in directory)
$ cd usr/sbin (Go to respective directory directly)

$ hadoop fs –ls / (Shows the HDFS root folder)
$ hadooop fs –put input/file01 /input/file01 (Copy local input/file01 to
HDFS root /input/file01)

Please follow and like us:
Tagged on:

Leave a Reply

Your email address will not be published. Required fields are marked *

× 8 = 64

============================================= ============================================== Buy TechAlpine Books on Amazon
============================================== ----------------------------------------------------------------

Enjoy this blog? Please spread the word :)

Follow by Email