Cloud Record

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 68

NAME:

----------------------------------------------------------------------------------------------------------

REGISTER NO:
-----------------------------------------------------------------------------------------------------------

LAB: Cloud Computing Laboratory


-----------------------------------------------------------------------------------------------------------

BRANCH/SEM: CSE / 7th Semester


B.E - IV YEAR

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

This is a Certified Bonafide Record Work of


Register No. Submitted for the Anna University Practical Examination held
on _____________in CS8711 Cloud Computing Laboratory during the year 2021-2022

Signature of the HOD Signature of the Lab-In-Charge

Date: Internal Examiner:

External Examiner: _
REG.NO:

Vision of Institution

To build Jeppiaar Engineering College as an Institution of Academic Excellence in Technical


education and Management education and to become a World Class University.

Mission of Institution

M1 To excel in teaching and learning, research and innovation by promoting


the principles of scientific analysis and creative thinking

M2 To participate in the production, development and dissemination of


knowledge and interact with national and international communities

M3 To equip students with values, ethics and life skills needed to enrich their
lives and enable them to meaningfully contribute to the progress of society

M4 To prepare students for higher studies and lifelong learning, enrich them
with the practical and entrepreneurial skills necessary to excel as future
professionals and contribute to Nation’s economy

Program Outcomes (POs)


Engineering knowledge: Apply the knowledge of mathematics, science,
PO1 engineering fundamentals, and an engineering specialization to the
solution of complex engineering problems.
Problem analysis: Identify, formulate, review research literature, and
analyze complex engineering problems reaching substantiated conclusions
PO2
using first principles of mathematics, natural sciences, and engineering
sciences.
Design/development of solutions: Design solutions for complex
PO3 engineering problems and design system components or processes that
meet the specified needs with appropriate consideration for the public
REG.NO:

health and safety, and the cultural, societal, and environmental


considerations
Conduct investigations of complex problems: Use research-based
knowledge and research methods including design of experiments,
PO4
analysis and interpretation of data, and synthesis of the information to
provide valid conclusions.
Modern tool usage: Create, select, and apply appropriate techniques,
resources, and modern engineering and IT tools including prediction and
PO5
modeling to complex engineering activities with an understanding of the
limitations.
The engineer and society: Apply reasoning informed by the contextual
knowledge to assess societal, health, safety, legal and cultural issues and
PO6
the consequent responsibilities relevant to the professional engineering
practice.
Environment and sustainability: Understand the impact of the
PO7 professional engineering solutions in societal and environmental contexts,
and demonstrate the knowledge of, and need for sustainable development.
Ethics: Apply ethical principles and commit to professional ethics and
PO8
responsibilities and norms of the engineering practice.
Individual and team work: Function effectively as an individual, and as
PO9
a member or leader in diverse teams, and in multidisciplinary settings.
Communication: Communicate effectively on complex engineering
activities with the engineering community and with society at large, such
PO10 as, being able to comprehend and write effective reports and design
documentation, make effective presentations, and give and receive clear
instructions.
REG.NO:

Project management and finance: Demonstrate knowledge and


understanding of the engineering and management principles and apply
PO11
these to one’s own work, as a member and leader in a team, to manage
projects and in multidisciplinary environments.
Life-long learning: Recognize the need for, and have the preparation and
PO12 ability to engage in independent and life-long learning in the broadest
context of technological change.

Vision of Department

To emerge as a globally prominent department, developing ethical computer professionals,


innovators and entrepreneurs with academic excellence through quality education and research.

Mission of Department

M1 To create computer professionals with an ability to identify and


formulate the engineering problems and also to provide innovative
solutions through effective teaching learning process.

M2 To strengthen the core-competence in computer science and


engineering and to create an ability to interact effectively with
industries.

M3 To produce engineers with good professional skills, ethical values and


life skills for the betterment of the society.

M4 To encourage students towards continuous and higher level learning on


technological advancements and provide a platform for employment and
E
5|Pag self-employment.
REG.NO:
REG.NO:

Program Educational Objectives (PEOs)


PEO1 To address the real time complex engineering problems using innovative
approach with strong core computing skills.
PEO2 To apply core-analytical knowledge and appropriate techniques and provide
solutions to real time challenges of national and global society
PEO3 Apply ethical knowledge for professional excellence and leadership for the
betterment of the society.
PEO4 Develop life-long learning skills needed for better employment and
entrepreneurship

Program Specific Outcomes (PSOs)


Students will be able to

An ability to understand the core concepts of computer science and engineering


PSO1
and to enrich problem solving skills to analyze, design and implement software
and hardware based systems of varying complexity.
To interpret real-time problems with analytical skills and to arrive at cost
PSO2 effective and optimal solution using advanced tools and techniques.

An understanding of social awareness and professional ethics with practical

PSO3 proficiency in the broad area of programming concepts by lifelong learning to


