Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Cloud - Record MohanR

Download as pdf or txt
Download as pdf or txt
You are on page 1of 46

CS18712 – CLOUD COMPUTING AND VIRTUALIZATION TECHNIQUES

LABORATORY

EX.NO:
DATE:
DEVELOP A NEW WEB SERVICE FOR CALCULATOR

AIM:
To develop a new web service for a calculator using the SOAP Protocol.

PROCEDURE:
1. Open the NetBeans IDE 8.1
2. Click File New Project
3. Give the project name as calcwsapplication and click next.
4. In the new web application dialogue box, ensure that the glassfish v2 server and Java EE
5 are selected and click next and then finish.
5. Right-click calcwsapplication and select New → web service. Give the web service name
as calwebservice and the package name as a calculator and click Finish.
6. Expand the web service folder. Right-click calwebservice and click Add
Operation, Give the operation name as add and return type as int
7. Click the add button and give the parameter as a and the data type as int. Again Click the
add button and give the parameter name as b and its data type as b and Click OK.

Roll Number:090 Page No:


8. Instead of returning 0, change it to return a + b.

9. Similarly, add operations for subtraction (sub), multiplication (mul), and division (div).
10. Right Click calwsapplication and click clean and build. It will show BUILD
SUCCESSFUL.
11. Again right click calwsapplication and click deploy. It will show BUILD
Roll Number:090 Page No:
SUCCESSFUL.
12. Select calwsapplication → web services → calculators. Right-click and select Test
WebService.
13. Give the input values and click add button to check the output. Go back and click WSDL
to open it. Now the server is running.

WEB SERVICE TESTER PAGE:

OUTPUT:

INVOKING THE WEB SERVICE CLIENT:


Roll Number:090 Page No:
1. Click File -> New Project. Select a web application from the java web category
2. Give file name as calcwsclient. Click next and then finish.
3. Right Click calcwsclient and Select New -> web service client.

4. Select Project and click browse. Browse the web service that we did in the previous
step. Ensure that the client style is JAX- WS style.
5. Click Finish. Code will appear and it will show some error
6. Click on error. At end of the line add: xendorsed="true" and save it.

7. Right Click calcwsclient -> web pages and select new -> JSP
8. Give the file name as the client and click finish.
9. In client.jsp page, inside the body tag, remove the h1 tag and drag and drop the add
operation from web_service_references from calcwsclient
10. In the code that appeared, change the values.(For instance, a=5,b=13)
11. Right Click calcwsclient and click Clean and build.
12. Again Right click calcwsclient and click deploy. It will show BUILD SUCCESSFUL.
13. Right Client Client.jsp and click Run file

Roll Number:090 Page No:


14. It will show the output as follows:

15. Similarly, create the jsp files for subtraction, multiplication and division.

RESULT:
Thus, the calculator is implemented as a web service using a SOAP Protocol.

Roll Number:090 Page No:


CS18712 – CLOUD COMPUTING AND VIRTUALIZATION TECHNIQUES
LABORATORY

EX.NO:
DATE:
DEVELOP A CLOUD ENVIRONMENT USING CLOUDSIM SIMULATOR

AIM:
To install CloudSim and to implement the java code to create cloudlets and execute
the cloudlets in data centres.

PROCEDURE:

1. Open the eclipse tool using the path


E:\cloud grid\eclipseSDK-4.2.2win32x86_64\eclipse\eclipse.exe
2. Click on File Menu → New → Java Project.

3. Give the name of the project (for instance, cloud1) and click on Next Button.

Roll Number:090 Page No:


4. Click Finish Button
5. Right Click on the project in the project explorer and click Import
6. Select General → File System and click Next
7. Click Browse and browse the CloudSim-3.0.3 folder and Select the folder.
8. Click OK
9. Then Select the CloudSim folder.

10. Click Finish Button

Roll Number:090 Page No:


11. Click yes to All to import
12. Right Click the project in the project explorer and click properties
13. Click on Java Build Path and then the libraries tab.

14. Remove the Error showing Jar files


