Ccs335 Colud Computing Lab Final
Ccs335 Colud Computing Lab Final
• Students must be present in proper dress code and wear the ID card.
• Students should enter the log-in and log-out time in the log register
without fail.
• Students are not allowed to download pictures, music, videos or files
withoutthe permission of respective lab in-charge.
• Students should wear their own lab coats and bring observation note
books tothe laboratory classes regularly.
• Record of experiments done in a particular class should be submitted
in the next labclass.
• Students who do not submit the record note book in time will not be
allowed to do thenext experiment and will not be given attendance
for that laboratory class.
• Students will not be allowed to leave the laboratory until they
complete the experiment.
• Students are advised to switch-off the Monitors and CPU when they
leave the lab.
• Students are advised to arrange the chairs properly when they leave
the lab.
College
Vision
To improve the quality of human life through multi-disciplinary programs in Engineering,
architecture and management that are internationally recognized and would facilitate
research work to incorporate social economical and environmental development.
Mission
• To create a vibrant atmosphere that creates competent engineers, innovators,scientists,
entrepreneurs, academicians and thinkers of tomorrow.
• To establish centers of excellence that provides sustainable solutions to industryand society.
• To enhance capability through various value added programs so as to meet thechallenges of
dynamically changing global needs.
Department
Vision
Mission
• To produce young Engineers with a sound knowledge in the area of Artificial Intelligence
and Data Science.
• To empower Students to become an eminent in the industries, high rank officials in the
government and academia in the world wide.
• To attain the demand of the experts around the world wide in the fields of Artificial
Intelligence, Machine Learning and Data Science.
Program Outcomes(POs)
Engineering knowledge: Apply the knowledge of mathematics, science,
engineering fundamentals, and an engineering specialization to the solution of
PO1
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
engineering problems and design system components or processes that meet
PO3 the specified needs with appropriate consideration for the public health and
safety, and the cultural, societal, and environmental Considerations.
Conduct investigations of complex problems: Use research-based
knowledge
PO4 and research methods including design of experiments, 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.
Life-long learning: Recognize the need for, and have the preparation and
ability to engage in independent and life-long learning in the broadest
PO12
context of technological change.
PROGRAM SPECIFIC OUTCOMES (PSOs)
PO1 Describe big data and use cases from selected business
domains.
PO2 Explain NoSQL big data management.
lOMoARcPSD|319 796 21
LIST OF EXPERIMENTS
INDEX
3
Install Google App Engine. Create hello world app
and other simple webapplications using
python/java.
4
Use GAE launcher to launch the web
applications.
Aim:
To Install Virtualbox / VMware Workstation with different flavours of linux or windows OS on
top ofwindows7 or 8.
PROCEDURE:
6. Then installation was completed..the show virtual box icon on desktop screen….
lOMoARcPSD|319 796 21
APPLICATIONS:
There are various applications of cloud computing in today’s network world. Many search engines and
social websites are using the concept of cloud computing like www.amazon.com, hotmail.com, facebook.com,
linkedln.com etc. the advantages of cloud computing in context to scalability is like reduced risk , low cost
testing ,ability to segment the customer base and auto-scaling based on application load.
RESULT:
Thus the procedure to run the virtual machine of different configuration.
lOMoARcPSD|319 796 21
Ex.No :2 Install a C compiler in the virtual machine created using virtual box and
execute Simple Programs
Date :
Aim:
To Install a C compiler in the virtual machine created using virtual box and
execute Simple Programs`
PROCEDURE:
APPLICATIONS:
Simply running all programs in grid environment.
RESULT:
Ex.No :3 Install Google App Engine. Create hello world app and other simple web
applications using python/java.
Date :
Aim:
To Install Google App Engine. Create hello world app and other simple web applications using
python/java.
Procedure:
Click finished, Google Plugin for Eclipse will generate a sample project automatically.
3. Hello World
Review the generated project directory.
lOMoARcPSD|319 796 21
HelloWorld/ src/
...Java source code...
META-INF/
...other configuration...
war/
...JSPs, images, data files...
WEB-INF/
...app configuration...
lib/
...JARs for libraries...
classes/
...compiled classes...
lOMoARcPSD|319 796 21
Copy
The extra is this file “appengine-web.xml“, Google App Engine need this to run and deploy the application.
File : appengine-web.xml
</appengine-web-app>
Copy
4. Run it local
Right click on the project and run as “Web Application“.
Eclipse console :
//...
INFO: The server is running at http://localhost:8888/
30 Mac 2012 11:13:01 PM com.google.appengine.tools.development.DevAppServerImpl start INFO: The
admin console is running at http://localhost:8888/_ah/admin
Copy
Access URL http://localhost:8888/, see output
In this demonstration, I created an application ID, named “mkyong123”, and put it in appengine- web.xml.
File : appengine-web.xml
</appengine-web-app>
Copy
Result:
Thus the simple application was created successfull
lOMoARcPSD|319 796 21
Ex.No :4
Date :
Use GAE launcher to launch the web
applications.
Aim:
To Use GAE launcher to launch the web applications.
Steps:
Make a folder for your Google App Engine applications. I am going to make the Folder on
my Desktop called “apps” – the path to this folder is:
the launcher.
Once you have selected your application and press Run. After a few moments your application will
start and the launcher will show a little green icon next to your application. Then press Browse to
open a browser pointing at your application which is running at http://localhost:8080/
You can watch the internal log of the actions that the web server is performing when you are
interacting with your application in the browser. Select your application in the Launcher and press
the Logs button to bring up a log window:
lOMoARcPSD|319 796 21
Each time you press Refresh in your browser – you can see it retrieving the output with a GET
Request.
With two files to edit, there are two general categories of errors that you may encounter. If
You make a mistake onthe app.yamlfile, the App Engine willnotstart and your launcher will show
a yellow icon near your application:
To get more detail on what is going wrong, take a look at the log for the application:
lOMoARcPSD|319 796 21
The error you need to see is likely to be the last few lines of the output – in this case I made a
Python syntax error on line one of our one-•‐line application.
Reference: http://en.wikipedia.org/wiki/Stack_trace
When you make a mistake in the app.yaml file – you must the fix the mistake and attempt to
startthe application again.
If you make a mistake in a file like index.py, you can simply fix the file and press refresh in your
browser – there is no need to restart the server.
Shutting Down the Server
To shut down the server, use the Launcher, select your application and press the Stop button.
Result:
Ex.No :5
Simulate a cloud scenario using CloudSim and
Date : run ascheduling algorithm that is not present in
CloudSim.
Aim
To Simulate a cloud scenario using CloudSim and run a scheduling algorithm that isnot
present in CloudSim.
Steps:
CloudSimExample1 finished!
RESULT:
Ex.No :6
Find a procedure to transfer the files from one virtual machine
Date : to another virtual machine.
Aim:
To Find a procedure to transfer the files from one virtual machine to another virtual machine.
Steps:
1. You can copy few (or more) lines with copy & paste mechanism.
For this you need to share clipboard between host OS and guest OS, installing Guest
Addition on both the virtual machines (probably setting bidirectional and restarting them).
You copy from guest OS in the clipboard that is shared with the host OS.
Then you paste from the host OS to the second guest OS.
2. You can enable drag and drop too with the same method (Click on the machine,
settings, general, advanced, drag and drop: set to bidirectional )
3. You can have common Shared Folders on both virtual machines and use one of
the directory shared as buffer to copy.
Installing Guest Additions you have the possibility to set Shared Folders too. As you put
a file in a shared folder from host OS or from guest OS, is immediately visible to the
other. (Keep in mind that can arise some problems for date/time of the files when there
are different clock settings on the different virtual machines).
If you use the same folder shared on more machines you can exchange files directly copying
them in this folder.
4. You can use usual method to copy files between 2 different computer with client-server
application. (e.g. scp with sshd active for linux, winscp... you can get some info about SSH
servers e.g. here)
You need an active server (sshd) on the receiving machine and a client on the sending
machine. Of course you need to have the authorization setted (via password or, better,
via an automatic authentication method).
Note: many Linux/Ubuntu distribution install sshd by default: you can see if it is running
with pgrep sshd from a shell. You can install with sudo apt-get install openssh-server.
5. You can mount part of the file system of a virtual machine via NFS or SSHFS on
the other, or you can share file and directory with Samba. You may find
interesting the article Sharing files between guest and host without VirtualBox
shared folders with detailed step by step instructions.
You should remember that you are dialling with a little network of machines with different
operative systems, and in particular:
• Each virtual machine has its own operative system running on and acts as a
physical machine.
• Each virtual machine is an instance of a program owned by an user in the hosting
operative system and should undergo the restrictions of the user in the hosting OS.
lOMoARcPSD|319 796 21
E.g Let we say that Hastur and Meow are users of the hosting machine, but they did not
allow each other to see their directories (no read/write/execute authorization). When each
of them run a virtual machine, for the hosting OS those virtual machine are two normal
programs owned by Hastur and Meow and cannot see the private directory of the other
user. This is a restriction due to the hosting OS. It's easy to overcame it: it's enough to give
authorization to read/write/execute to a directory or to chose a different directory in which
both users can read/write/execute.
• Windows likes mouse and Linux fingers. :-)
I mean I suggest you to enable Drag & drop to be cosy with the Windows machines and the
Shared folders or to be cosy with Linux.
When you will need to be fast with Linux you will feel the need of ssh-keygen and
to Generate once SSH Keys to copy files on/from a remote machine without writing password anymore. In
this way it functions bash auto-completion remotely too!
PROCEDURE:
Steps:
1. Open Browser, type localhost:9869
2. Login using username: oneadmin, password: opennebula
3. Then follow the steps to migrate VMs
a. Click on infrastructure
b. Select clusters and enter the cluster name
c. Then select host tab, and select all host
d. Then select Vnets tab, and select all vnet
e. Then select datastores tab, and select all datastores
f. And then choose host under infrastructure tab
g. Click on + symbol to add new host, name the host then click on create.
4. on instances, select VMs to migrate then follow the stpes
a. Click on 8th icon ,the drop down list display
b. Select migrate on that ,the popup window display
c. On that select the target host to migrate then click on migrate.
lOMoARcPSD|319 796 21
Before migration
Host:SACET
Host:one-sandbox
lOMoARcPSD|319 796 21
lOMoARcPSD|319 796 21
After Migration:
Host:one-sandbox
lOMoARcPSD|319 796 21
Host:SACET
APPLICATIONS:
Result:
Thus the file transfer between VM was successfully completed…..
lOMoARcPSD|319 796 21
Aim:
To Install Hadoop single node cluster and run simple
applications like wordcount.
Steps:
Install Hadoop
Step 1: Click here to download the Java 8 Package. Save this file in your home directory.
Step 2: Extract the Java Tar File.
Command: tar -xvf jdk-8u101-linux-i586.tar.gz
Step 5: Add the Hadoop and Java paths in the bash file (.bashrc). Open. bashrc
Command: vi .bashrc
For applying all these changes to the current Terminal, execute the source command.
Command: source .bashrc
To make sure that Java and Hadoop have been properly installed on your system and can be
accessed through the Terminal, execute the java -version and hadoop version commands.
Command: cd hadoop-2.7.3/etc/hadoop/
Command: ls
All the Hadoop configuration files are located in hadoop-2.7.3/etc/hadoop directory as you can
see in the snapshot below:
Step 7: Open core-site.xml and edit the property mentioned below inside configuration tag:
core-site.xml informs Hadoop daemon where NameNode runs in the cluster. It contains
configuration settings of Hadoop core such as I/O settings that are common to HDFS &
MapReduce.
Command: vi core-site.xml
Step 8: Edit hdfs-site.xml and edit the property mentioned below inside
configuration tag:
In some cases, mapred-site.xml file is not available. So, we have to create the mapred- site.xml
file using mapred-site.xml template.
Command: vi mapred-site.xml.
1
<?xml version="1.0" encoding="UTF-8"?>
2 <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
3 <configuration>
4 <property>
5 <name>mapreduce.framework.name</name>
6 <value>yarn</value>
</property>
7 </configuration>
Step 10: Edit yarn-site.xml and edit the property mentioned below inside
configuration tag:
yarn-site.xml contains configuration settings of ResourceManager and NodeManager like
application memory management size, the operation needed on program & algorithm, etc.
Command: vi yarn-site.xml
hadoop-env.sh contains the environment variables that are used in the script to run Hadoop
like Java home path, etc.
lOMoARcPSD|319 796 21
Command: vi hadoop–env.sh
Command: cd
Command: cd hadoop-2.7.3
This formats the HDFS via NameNode. This command is only executed for the first time.
Formatting the file system means initializing the directory specified by the dfs.name.dir
variable.
Never format, up and running Hadoop filesystem. You will lose all your data stored in the
HDFS.
Step 13: Once the NameNode is formatted, go to hadoop-2.7.3/sbin directory and start all the daemons.
Command: cd hadoop-2.7.3/sbin
Either you can start all daemons with a single command or do it individually.
Command: ./start-all.sh
Start NameNode:
The NameNode is the centerpiece of an HDFS file system. It keeps the directory tree of all files
stored in the HDFS and tracks all the file stored across the cluster.
Start ResourceManager:
ResourceManager is the master that arbitrates all the available cluster resources and thus
helps in managing the distributed applications running on the YARN system. Its work
is to manage each NodeManagers and the each application’s ApplicationMaster.
Start NodeManager:
The NodeManager in each machine framework is the agent which is responsible for
managing containers, monitoring their resource usage and reporting the same to the
ResourceManager.
Start JobHistoryServer:
JobHistoryServer is responsible for servicing all job history related requests from client.
Step 14: To check that all the Hadoop services are up and running, run the
below command.
Command: jps
Result:
Thus the Hadoop one cluster was installed and simple applications executed successfully.
lOMoARcPSD|319 796 21
Ex.No :9
Run a Container from Docker Hub
Date :
AIM:
To write a program to run a container from Docker hub.
PROCEDURE:
Run a container from docker hub
Rundocker -h,
$ docker -h
Flag shorthand -h has been deprecated, please use --help Usage:
...
Management Commands:
builder Manage builds
config Manage Docker configs
container Manage containers
engine
Manage the docker
engineimage Manage images
network
Manage networks
node Manage Swarm nodes
plugin Manage plugins
secret Manage Docker secrets
service Manage
services
stack Manage Docker stacks
swarm Manage Swarm
system Manage Docker
trust Manage trust on Docker images
volume Manage volumes
The Docker command line can be used to manage several features of the Docker Engine. In this lab, we will
mainly focus on the container command.
lOMoARcPSD|319 796 21
If podman is installed, you can run the alternative command for comparison. sudo
podman -h
docker
version
Client:
Version: 19.03.6
...
We are going to use the Docker CLI to run our first container.
Once it is downloaded, it will start the container. The output for the running container should look like
this:
top - 20:32:46 up 3 days, 17:40, 0 users, load average: 0.00, 0.01, 0.00
lOMoARcPSD|319 796 21
KiB Mem : 2046768 total, 173308 free, 117248 used, 1756212 buff/cache
KiB Swap: 1048572 total, 1048572 free, 0 used. 1548356 avail
Mem
And Voila! We just used the docker container exec command to "enter" our container's namespaces with
our bash process. Using docker container exec with bash is a common pattern to inspect a docker
container.
Notice the change in the prefix of your terminal. e.g. root@b3ad2a23fab3:/. This is an indication that we
are running bash "inside" of our container.
From the same termina, run ps -ef to inspect the running processes.
root@b3ad2a23fab3:/# ps -ef UID PID PPID C STIME TTY TIME CMD
root 1 0 0 20:34 ? 00:00:00 top
root 17 0 0 21:06 ? 00:00:00 bash
root 27 17 0 21:14 ? 00:00:00 ps -ef
lOMoARcPSD|319 796 21
You should see only the top process, bash process and our ps process.
root@b3ad2a23fab3:/# exit
exit
$ ps -ef
# Lots of processes!
docker ps -a
5e1bf0e6b926bd73a66f98b3cbe23d04189c16a43d55dd46b8486359f6fdf048 Nginx is a
lightweight web server. You can access it on port 8080 on your localhost.
Access the nginx server on localhost:8080. curl
localhost:8080
will return the HTML home page of Nginx,
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body
{
width: 35em; margin:
0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
lOMoARcPSD|319 796 21
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
If you are using play-with-docker, look for the 8080 link near the top of the page, or if you run a Docker
client with access to a local browser,
Run a mongo DB server
Now, run a mongoDB server. We will use the official mongoDB image from the Docker Hub. Instead of
using the latest tag (which is the default if no tag is specified), we will use a specific version of the mongo
image.
$ docker container run --detach --publish 8081:27017 --name mongo mongo:4.4 Unable
to find image mongo:4.4 locally
4.4: Pulling from library/mongo
d13d02fa248d: Already exists
bc8e2652ce92: Pull complete
3cc856886986: Pull complete
c319e9ec4517: Pull complete
b4cbf8808f94: Pull complete
cb98a53e6676: Pull complete
f0485050cd8a: Pull complete
ac36cdc414b3: Pull complete
61814e3c487b: Pull complete
523a9f1da6b9: Pull complete
3b4beaef77a2: Pull complete
Digest: sha256:d13c897516e497e898c229e2467f4953314b63e48d4990d3215d876ef9d1fc7c Status:
Downloaded newer image for mongo:4.4
d8f614a4969fb1229f538e171850512f10f490cb1a96fca27e4aa89ac082eba5
Access localhost:8081 to see some output from mongo.
curl localhost:8081
which will return a warning from MongoDB,
It looks like you are trying to access MongoDB over HTTP on the native driver port. If
you are using play-with-docker, look for the 8080 link near the top of the page.
lOMoARcPSD|319 796 21
d6777df89fea nginx "nginx -g 'daemon ..." Less than a second ago Up 2 seconds
0.0.0.0:8080-
>80/tcp nginx
ead80a0db505 mongo "docker-entrypoint..." 17 seconds ago Up 19 seconds 0.0.0.0:8081-
>27017/tcp mongo
af549dccd5cf ubuntu "top" 5 minutes ago Up 5 minutes priceless_kepler
Step 3: Clean Up
First get a list of the containers running using docker container ls.
$ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d6777df89fea nginx "nginx -g 'daemon ..." 3 minutes ago Up 3 minutes
0.0.0.0:8080-
>80/tcp nginx
ead80a0db505 mongo "docker-entrypoint..." 3 minutes ago
Up 3 minutes 0.0.0.0:8081->27017/tcp mongo
af549dccd5cf ubuntu "top" 8 minutes ago
Up 8 minutes priceless_kepler
Next, run docker container stop [container id] for each container in the list. You can also use the
names of the containers that you specified before.
$ docker container stop
d67 ead af5 d67
ea
d
af5
lOMoARcPSD|319 796 21
- Containers:
7872fd96ea4695795c41150a06067d605f69702dbcb9ce49492c9029f0e1b44b
60abd5ee65b1e2732ddc02b971a86e22de1c1c446dab165462a08b037ef7835c
31617fdd8e5f584c51ce182757e24a1c9620257027665c20be75aa3ab6591740