inculcate employment and entrepreneurship skills.
Course Outcomes (COs)

C407.1 Develop Web Applications In Cloud


Learn how to simulate a cloud environment to implement new
C407.2
schedulers.
Design And Development Process Involved In Creating A Cloud
C407.3
Based Application
Install and use a generic cloud environment that can be used as a
C407.4
private cloud.
C407.5 Implement parallel programming using hadoop
Department of Computer Science and Engineering
EVALUATION GUIDELINES – PRACTICAL
COURSES
Internal Assessment maximum mark Awarded: 100
Distribution of Marks
Average
Course Course Model Total
marks of all Record
Assessment Participation Exam Marks
experiments
20 5+5+5 5 10 50 100

Distribution of Marks for every Experiment


1. Program (10)
2. Output (05) Total (20)
3. Viva (05)

Program & Output Marks Awarded (15)

Category Observation Marks


Successful Completion of the Program with Logic and Standard 15
Type 1
output with necessary indentation and comments
Execution with Erroneous output but still relevant to logic with 12
Type 2
necessary indentation and comments
Execution of the program with minor logic , no output and with 10
Type 3
poor indentation and comments
Type 4 Partially correct logic, with no output and inappropriate 08
indentation and comments
Type 5 Irrelevant logic with no output, indentation & comments 05

Viva Voce Marks Awarded (05)


 Oral Questions are asked by the faculty in-charge about the respective programs concept
& logic.
Course Assessment (5+5+5)
 The practical course programs are divided into 3 cycles, in every cycle a program is
treated to assess the performance of the student.
 Student should demonstrate the assessment with proficiency to complete the cycle. On
successful completion of the assessment, the student will be awarded with 5 points.
Similarly the assessment done for 3 cycles.

Course Participation (5)

Proficient (5) Adequate (3) Substandard (1) Unacceptable


(0)

Student demonstrates Student arrives Student coming Student was


concepts. Student is eager on time to lab, late to lab and absent from lab
to participate and assist but may be unprepared for or did not
when needed. unprepared. the lab. participate.
SYLLABUS

CS8711 CLOUD COMPUTING LABORATORY LTPC 0032

OBJECTIVES:

The student should be made to:

• Be exposed to tool kits for grid and cloud environment.


• Be familiar with developing web services/Applications in grid framework
• Learn to run virtual machines of different configuration.
• Learn to use Hadoop
LIST OF EXPERIMENTS:

Course Objective:

• To develop web applications in cloud

• To learn the design and development process involved in creating a cloud based application

• To learn to implement and use parallel programming using Hadoop

Exercises:
1. Install Virtualbox/VMware Workstation with different flavours of linux or
windows OS on top of windows7 or 8.
2. Install a C compiler in the virtual machine created using virtual box and execute
Simple Programs
3. Install Google App Engine. Create hello world app and other simple web applications using
python/java.
4. Use GAE launcher to launch the web applications.
5. Simulate a cloud scenario using CloudSim and run a scheduling algorithm that is not
present in CloudSim.
6. Find a procedure to transfer the files from one virtual machine to another virtual
machine.
7. Find a procedure to launch virtual machine using trystack (Online Openstack
Demo Version)
8. Install Hadoop single node cluster and run simple applications like wordcount.
Course Outcome:

On completion of this course, the students will be able to:

• Configure various virtualization tools such as Virtual Box, VMware workstation.

• Design and deploy a web application in a PaaS environment.

• Learn how to simulate a cloud environment to implement new schedulers.

• Install and use a generic cloud environment that can be used as a private cloud.

• Manipulate large data sets in a parallel environment.

TOTAL: 45 PERIODS
INDEX PAGE
MARKS
COUR SE PA
SIGN
COMPLE ASSESSMENT PARTI
S.NO DATE CYCLE TITLE GE
(5+5+5)
TION(20) CIP NO
ATION (5) .

1 Install Virtualbox/VMware
Workstation with different

flavours of linux or windows

OS on top

of windows7 or 8.
2
Install a C compiler in the
virtual machine created using

virtual box and execute Simple

1 Programs

3
Install Google App Engine.
Create hello world app and

other simple web applications

Using PYTHON AND JAVA


4
Use GAE launcher to launch
the web applications.
5 Simulate a cloud scenario
using CloudSim and run a
scheduling algorithm that is not

present in

CloudSim
6 Find a procedure to transfer the
files from one virtual machine
2
to another virtual machine

7 Find a procedure to launch


virtual machine using trystack

(Online Openstack Demo

Version)

8 Install Hadoop single node


cluster and run simple

applications like wordcount.

TOTAL MARKS ( / 40) /20 /15 /5

EX.NO:1 VIRTUALBOX/VMWARE WORKSTATION


INSTALLATION

AIM:

To install the VMware Workstation and to create and run virtual machine with
different flavours of Linux on top of Windows 10.

PROCEDURE:

InstallVirtualBox

