You are on page 1of 14

EXERCISE

1. Single Node Cluster


- Installing Java 8 JDK

- Run this command: java -version to mare sure Java has been installed
and javac -version to make sure javac is running properly

- Setting JAVA_HOME variable


- Get java path:
- Edit /etc/environment and add this line to the file:

- Run echo $JAVA_HOME to make sure the variable was added


successfully:

- Installing SSH
- Generate public/private rsa key pair:

- Make the generated public key authorized by running:

- Check SSH work:


- Getting hadoop
- Select 3.2.2 and download it

- Unpack the hadoop package:


- Unpacking…

- This is Hadoop folder:


- Configuring hadoop
- Edit “.bashrc” file:

- Append these lines to the file:


- Edit “hadoop-env.sh” file:

- Append this line:


- Make 2 new directories inside hdfs “namenode” and “datanode”
- And edit “hdfs-site.xml” file:

- Append these lines:


- Edit “core-site.xml” file

- Append these lines:


- We must format hadoop file system:

- Finally, starting hadoop:


2. Word Count on Hadoop MapReduce:
- Make sure Hadoop is installed and running and javac is running correctly:

- This is WordCount.java file:


- Add data to text file:

- Now, set HADOOP_CLASSPATH environment variable and make sure


it has been set correctly:
- Create a directory on HDFS and create a directory inside it for the input
- Upload the input file to that directory:

- Compile the java code and the files

- Put the output files in one jar file and I have the .jar file:

- Now, run the jar file on Hadoop:


- Finally, this is output:

--- HẾT ---

You might also like