15. Click on Add External Jars
16. Browse and Select all the jar files within the CloudSim folder → jars
17. Again Click on Add External Jars to include common math jars
18. It will show an Error. Click on the Source tab and followed by Browse button
19. Click on Create New Folder
20. Give folder name (for instance, output)
21. Click OK and again click OK
22. Expand the project and Navigate into cloud1 → examples →
org.cloudbus.cloudSim.examples → CloudSimExample1.java
23. Open the source code by double-clicking the CloudSim Example.

Roll Number:090 Page No:


OUTPUT:
Starting CloudSimExample3... Initializing...
Starting CloudSim version 3.0 Datacenter_0 is starting...
The broker is starting...
Entities started.
: Broker: Cloud Resource List received with 1 resource(s)
: Broker: Trying to Create VM #0 in Datacenter_00.0: Broker: Trying to Create VM #1
inDatacenter_0
: Broker: VM #0 has been created in Datacenter #2, Host #0
: Broker: VM #1 has been created in Datacenter #2, Host #1
0.1: Broker: Sending cloudlet 0 to VM #0
0.1: Broker: Sending cloudlet 1 to VM #1
80.1: Broker: Cloudlet 1 received
160.1: Broker: Cloudlet 0 received
160.1: Broker: All Cloudlets executed. Finishing... 160.1: Broker: Destroying VM #0
160.1: Broker: Destroying VM #1Broker is shutting down...
Simulation: No more future events
CloudInformationService: Notify all CloudSim entities for shutting down. Datacenter_0 is
shutting down...
Broker is shutting down... Simulation completed.
Simulation completed.
========== OUTPUT ==========
Cloudlet IDSTATUS Data center ID
1 SUCCESS 2 1 80
0 SUCCESS 2 0 160 VM ID Time0.1 0.1
Start Time Finish Time 80.1 160.1 CloudSimExample3 finished!

RESULT:
Thus, cloud is simulated in CloudSim Environment and the program is executed.

Roll Number:090 Page No:


CS18712 – CLOUD COMPUTING AND VIRTUALIZATION TECHNIQUES
LABORATORY

EX.NO:
DATE:
PROCEDURE TO RUN A VIRTUAL MACHINE WITH DIFFERENT
CONFIGURATIONS AND TO CHECK HOW MANY VIRTUAL MACHINES CAN
BE UTILIZED AT A PARTICULAR TIME

AIM:
Use Eucalyptus to demonstrate the following and Find the procedure to run the virtual
machine of different configurations. Check how many virtual machines can be utilized at a
particular time.

PROCEDURE:

STEP 1:
• Install the virtual machine (VMWare workstation 12) Click to create the new virtual
machine.
• A new virtual machine wizard dialogue box appears, check the installer disk image file
(iso).
• Browse the faststat1.3.4.2.iso file from the path E:\Cloud Grid\ faststat1.3.4.2.iso.
• Click next

STEP 2:
• Select the LINUX operating system.
• Version: CENTOS 64-bit
• Click next

Roll Number:090 Page No:


STEP 3:
• Create a virtual machine name as the cloud(any name). Browse the location for the
virtual machine E:\cloudgrid To make the folder, click browse and select E:

• Click make a new folder


• Give the name of the folder

STEP 4:
• Set maximum disk size as 40 GB.
• Select the “Store virtual disk as single file” option.
• Click next

Roll Number:090 Page No:


STEP 5:
• Select the “customize hardware option”.
• Select Memory as 4GB.
• Select the number of processors as 2 and select the two options "Virtualize Intel"
and "Virtualize CPU".

Roll Number:090 Page No:


STEP 6:
Click "Finish" on the next Screen.

STEP 7:
Click on "Skip" on the screen which asks for a media test.

Roll Number:090 Page No:


STEP 8:
Click on "Install CentOS 6 with Eucalyptus Cloud-in-a-box".

STEP 9:
Click on "Skip" on the screen which asks for a media test.

