Hadoop Installation Step by Step
Hadoop Installation Step by Step
Hadoop Installation Step by Step
Next, install JDK, the default Java Development Kit on Ubuntu version.
java –version
Output
Design and modified by Mr. Amitava Choudhury and Ms. Ambika Agarwal, Assistant Professor, UPES.
Ref. www.digitalocean.com
HADOOP INSTALLATION STEP BY STEP PROCESS ON LINUX (SINGLE NODE CLUSTER)
Or simple write the following command on terminal, On the server, we'll use wget to
fetch it:
wget http://apache.mirrors.tds.net/hadoop/common/hadoop-2.9.0/hadoop-
2.9.0.tar.gz
Note: The Apache website will direct you to the best mirror dynamically, so your URL may
not match the URL above.
Now that we've verified that the file wasn't corrupted or changed, we'll use the tar
command with the -xflag to extract, -z to uncompress, -v for verbose output, and -f to
specify that we're extracting from a file. Use tab-completion or substitute the correct
version number in the command below:
tar -xzvf hadoop-2.9.0.tar.gz
Finally, we'll move the extracted files into /usr/local, the appropriate place for locally
installed software. Change the version number, if needed, to match the version you
downloaded.
Output
/usr/lib/jvm/java-8-openjdk-amd64/jre/
You can copy this output to set Hadoop's Java home to this specific version, which
ensures that if the default Java changes, this value will not. Alternatively, you can use
the readlink command dynamically in the file so that Hadoop will automatically use
whatever Java version is set as the system default.
. . .
#export JAVA_HOME=${JAVA_HOME}
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/
/usr/local/hadoop/bin/hadoop
Output
or
Design and modified by Mr. Amitava Choudhury and Ms. Ambika Agarwal, Assistant Professor, UPES.
Ref. www.digitalocean.com
HADOOP INSTALLATION STEP BY STEP PROCESS ON LINUX (SINGLE NODE CLUSTER)
fs run a generic filesystem user client
The help means we've successfully configured Hadoop to run in stand-alone mode Check
Hadoop version. To ensure that Hadoop installed successfully need to check Hadoop
version.
/usr/local/hadoop/bin/hadoop version
Hadoop 2.9.0
Subversion https://[email protected]/repos/asf/hadoop.git
-r 18065c2b6806ed4aa6a3187d77cbe21bb3dba075
Design and modified by Mr. Amitava Choudhury and Ms. Ambika Agarwal, Assistant Professor, UPES.
Ref. www.digitalocean.com
HADOOP INSTALLATION STEP BY STEP PROCESS ON LINUX (SINGLE NODE CLUSTER)
This command was run using
/usr/local/hadoop/share/hadoop/common/hadoop-common-2.9.0.jar
We'll ensure that it is functioning properly by running the example MapReduce program
it ships with. To do so, create a directory called input in our home directory
mkdir ~/input
Create a text file (eg. Text.txt) inside input folder. Here our file name is text.txt and it
contains some textual information (Hi, his name is Himadri, his favorite place is Dehradun
which is located at Uttarakhand. This information will help you to search hi in all word
containing hi).
Now copy Hadoop's configuration files into input to use those files as our data.
cp /usr/local/hadoop/etc/hadoop/*.xml ~/input
Next, we can use the following command to run the MapReduce hadoop-mapreduce-
examples program, a Java archive with several options. We'll invoke its grep program,
one of many examples included in hadoop-mapreduce-examples, followed by the input
directory, input and the output directory grep_example. The MapReduce grep program
will count the matches of a literal word or regular expression. Finally, we'll supply a regular
expression to find occurrences of the word principal within or at the end of a
declarative sentence. The expression is case-sensitive, so we wouldn't find the word if it
were capitalized at the beginning of a sentence:
/usr/local/hadoop/bin/hadoop jar
/usr/local/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-
2.9.0.jar grep ~/input/text.txt ~/output 'hi[.]*'
When the task completes, it provides a summary of what has been processed and
errors it has encountered, but this doesn't contain the actual results.
Output
. . .
File System Counters
FILE: Number of bytes read=1184518
FILE: Number of bytes written=2348362
FILE: Number of read operations=0
FILE: Number of large read operations=0
FILE: Number of write operations=0
Map-Reduce Framework
Map input records=1
Map output records=1
Design and modified by Mr. Amitava Choudhury and Ms. Ambika Agarwal, Assistant Professor, UPES.
Ref. www.digitalocean.com
HADOOP INSTALLATION STEP BY STEP PROCESS ON LINUX (SINGLE NODE CLUSTER)
Map output bytes=11
Map output materialized bytes=19
Input split bytes=114
Combine input records=0
Combine output records=0
Reduce input groups=1
Reduce shuffle bytes=19
Reduce input records=1
Reduce output records=1
Spilled Records=2
Shuffled Maps =1
Failed Shuffles=0
Merged Map outputs=1
GC time elapsed (ms)=62
Total committed heap usage (bytes)=336732160
Note: If the output directory already exists, the program will fail, and rather than seeing the
summary, the ouput will look something like:
Output
. . .
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Results are stored in the output directory and can be checked by running cat on the
output directory:
cat ~/output/*
Output
7 hi
The MapReduce task found one occurrence of the word hi followed by a period and 7
times in the text file hi found. Running the example program has verified that our stand-
alone installation is working properly and that non-privileged users on the system can run
Hadoop for exploration or debugging.
Design and modified by Mr. Amitava Choudhury and Ms. Ambika Agarwal, Assistant Professor, UPES.
Ref. www.digitalocean.com