1. Visit http://www.virtualbox.org/wiki/downloads
2. DownloadVirtualBox platform packages for your OS
3. Open the Installation Package by double clicking
4. Click continue and finish installingVirtualBox
P
C

Install Linux usingVirtual Box

1.RunVirtualBox by double-clicking the icon


2.Click new button on the top left corner.

3. Click“Continue” on the pop-up window


4. TypeVM name,select“Linux” for the OS and choose “Ubuntu” for the version.
5. Choose the amount of memory to allocate (I suggest choosing between 512 MB to 1024
MB)

6.Click Continue or Next

7.Choose create a new virtual hard disk

8.Click Continue or Next


9.ChooseVDI (VirtualBox Disk Image)
10.Click Continue or Next
11.Choose“DynamicallyAllocated” click continue.
Running Linux

1. Choose Ubuntu from left column and click Start

2.Click continue on pop-up window


3.Click the folder icon and choose the ubuntu iso file you downloaded and click continue
and start
4.Click Install Ubuntu

5.Check“Download updates” and click Forward.


6.Choose“Erase disk and install Ubuntu” and click Forward (Don’t worry,it won’t wipe your
computer)

7.Click“Install Now” and wait.


8.When finished,click Restart and press Enter.

OUTPUT:
RESULT:
Thus, the Ubuntu Virtual Machine has been successfully created using
VIRTUALBOX.

EX.NO: 2 INSTALL C COMPILER IN VIRTUAL


MACHINE AND EXECUTE PROGRAMS

AIM:

To install a C compiler in the virtual machine created using VMware workstation


and execute simple programs.

PROGRAM:

Sum of two numbers

#include<stdio.h> int main()


int a,b,c;

printf("Enter two nos:"); scanf("%d%d",&a,&b);


c=0;
c=a+b;
printf("Sum of two nos is: %d",c); return 0; }

PROCEDURE:
STEP 1: OPEN VIRTUAL MACHINE

Open the Ubuntu virtual machine.

STEP 2 : INSTALL C COMPILER

⚫ Right click and select Open Terminal .The terminal windows opens.
⚫ Type the following command to install the C Compiler: sudo apt-get install gcc
⚫ Type the password to allow the installation.

STEP 3: EXECUTE PROGRAM

Open the terminal and open the gedit editor using the command : gedit filename.c
Type the C program and save the file.
Compile the C program using the following command : gcc filename.c
Run the C program using the command : ./a.out
OUTPUT:

RESULT:

Thus, the C compiler has been successfully installed in the Virtual Machine and
the programs are executed and outputs are verified.
EX.NO: 3a INSTALL GOOGLE APP ENGINE AND CREATE SIMPLE
WEB APPLICATIONS USING PYTHON/JAVA.

AIM :

To install the Google app engine and using it to create a simple


hello world web application using python/java.

TOOLS REQUIRED :

 Windows operating system.


 Python 2.7.12.
 Browser such as Google chrome.

PROGRAM :
Test.py
import webapp2
class
MainPage(webapp2.RequestH
andler): def get(self):
self.response.write("Hello World")
app=webapp2.WSGIApplication([('/',MainPage),],deb
ug=True)

App.yaml
runtime:
python27
api_version: 1
threadsafe: true
handlers:
- url: /
script: test.app
PROCEDURE:

1. Install Python of any version and download cloud SDK for python.

2. Before installing cloud SDK installer, disable Antivirus in your system.

3. Install cloud SDK and set the path correctly.


4. After installation, Google cloud SDK shell will show up.

5. Open that terminal, the give a command : gcloud init


6. Then, we have to pick the configuration to use and choose your account.

7. After logged in, create a cloud project (or) use the project which was already

created.

8. If your creating a new project, then go to cloud.google.com.


9. Click on console => compute engine => create a project.

10. Your project will be created and again process from step 5 to step 7.

11. After choosing the project which you have created, type the command:

google-cloud-

sdk\bin\dev_appserver.py”C :\Users\CHRISTILLA\Desktop\test” (Path of

the python program file). In that python file, type “HelloWorld” program and

save it.
12. After setting the path, the components from version 316.0.0 will get installed.

13. After all these installations, open the any browser of your choice and type in

localhost : 8000
14. Then, in browser “Hello World” will be produced as output.

OUTPUT :

RESULT :

Thus, the execution of Hello World using cloud SDK and python has been
installed, executed and output was verified.
EX.NO: 3.b DEVELOP CELSIUS TO FAHRENHEIT WEB
APPLICATION USING PYTHON / JAVA

AIM:
To install the Google app engine and using it to develop Celsius to Fahrenheit
web application using python/java.