STEP 10:
• Click On "Next" in the previous screens till you arrive at a Storage Device Warning.
• Click on "Yes, Discard any data".

STEP 11:
• Select hostname as "root".
• Select Network Interface as "eth0" and mode as "Static".
• Enter the IP Address as "192.168.12.201" and Netmask "255.255.255.0".
• Enter Default Gateway as "192.168.12.1" and DNS as "8.8.8.8".
• Click Next.
• Select the city as "Kolkata/Asia".
• Click Next.

Roll Number:090 Page No:


STEP 12:
• Enter your root password:123456 and click Next.
• Click on "Use Anyway".

Roll Number:090 Page No:


STEP 13:
• Enter the Public IP range as "192.168.12.202-192.168.12.210".
• Click on Next

STEP 14:
Select Replace Existing Linux Systems and click on Next.

STEP 15:
• Click on Write Changes to Disk.
• Wait for the installation to complete

STEP 16:
Roll Number:090 Page No:
• Click on Reboot.
• Wait for CentOS to boot up.

STEP 17:
Click on Forward.

STEP 18:
• Type your Username: user, FullName: user, Password: user and Confirm Password:
user.
• Click on Forward when you are done.
• Select "Yes" if the dialogue box appears.
• Click Forward and Finish when the Configuration Complete Window appears.

STEP 19:
• Enter your password and Login into the system.
• User name: user Password: user

STEP 20:
• Open Firefox and go to the URL - "192.168.12.201:8888" ( Or) click the eucalyptus
user console
• Click on "I Understand the Risks" and then click on "Add Exception".
• Click on "Confirm Security Exception".

STEP 21:
• Log into the Eucalyptus
• Account name: demo, username: admin, password: 123456
• Click on "Launch new Instance"

Roll Number:090 Page No:


STEP 22:
Select the Image to be used.

STEP 23:
Select the "Select Type".

Roll Number:090 Page No:


STEP 24:
Select the "Select Security".

Roll Number:090 Page No:


STEP 25:
• Select the "Create new key pair".
• Give a name for your key pair and click on create and download and then on "Save .pem
File" on the window that appears.

STEP 26:
• Select "Create new Security Group".
• Enter name as svce and description as "Hello".
• Select Rules Tab and create a rule for the SSH protocol
• Enter IP address as "192.168.12.202/32" (or)click use my IP and click on "Create
Group".

STEP 27:
Click on Launch Instance and wait for the instance for launching.

Roll Number:090 Page No:


STEP 28:
• Open a new Terminal.
• Type the following
cd Downloads
ls (This list all the files from the downloads)
chmod 400 svce.pem
ssh -I svce.pem cloud-user@192.168.12.202
lsblk

RESULT:
Thus the Eucalyptus is installed and used to run the virtual machine of different
configurations and instance creation has been executed successfully.
Roll Number:090 Page No:
CS18712 – CLOUD COMPUTING AND VIRTUALIZATION TECHNIQUES
LABORATORY

EX.NO:
DATE:
PROCEDURE TO ATTACH A VIRTUAL BLOCK TO THE VIRTUAL MACHINE
AND CHECK WHETHER IT HOLDS DATA EVEN AFTER THE RELEASE OF
THE VIRTUAL MACHINE

AIM:
To attach a virtual block to the virtual machine and check whether it holds the data
even after the release of the virtual machine.

PROCEDURE:

STEP 1:
• Create the virtual machine installed with centos.
• Create an instance (follow the previous exercise step).

STEP 2:
• Click Storage and select volume.
• Click create a new volume.

STEP 3:
• Create a new volume dialogue box will appear
• Click General tab
• Enter name: any name
• Create from snapshot: none
• Volume size : 1GB
• Availability zone: cluster 01
• Click create volume

Roll Number:090 Page No:


STEP 4:
• After a volume is created successfully click more actions button
• Select attach to instance from the drop-down menu.
• Attach the volume to the instance dialogue box will appear.

• Ensure value is Entered for a volume name, Instance(select from the dropdown the
instance which was created), attach as volume (/dev/sda).
• Click attach.