PROCEDURE:
1. First install python for executing the web application.
2. Download Google Cloud SDK and install it.
3. Click Next, Next and select the installation folder and click install.
4. Click Next and make sure all the checkbox is selected and click Finish.
5. After installing, Google Cloud SDK Shell is opened and gcloud is initailzed
by “gcloud init” command while finishing the setup automaticlly.
6. If we manually open the Google Cloud SDK Shell, we have to initialize
gcloud by “gcloud init” command.
7. Since I already logged in to my account, I only need to select the account for
the Google cloud. If you are using it for the first time it asks for login, login
with your Gmail account for authentication purpose.
8. So, in this process select Re-initialize this configuration [default] with new
settings.

9. After selecting Configuration process, it checks the Network Connection.

10. And it asks for Account selection for this configuration. Select your account if
you already logged in. If not select Log in with a new account.

11. Select cloud project to use. If there is no projects then create a new project by
using “gcloud projects create project name” command.

12. After selecting the project create a new folder called ‘test’ anywhere in the
computer. Create a Python file and yaml file inside this folder.
13. Create a text document and type the python code and save it as test1.py.

test1.py:

import webapp

def convert_temp(cel_temp):
''' convert Celsius temperature to Fahrenheit
temperature ''' if cel_temp == "":
return
"" try:
far_temp = float(cel_temp) * 9 / 5 + 32
far_temp = round(far_temp, 3) # round to three
decimal places return str(far_temp)
except ValueError: # user entered non-numeric
temperature return "invalid input"

class
MainPage(webapp2.RequestHandl
er): def get(self):
cel_temp =
self.request.get("cel_temp")
far_temp =
convert_temp(cel_temp)
self.response.headers["Content-Type"] =
"text/html" self.response.write("""
<html>
<head><title>Temperature Converter</title></head>
<body>
<form action="/" method="get">
Celsius temperature: <input type="text"
name="cel_temp" value={}>
<input type="submit"
value="Convert"><br>
Fahrenheit temperature: {}
</form>
</body>
</html>""".format(cel_temp,
far_temp)) routes = [('/',
MainPage)]
my_app = webapp2.WSGIApplication(routes, debug=True)
14. Create a text document and type the yaml file code and save it as app.yaml.
app.yaml:

runtime:
python27
api_version: 1
threadsafe: true

handlers:
- url: /
script: test1.my_app

15. After creating both .yaml and .py file, now we have to execute this python file
by running dev_appserver.py file in bin folder by using this command :google-
cloud-sdk\bin\dev_appserver.py “C:\Users\CHRISTILLA\Desktop\test"
16. Select ‘Y’ if you want to install the components. And automatically after installing
the components the python file is executed and hosted.

OUTPUT:

RESULT :

Thus, the execution of celsius to fahrenheit program using cloud SDK and
python has been executed and output was verified.
EX.NO : 4 GAE LAUNCHER TO LAUNCH THE WEB
APPLICATIONS

AIM :
To use GAE Launcher to launch the web applications.
PROCEDURE :

Step 1:
Download the original App Engine SDK for Python 2

Step 2 :
⚫ Install the AppEngine SDK .Make sure that python 2.7 is installed.
Click Next

⚫ Accept the terms and conditions for the installation. Click Next.
⚫ Choose the destination folder to install.Click Next.

⚫ Click Install to complete the installation process.


Step 3:

⚫ Open the Google App Engine Launcher.Click Create New


Application. In the pop-up window , enter the Application
name and choose the Parent directory.Click Create.
Step 4:
Click the application name and click Run icon.After
application runs, the symbol on left of application name becomes
green in colour.Note the Port number and type in the browser as :
localhost:portnumber
OUTPUT:

RESULT:

Thus execution of web application using GAE launcher is done.


EX.NO: 5 CLOUD SCENARIO USING CLOUDSIM

AIM :

To simulate a cloud scenario using Cloudsim and run a scheduling


algorithm using Cloudsim.

TOOLS REQUIRED :

 Windows OS.
 NetBeans.

PROCEDURE :

 Download all the cloudsim-3.0.3.zip modules and extract it.

 Install NetBeans of any version.

 Open NetBeans => create new project as Cloudsim => set file location to a

new folder and name it as cloudsim-3.0.

 Open cloudim-3.0, add jar file of cloudsim-3.0.3 to cloudim-3.0 folder.

 In cloudsim-3.0.3, open sources => org , copy this org and add it inside the

source of cloudsim-3.0.

 Now, jar file will be added inside the library of the project cloudsim.

 Also, download common-math-3.33 jar file and add it to the library to avoid

some errors.

 Run any example in NetBeans IDE.

 Display the output.

PROGRAM:

package org.cloudbus.cloudsim.examples;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList; import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; import
org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.DatacenterCharacteristics; import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Log; import org.cloudbus.cloudsim.Pe; import
org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.UtilizationModel; import
org.cloudbus.cloudsim.UtilizationModelFull; import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmAllocationPolicySimple; import
org.cloudbus.cloudsim.VmSchedulerSpaceShared; import
org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple; import
org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;
public class CloudSimExample5 {
private static List<Cloudlet> cloudletList1;
private static List<Cloudlet> cloudletList2;
private static List<Vm> vmlist1;
private static List<Vm> vmlist2;
public static void main(String[] args) {

Log.printLine("Starting CloudSimExample5...");

try {
int num_user = 2;
Calendar calendar = Calendar.getInstance();

boolean trace_flag = false;

CloudSim.init(num_user, calendar, trace_flag);

@SuppressWarnings("unused")
Datacenter datacenter0 = createDatacenter("Datacenter_0");
@SuppressWarnings("unused")
Datacenter datacenter1 = createDatacenter("Datacenter_1");
DatacenterBroker broker1 = createBroker(1);
int brokerId1 = broker1.getId();

DatacenterBroker broker2 = createBroker(2);


int brokerId2 = broker2.getId();

vmlist1 = new ArrayList<Vm>();


vmlist2 = new ArrayList<Vm>();

int vmid = 0;
int mips = 250;
long size = 10000;
int ram = 512;
long bw = 1000;
int pesNumber = 1;
String vmm = "Xen";

Vm vm1 = new Vm(vmid, brokerId1, mips, pesNumber, ram,


bw, size, vmm, new CloudletSchedulerTimeShared());

Vm vm2 = new Vm(vmid, brokerId2, mips, pesNumber, ram,


bw, size, vmm, new CloudletSchedulerTimeShared());

vmlist1.add(vm1);
vmlist2.add(vm2);

broker1.submitVmList(vmlist1);
broker2.submitVmList(vmlist2);

cloudletList1 = new ArrayList<Cloudlet>();


cloudletList2 = new ArrayList<Cloudlet>();

int id = 0;
long length = 40000;
long fileSize = 300;
long outputSize = 300;
UtilizationModel utilizationModel = new
UtilizationModelFull();

Cloudlet cloudlet1 = new Cloudlet(id, length, pesNumber,


fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet1.setUserId(brokerId1);

Cloudlet cloudlet2 = new Cloudlet(id, length, pesNumber,


fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet2.setUserId(brokerId2);

cloudletList1.add(cloudlet1);
cloudletList2.add(cloudlet2);

broker1.submitCloudletList(cloudletList1);
broker2.submitCloudletList(cloudletList2);

CloudSim.startSimulation();

List<Cloudlet> newList1 = broker1.getCloudletReceivedList();


List<Cloudlet> newList2 = broker2.getCloudletReceivedList();

CloudSim.stopSimulation();

Log.print("=============> User "+brokerId1+" ");


printCloudletList(newList1);

Log.print("=============> User "+brokerId2+" ");


printCloudletList(newList2);
Log.printLine("CloudSimExample5 finished!");
}
catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an
unexpected error");
}
}
private static Datacenter createDatacenter(String name){

List<Host> hostList = new ArrayList<Host>();


List<Pe> peList = new ArrayList<Pe>();
int mips=1000;
peList.add(new Pe(0, new PeProvisionerSimple(mips)));
int hostId=0;
int ram = 2048;
long storage = 1000000;
int bw = 10000;

hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList,
new VmSchedulerSpaceShared(peList)
)
);

String arch = "x86";


String os = "Linux";
String vmm = "Xen";
double time_zone = 10.0;
double cost = 3.0;
double costPerMem = 0.05;
double costPerStorage = 0.001;
double costPerBw = 0.0;
LinkedList<Storage> storageList = new LinkedList<Storage>();

DatacenterCharacteristics characteristics = new


DatacenterCharacteristics(
arch, os, vmm, hostList, time_zone, cost, costPerMem, costPerStorage,
costPerBw);

Datacenter datacenter = null;


try {
datacenter = new Datacenter(name, characteristics, new
VmAllocationPolicySimple(hostList), storageList, 0);
} catch (Exception e) {
e.printStackTrace();
}

return datacenter;
}
private static DatacenterBroker createBroker(int id){

DatacenterBroker broker = null;


try {
broker = new DatacenterBroker("Broker"+id);
} catch (Exception e) {
e.printStackTrace();
return null;

}
return broker;
}

private static void printCloudletList(List<Cloudlet> list) {


int size = list.size();
Cloudlet cloudlet;

String indent = " ";


Log.printLine();
Log.printLine("========== OUTPUT ==========");
Log.printLine("Cloudlet ID" + indent + "STATUS" + indent +
"Data center ID" + indent + "VM ID" + indent +
"Time" + indent + "Start Time" + indent + "Finish Time");
DecimalFormat dft = new DecimalFormat("###.##");
for (int i = 0; i < size; i++) {
cloudlet = list.get(i);
Log.print(indent + cloudlet.getCloudletId() + indent + indent);

if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS){
Log.print("SUCCESS");

Log.printLine( indent + indent +


cloudlet.getResourceId() + indent + indent + indent + cloudlet.getVmId() +
indent + indent +
dft.format(cloudlet.getActualCPUTime()) + indent + indent +
dft.format(cloudlet.getExecStartTime())+
indent + indent +
dft.format(cloudlet.getFinishTime()));
}
}
OUTPUT :