STEP 5:
Ensure the status is “in use”.

Roll Number:090 Page No:


STEP 6:
1. open terminal
2. Type the following
cd Downloads
ls
chmod 400 svce.pem
ssh -I svce.pem cloud-user@192.168.12.202
lsblk

RESULT:
Thus the volume has been successfully attached to the instance created and verified
whether it holds the data even after the release of the virtual machine.

Roll Number:090 Page No:


CS18712 – CLOUD COMPUTING AND VIRTUALIZATION TECHNIQUES
LABORATORY

EX.NO:
DATE:
USE EUCALYPTUS AND CREATE AN IMAGE AND EXECUTE THE INSTANCE
WITH A STORAGE CONTROLLER AND INTERACT WITH IT

AIM:
To create a virtual image execute the instance with a storage controller and interact with
it.

PROCEDURE:
STEP 1:
• Open new terminal
• Type the following

Creating the kernel image:

source credentials/admin/eucarc
euca-bundle-image –i ~/Desktop/Eucaimage/ vmlinuz-2.6.32 642.3.1.el6.x86_64 -r x86_64
--kernel true
After this step the following will be created /var/tmp/bundle-hfWXvk/vmlinuz-2.6.32-
642.3.1.el6.x86_64.manifest.xml

euca-upload-bundle -b kerimg -m /var/tmp/bundle-hfWXvk/ vmlinuz-


2.6.32642.3.1.el6.x86_64.manifest.xml
(Note: kerimg is the user defined name/var/tmp/bundle-hfWXvk/ vmlinuz-2.6.32-
642.3.1.el6.x86_64.manifest.xml which is created under the bundle step (i.e)2)
After this step the following wil be created/vmlinuz-2.6.32- 642.3.1.el6.x86_64.manifest.xml)

euca-register kerimg/vmlinuz-2.6.32-642.3.1.el6.x86_64.manifest.xml -a x86_64 -n


gcckernel
(Note: /vmlinuz-2.6.32-642.3.1.el6.x86_64.manifest.xml which is created under upload
step (i.e) 3. Gcckernel is also user defined name.The two user defined names should not be
same)

EKI image will be created eki-6SD039D3(refer the screen shot)


Screenshot for creating kernel image(eki image)

Roll Number:090 Page No:


STEP 2: Creating the RAM image:
Type the following in the same terminal

euca-bundle-image -i ~/Desktop/Eucaimage/initramfs2.6.32 642.3 .1.el6. x86_64.img -r


x86_64 -- ramdisk true
After this step the following will be created /var/tmp/bundle-PnF6Y4/initramfs-
2.6.32642.3.1.el6.x86_64.img.manifest.xml

euca-upload-bundle -b ramimg/var/tmp/bundle-PnF6Y4/initramfs- 2.6.32642.3.1.


el6.x86_64.img.manifest.xml
(Note: ramimg is the user defined name /var/tmp/bundle-PnF6Y4/initramfs-2.6.32-
642.3.1.el6.x86_64.img.manifest.xml which is created under the bundle step (i.e) After this
step the following wil be createdramimg/initramfs- 2.6.32-
42.3.1.el6.x86_64.img.manifest.xml)

euca-register ramimg/initramfs-2.6.32-642.3.1.el6.x86_64.img.manifest.xml -n gccram -a


x86_64
(Note: /initramfs-2.6.32-642.3.1.el6.x86_64.img.manifest.xml which is created under
upload step (i.e) 2.gccram is also user defined name. The two user defined names should not
be same)

ERI image will be created eri-67F9346B3(refer the screen shot)


Screenshot for creating RAM image(eri image)

Roll Number:090 Page No:


STEP 3:
Creating the MANIFEST image:
euca-bundle-image-i ~/Desktop/Eucaimage/root1.img -r x86_64 --kernel eki 6SD039D3 -
-ramdisk eri-67F9346B3
After this step the following will be created /var/tmp/bundle
Z61gwm/root1.img.manifest.xml