RESULT:

Thus, the simulation a cloud scenario and to run a scheduling algorithm is


written, executed and the output was verified.
EX.NO: 6 TRANSFER THE FILES FROM ONE VIRTUALMACHINE TO
ANOTHER VIRTUAL MACHINE

AIM:

To find a procedure to transfer a file between two independent Virtual machines using
Shared folder in VMware Workstation.

PRE-REQUISITES:

⚫ VMware Workstation
⚫ Two Ubuntu Virtual Machines,
⚫ Text file.

PROCEDURE I:

● Open the VMware workstation.

● Before turning on the virtual machines, create a shared folder in the host OS
● Choose the people whom you want to share with. Select as everyone.

● Configure the Shared folder settings.


⚫ Click the First Virtual machine and goto VM - > Settings. Goto Options and
choose Shared Folders and click Always Enabled.Add the folder which we want
to share.

● Check the shared folder is in virtual machine using the command:vmware-


hgfsclient.To mount the shared folder to desired location using command: sudo
mount -t fuse.vmhgfs-fuse .host:/ ~/Public/Share -o allow_other

● Now open the file chris.txt and edit it’s contents.


● Save the file and turn off the first virtual machine.

● Turn on the Second Virtual machine and check whether sharedfolders is shared and
mount the shared folder to Share folder
● Open the shared folder which you have seen in the previous Virtual machine. Open
the folder and open the text file.

● Finally you can see that the file has been transferred from one virtual machine
through another virtual machine by using the shared folder method.

PROCEDURE II:
1. Before starting your Guest
2. Go to VirtualBox Manager
3. Select your interested Guest
4. Go to Guest Settings
5. In Guest Settings, scroll the left side-menu, and go to Shared Folders

6. In Shared Folders, add your interested folder in the Host machine


7. After adding your Host folder path, you will see an updated Folders List in Shared Folders. Remember your
newly folder Nameshown in this list. Say it is HOST_SHARE.

8. Click OK and save your changes.

9. Start your Guest machine

10. In Guest machine, create a new folder, e.g.Guest_share


11. In Guest terminal, type

sudo mount -t vboxsf HOST_SHARE GUEST_SHARE`

If you see the error mount: wrong fs type, bad option, bad superblock on …, this means you first need to

install virtualbox-guest-utils. sudo apt-get install virtualbox-guest-utils

Then run the mount command again


13.just create a text file in the host machine then cut the file and paste in the host machine folder which you
shared to virtual box

14.You shall find your stuffs in this Guest_share folder.

OUTPUT:

RESULT:

Thus, the transfer of a file between two virtual machines was successfully
implemented using the shared folder procedure as well as the correctness has been
proved here successfully
EX.NO: 7 LAUNCH A VIRTUAL MACHINE USING
TRYSTACK(OPENSTACK)

AIM

To study about the Openstack and its dashboard and also the procedure to create
a virtual machine using Openstack Dashboard.

PROCEDURE

KVM INSTALLTION

Check that your CPU supports hardware virtualization

To run KVM, you need a processor that supports hardware virtualization. Intel and AMD both
have developed extensions for their processors, deemed respectively

Intel VT-x (code name Vanderpool) and AMD-V (code name Pacifica). To see if your processor
supports one of these, you can review the output from this command:

$ egrep -c '(vmx|svm)' /proc/cpuinfo

If 0 it means that your CPU doesn't support hardware virtualization.


If 1 (or more) it does - but you still need to make sure that virtualization is enabled in the BIOS.

Use a 64 bit kernel (if possible)


Running a 64 bit kernel on the host operating system is recommended but not required.
To serve more than 2GB of RAM for your VMs, you must use a 64-bit kernel, On a 32-bit kernel install,
you'll be limited to 2GB RAM at maximum for a given VM.

To see if your processor is 64-bit, you can run this command:

$ egrep -c ' lm ' /proc/cpuinfo

If 0 is printed, it means that your CPU is not 64-bit. If 1 or


higher, it is.

Now see if your running kernel is 64-bit, just issue the following command:
$ uname –m
x86_64 indicates a running 64-bit kernel. If you use see i386, i486, i586 or i686, you're running a
32-bit kernel.
$ ls /lib/modules/3.16.0-30- generic/kernel/arch/x86/kvm/kvm

kvm-amd.ko : AMD Processor kvm-


intel.ko : Intel Processor kvm.ko : Kernel
object
$ ls /dev/kvm
[Type text]
/dev/kvm

Install Necessary Packages


1. qemu-kvm
2. libvirt-bin
3. bridge-utils
4. virt-manager
5. qemu-system
$ sudo apt-get install qemu-kvm
$ sudo apt-get install libvirt-bin
$ sudo apt-get install bridge-utils
$ sudo apt-get install virt-manager
$ sudo apt-get install qemu-system

To check package installation Check


$ dpkg –l|grep qemu-kvm

$ virsh virsh# exit

Verify Installation
You can test if your install has been successful with the following command:

$ virsh -c qemu:///system list

Id Name State

If on the other hand you get something like this:


$ virsh -c qemu:///system list
libvir: Remote error : Permission denied error:
failed to connect to the hypervisor virsh # version
virsh # node info

Creating VMS
$ virt-install --connect qemu:///system -n hardy -r 512 -f hardy1.qcow2 -s 12 -c ubuntu-
14.04.2-server-amd64.iso --vnc --noautoconsole --os-type linux --os-variant ubuntuHardy

(or)

Open disk image Error


$ sudo chmod 777 hardy.gcow2
To run
$ virt-install --connect qemu:///system -n hardy -r 512 -f hardy1.qcow2 -s 12 -c ubuntu-
14.04.2-server-amd64.iso --vnc --noautoconsole --os-type linux --os-variant ubuntuHardy
$ sudo virt-manager

To Run Virtual Machine


[Type text]
To Login in Guest OS

TO RUN VM IN OPEN STACK

Step 1 : Under the Project Tab, Click Instances. In the right side screen Click Launch Instance.
Step 2 : In the details, Give the instance name(eg. Instance1).
Step 3: Click Instance Boot Source list and choose 'Boot from image' Step 4:
Click Image name list and choose the image currently uploaded. Step 5: Click
launch.
Your VM will get created.

OPEN STACK INSTALLATION

$ free –m - its shows the RAM Usage


$ sudo adduser stack - password: stack
$ sudo apt-get install sudo - for updating SU
$ sudo –I - entering into the root user
# echo "stack ALL=(ALL) NOPASSWD: ALL">> /etc/sudoers - it changes the stack from
normal users to super user
#cat /etc/sudoers -To check last line as - (stack ALL =(ALL)
NOPASSWORD:ALL)
#exit - logout from root user

log off your machine and login as stack user


[Type text]
Prerequiste- to install git open all the ports
$ sudo apt-get install git
$ git clone https:git.openstack.org/openstack-dev/devdstack
$ ls - devstack should there
$ cd devstack
$ ls - it shows all the files in devstack
$ls –l - longlisting the devstack files
$ nano local.conf - paste in local.conf [[local|
localrc]] FLOATING_RANGE=192.168.1.224/27
FIXED_RANGE=10.11.12.0/24
FIXED_NETWORK_SIZE=256
FLAT_INTERFACE=eth0
ADMIN_PASSWORD=root
DATABASE_PASSWORD=root
RABBIT_PASSWORD= root
SERVICE_PASSWORD= root
SERVICE_TOKEN= root save and quit
$ ls –l - should be stack stack
$ ./stack.sh - if error number 181 comes go to vi stack.sh add next to UMASK 022
FORCE=yes
$ pwd
/home/stack/devstack Devstack$ mv
local.conf ../
$ cd ..
Stack$ rm –rf devstack/ /opt/stack/
$ git clone https:git.openstack.org/openstack-dev/devdstack –b stable/kilo
$ cd devstack
$ ll
$ mv ../local.conf .
$ ls –l local.conf
$ ./stack.sh
$ nano stack.sh edit
#make sure unmask is sane Add
FORCE=yes save and exit
$ ./unstack.sh
$ ./clean.sh
Run DevStack:
$ ./stack.sh
Find User name, Password, IP address

[Type text]
In browser give your machines ip http://<ip Address>

Re-Starting Openstack
$ ./rejoin.sh
$ ps -ef|grep devstack it shows all the processes running End all
the processes.

RESULT:
Thus, the Openstack has been successfully studied with its installation in
Ubuntu as well as the launching of a new virtual machine in Openstack
Dashboard.

[Type text]
EX.NO: 8 INSTALL HADOOP SINGLE NODE
CLUSTER WITH IMPLEMENTATION OF
WORDCOUNT PROGRAM

AIM:
To install and run a Hadoop Single Node Cluster and implement Word Count program.

PROCEDURE:

INSTALL CONFIGURE AND RUN HADOOP AND HDFS

REQUIREMENTS:

1. Latest java JDK version


2. Hadoop-3.0.0.tar.gz (any stable version)

DOWNLOAD LINKS:

1. For Hadoop:

File size will be about 292 MB

http://www-eu.apache.org/dist/hadoop/common/hadoop-3.0.0/

The file will be downloaded as zip file extract it to the C: drive

2.Replace the Bin Folder:

Delete the all contents of the bin folder and replace it by downloading from the below
link

https://codeload.github.com/gvreddy1210/bin/zip/master

3. For jdk:

Check for java installation by typing java in cmd

If not present do the following check whether the system is 32bit or 64bit.

For 32bit: https://www.filehorse.com/download-java-development-kit-

32/

For 64bit: https://www.filehorse.com/download-java-development-kit-


64/33594/

PROCEDURE:

3. Path setting:

Go to control panel (or) file explorer (or) right click my computer  select system
properties select advanced system settings  go to advanced tab select environment
variables.

For java:
VARIABLE : JAVA_HOME

PATH : locate till jdk folder inside java

(Eg: c:\program files\java\jdk1.8.0_162)

For Hadoop:

VARIABLE : HADOOP_HOME

PATH : Locate till Hadoop folder inside the Hadoop directory.

(Eg: C:\hadoop-3.0.0\hadoop-3.0.0)

VARIABLE : Path
PATH : Locate till bin folders of both jdk and

Hadoop. (Eg: C:\program files\java\

jdk1.8.0_162;

C:\hadoop 3.0.0\hadoop3.0.0\

bin; C:\hadoop-3.0.0\

hadoop3.0.0\sbin)

Note: you have to set three paths to the Path. Separate the paths by a semicolon (;)

4.COPY AND PASTE THE CONFIGURATIONS:

The below files are found in the etc folder Hadoop.

1. Open hadoop-env.cmd file in

notepad. Search for

 Set JAVA_HOME

Type the location of the JAVA_HOME


(Eg: set JAVA_HOME= C:\program files\java\jdk1.8.0_162)

Note : we already set this in the path setting.

2. Open core-site.xml in notepad.

Place these contents between <configuration> tag.

<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>

Create a folder named data. Inside that folder create two folders named datanode and
namenode.

3. Open hdfs-site.xml in notepad. Place these contents between <configuration> tag.

<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>/C:/hadoop-3.0.0/hadoop-3.0.0/data/namenode</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>/C:/hadoop-3.0.0/hadoop-3.0.0/data/datanode</value>
</property>

Note : The values in the dfs.namenode.name.dir and dfs.namenode.data.dir points to the


folder we created earlier.

4. Open mapred-site.xml file in notepad


Place these contents between <configuration> tag.

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

5. Open yarn-site.xml file in notepad.


Place these contents between <configuration> tag.
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>

5. RUN HADOOP

Open command prompt with admin privileges and run the following command to
format the namenode.

hadoop namenode –format

As of now you have completed the installation steps, now you need to run the setup for
that, open command prompt and execute “start-all.cmd”.

Now you’ll see Namenode, Datanode, Resourcemanager, and nodemanager starting


in different prompts
.

Now if you want to check which services are running in your system, run the command
‘JPS’ in your command prompt.

WORD COUNT PROGRAM AND RUN USING HADOOP

REQUIREMENTS:

1. Latest java JDK version


2. hadoop-3.0.0.tar.gz (any stable version)
3. Windows 64-bit version

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

Create an input directory in HDFS.


o hadoop fs -mkdir /input_dir

 Copy the input text file named input_file.txt in the input directory (input_dir)of
HDFS.
o hadoop fs -put C:/input_file.txt /input_dir

 Verify input_file.txt available in HDFS input directory (input_dir).


o hadoop fs -ls /input_dir/

 Verify content of the copied file.

1. Run MapReduceClient.jar and also provide input and out directories.


hadoop jar C:/MapReduceClient.jar wordcount /input_dir /output_dir

2. Verify content for generated output file.


hadoop dfs -cat /output_dir/*

PROGRAM:

import java.io.IOException; import java.util.StringTokenizer;


import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import
org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import
org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; public class WordCount {
public static class TokenizerMapper
extends Mapper<Object, Text, Text,
IntWritable>{ private final static IntWritable one =
new IntWritable(1); private Text word = new Text();
public void map(Object key, Text value, Context context
) throws IOException, InterruptedException
{ StringTokenizer itr = new
StringTokenizer(value.toString()); while
(itr.hasMoreTokens()) {
word.set(itr.nextToken()
); context.write(word,
one);
}
}
}
public static class IntSumReducer
extends Reducer<Text,IntWritable,Text,IntWritable> {
private IntWritable result = new IntWritable();
public void reduce(Text key, Iterable<IntWritable> values,
Context context
) throws IOException, InterruptedException
{ int sum = 0;
for (IntWritable val : values)
{ sum += val.get();
}
result.set(sum);context.write(key, result);
}
}
public static void main(String[] args) throws Exception
{ Configuration conf = new Configuration();
Job job = Job.getInstance(conf, "word count");
job.setJarByClass(WordCount.class);
job.setMapperClass(TokenizerMapper.class);
job.setCombinerClass(IntSumReducer.class);
job.setReducerClass(IntSumReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
FileInputFormat.addInputPath(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));
System.exit(job.waitForCompletion(true) ? 0 : 1);
}
}
RESULT:

Therefore Hadoop Single Node Cluster is created and word count program is
implemented completed successfully.

You might also like