euca-upload-bundle-b rootimg -m /var/tmp/bundle-Z61gwm /root1.img.manifest.xml


(Note: rootimg is the user defined name /var/tmp/bundle-Z61gwm
/root1.img.manifest.xml which is created under the bundle step (i.e) After this step the
following wil be created rootimg/root1.img.manifest.xml)

euca-register rootimg/root1.img.manifest.xml -n gccroot -a x86_64


(Note:rootimg/root1.img.manifest.xml which is created under upload step (i.e) 2.
gccroot is also user defined name. The two user defined names should not be same)

EMI image will be created emi-3E633FB3(refer the screen shot)


Screenshot for creating MANIFEST image(emi image)

STEP 4:
1. This EMI image can be accessed only by the ADMIN.
2. This access privilege can be extended to all user by the following steps.
3. euca-modify-image-attribute -l –a all emi- 3E633FB3 (launch permission will be given
to all groups)
4. euca-modify-image-attribute - -description GCC emi-3E633FB3 (description name is
assigned to emi image. GCC is user defined name Refer the screenshot)

Roll Number:090 Page No:


STEP 5:
1. Open browser and type: https://192.168.12.201:8888 (or) click the eucalyptus user
console directly.
2. Click Create new instance
3. You will find two image centos6 demo(already existed image) and gccroot( created
image)
4. For creating an instance follow the procedure of eucalyptus instance creation,instead of
selecting centos 6 demo select gccroot

STEP 6:
1. Give instance name, instance size.
2. Next select security type where you will click.
3. create new pair(create and download it)
4. create new security group(create group and assign rules to it) 7 Click launch
instance.
5. Instance will be created.

Roll Number:090 Page No:


STEP 7:
1. Open terminal
2. Type the following
ping 192.168.12.202 (check whether public address is establish connection)
chmod 400 root.pem (changing the permission of pem file which is created
when instance launched)
ssh -i root.pem centos@192.168.12.202
su -
Password: centos
(It changes from user to root)

Roll Number:090 Page No:


RESULT :
Thus an image is created and the instance is executed with a storage controller and
interact with it

Roll Number:090 Page No:


CS18712 – CLOUD COMPUTING AND VIRTUALIZATION TECHNIQUES
LABORATORY

EX.NO:
DATE:
INSTALL A C COMPILER IN THE VIRTUAL MACHINE AND EXECUTE A
SAMPLE PROGRAM

AIM:
To install a C compiler in the virtual machine and execute a sample program

PROCEDURE:

Step 1: Installation of GCC compiler


1. yum install gcc
(GCC will be installed from the local repository. After completion of gcc
compiler,ready to run the C program)

2. To run the C program


Open the terminal
Execute the c program
• vi filename.c (for opening the program)
• Press esc:wq (saving the program
• cc filename.c (for compiling the program)
• ./a.out (to see the output)

OUTPUT:

Roll Number:090 Page No:


RESULT:
Thus the image(gcc) has been created and the C program has been compiled
successfully.

Roll Number:090 Page No:


CS18712 – CLOUD COMPUTING AND VIRTUALIZATION TECHNIQUES
LABORATORY

EX.NO:
DATE:
FIND PROCEDURE TO SET UP THE ONE NODE HADOOP CLUSTER

AIM:
To find the procedure to set up the one-node Hadoop cluster.

PROCEDURE:
STEP 1:
This software should be prepared to install Hadoop 2.8.0 on window 10 64bit
• Download Hadoop 2.8.0
(Link: http://wwweu.apache.org/dist/Hadoop/common/Hadoop-2.8.0/Hadoop-2.8.0.tar.gz
OR
http://archive.apache.org/dist/Hadoop/core//Hadoop-2.8.0/Hadoop- 2.8.0.tar.gz)
• Java JDK 1.8.0.zip
(Link: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-
2133151.html)

STEP 2:
• Check whether Java 1.8.0 is already installed on your system or not, use "Javac -
version" to check. java version
• If Java is not installed on your system then first install java under "C:\JAVA" Java setup
Extract file Hadoop 2.8.0.tar.gz or Hadoop-2.8.0.zip and place under "C:\Hadoop-
2.8.0"

Roll Number:090 Page No:


• Set the path HADOOP_HOME Environment variable on windows 10(see Steps 1,2,3
and 4 below).

• Set the path JAVA_HOME Environment variable on windows 10(see Steps 1,2,3 and
4 below).

• Next, we set the Hadoop bin directory path and the JAVA bin directory path.

Roll Number:090 Page No:


STEP 3: Configuration
Edit file C:/Hadoop-2.8.0/etc/Hadoop/core-site.XML, paste the below XML
paragraph and save this file.

<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
Rename "mapred-site.XML.template" to "mapred-site.XML" and edit this file C:/Hadoop-
2.8.0/etc/Hadoop/mapred-site.XML, paste the below XML paragraph and save this file.

<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>

• Create folder "data" under "C:\Hadoop-2.8.0"


Roll Number:090 Page No:
• Create folder "datanode" under "C:\Hadoop-2.8.0\data"
• Create folder "namenode" under "C:\Hadoop-2.8.0\data"

Edit file C:\Hadoop-2.8.0/etc/Hadoop/hdfs-site.XML, paste the below XML


paragraph and save this file.

<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>/Hadoop-2.8.0/data/namenode</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>/Hadoop-2.8.0/data/datanode</value>
</property>
</configuration>

Edit file C:/Hadoop-2.8.0/etc/Hadoop/yarn-site.XML, paste the below XML


paragraph and save this file.

<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.auxservices.mapreduce.shuffle.class</name>
<value>org.apache.Hadoop.mapred.ShuffleHandler</value>
</property>
</configuration>
Edit file C:/Hadoop-2.8.0/etc/Hadoop/Hadoop-env.cmd by closing the command
Roll Number:090 Page No:
line "JAVA_HOME=%JAVA_HOME%" instead of set "JAVA_HOME=C:\Java"
(On C:\java this is a path to file jdk.18.0)

STEP 4: Hadoop Configuration


• Download file Hadoop Configuration.zip
• (Link: https://github.com/MuhammadBilalYar/HADOOP-INSTALLATION-ON-
WINDOW-10/blob/master/Hadoop%20Configuration.zip)
• Delete the file bin on C:\Hadoop-2.8.0\bin, and replaced it with a file bin on the file just
download (from Hadoop Configuration.zip).
• Open cmd and type the command "hdfs namenode –format". You will see

STEP 5: Testing
• Open cmd and change directory to "C:\Hadoop-2.8.0\sbin".
• Type "start- all.cmd" to start apache.

1. Make sure these apps are running

Roll Number:090 Page No:


1. Hadoop Namenode
2. Hadoop data node
3. YARN Resource Manager
4. YARN Node Manager

Open: http://localhost:8088

Open: http://localhost:50070

Roll Number:090 Page No:


RESULT:
Thus, the one-node Hadoop cluster has been set up successfully.

Roll Number:090 Page No:


CS18712 – CLOUD COMPUTING AND VIRTUALIZATION TECHNIQUES
LABORATORY

EX.NO:
DATE:
WRITE A PROGRAM TO USE THE API’S OF HADOOP TO INTERACT WITH IT

AIM:
To write a program to use the API's oh hadoop to interact with it

PROCEDURE:

STEP 1: Prepare
• Download Input_file.txt
(Link: https://github.com/MuhammadBilalYar/HADOOP- INSTALLATION-ON-
WINDOW-10/blob/master/input_file.txt)
• Place both files in "C:/"

STEP 2: Hadoop Operation


1. Open cmd in Administrative mode and move to "C:/Hadoop-2.8.0/sbin" and start cluster
start-all.cmd

2. Create an input directory in HDFS.


hadoop fs -mkdir /input_dir
Roll Number:090 Page No:
3. Copy the input text file named input_file.txt in the input directory (input_dir) of HDFS.
hadoop fs -put C:/input_file.txt /input_dir
4. Verify input_file.txt available in HDFS input directory (input_dir).
hadoop fs -ls /input_dir/
5. Verify content of the copied file.
hadoop dfs -cat /input_dir/input_file.txt

RESULT:
Thus the program to use the apis of hadoop to interact with it are executed successfully

Roll Number:090 Page No:


CS18712 – CLOUD COMPUTING AND VIRTUALIZATION TECHNIQUES
LABORATORY

EX.NO:
DATE:
WRITE A WORDCOUNT PROGRAM TO DEMONSTRATE THE USE OF MAP
AND REDUCE TASKS

AIM:
To write a program to use the API's of Hadoop to interact with it and write a wordcount
program to demonstrate the use of map and reduce task.

PROCEDURE:
STEP 1: Prepare
1. Download MapReduceClient.jar
(Link: https://github.com/MuhammadBilalYar/HADOOP-INSTALLATION-ON-
WINDOW10/blob/master/MapReduceClient.jar)
2. Download Input_file.txt
(Link: https://github.com/MuhammadBilalYar/HADOOPINSTALLATION-ON-
WINDOW-10/blob/master/input_file.txt)
3. Place both files in "C:/"

STEP 2: Hadoop Operation


Open cmd in Administrative mode and move to "C:/Hadoop-2.8.0/sbin" and start
cluster by "start-all.cmd"

Roll Number:090 Page No:


1. Create an input directory in HDFS. hadoop fs -mkdir /input_dir
2. Copy the input text file named input_file.txt in the input directory (input_dir) of
HDFS.
hadoop fs -put C:/input_file.txt /input_dir
3. Verify input_file.txt available in HDFS input directory (input_dir).
hadoop s -ls /input_dir/
4. Verify content of the copied file.
hadoop dfs -cat /input_dir/input_file.txt
5. Run MapReduceClient.jar and also provide input and out directories.
hadoop jar C:/MapReduceClient.jar wordcount /input_dir /output_dir

6. Verify content for generated output file.


hadoop dfs -cat /output_dir/*

RESULT:
Thus the map and reduce tasks to implement word count in hadoop is executed

Roll Number:090 Page No:


successfully.

CS18712 – CLOUD COMPUTING AND VIRTUALIZATION TECHNIQUES


LABORATORY

EX.NO:
DATE:
WRITE A GREP PROGRAM TO DEMONSTRATE THE USE OF MAP AND
REDUCE TASKS

AIM:
To write a program to use the API's of Hadoop to interact with it and write a grep
program to demonstrate the use of map and reduce task.

PROCEDURE:
STEP 1: Prepare
1. Download MapReduceClient.jar
(Link: https://github.com/MuhammadBilalYar/HADOOP-INSTALLATION-ON-
WINDOW10/blob/master/MapReduceClient.jar)
2. Download Input_file.txt
(Link: https://github.com/MuhammadBilalYar/HADOOPINSTALLATION-ON-
WINDOW-10/blob/master/input_file.txt)
3. Place both files in "C:/"

STEP 2: Hadoop Operation


Open cmd in Administrative mode and move to "C:/Hadoop-2.8.0/sbin" and start
cluster by "start-all.cmd"

Roll Number:090 Page No:


1. Create an input directory in HDFS. hadoop fs -mkdir /input_dir
2. Copy the input text file named input_file.txt in the input directory (input_dir) of
HDFS.
hadoop fs -put C:/input_file.txt /input_dir
3. Verify input_file.txt available in HDFS input directory (input_dir).
hadoop s -ls /input_dir/
4. Verify content of the copied file.
hadoop dfs -cat /input_dir/input_file.txt
5. Run MapReduceClient.jar and also provide input and out directories.
hadoop jar C:/MapReduceClient.jar grep /input_dir /output_dir

6. Verify content for generated output file.

Roll Number:090 Page No:


hadoop dfs -cat /output_dir/*

RESULT:
Thus the map and reduce tasks to implement grep in hadoop is executed successfully.

Roll Number:090 Page No:

You might also like