0% found this document useful (0 votes)
58 views76 pages

CC Lab Manual-3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views76 pages

CC Lab Manual-3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 76

LIST OF EXPERIMENTS

EX. PAGE MARKS


DATE LIST OF EXPERIMENTS SIGN
NO NO ALLOTED

Install VirtualBox/VMware
Workstation with different flavors of
1.
Linux or windows OS on top of
windows7 or 8.

Install a C compiler in the virtual machine


2 created usingvirtual box and execute Simple
Programs.

Install Google App Engine. Create hello world


3 app and othersimple web applications using
python/java.

4 Use GAE launcher to launch the web applications.

Simulate a cloud scenario using Cloud Sim and run


5 a schedule inAlgorithm hat is not present in Cloud
Sim.

Find a procedure to transfer the files from one


6
virtual macanother virtual machine.

Install Hadoop single node cluster and run simple


7
applications l wordcount.

Creating and Executing your First Container using


8
Docker.

9 Run a Container from Docker Hub.

Additional experiments

10 Develop new OGSA-compliant Web Service

Develop applications using Java or C/C++ Grid


11
APIs

1
Exp No : 1
Install VirtualBox/VMware Workstation with different flavors of Linux or
windows OS on top ofwindows7 or 8.
Date :

AIM:
To Install VirtualBox / VMware Workstation with different flavors of Linux or windows
OS on topof windows 7 or 8.

PROCEDURE:
Steps to install Virtual Box:
1. Download the Virtual box exe and click the exe file…and select next button.

2. Click the next button.

2
3.Click the next button.

4.Click the YES button.

5.Click the install button.

3
6.Then installation was completed..the show virtual box icon on desktop screen.

Steps to import Open nebula sandbox:


1. Open Virtual box
2. File import Appliance
3. Browse OpenNebula-Sandbox-5.0.ova file
4. Then go to setting, select Usb and choose USB 1.1
5. Then Start the Open Nebula
6.Login using username: root, password:opennebula

4
5
There are various applications of cloud computing in today’s network world. Many search
engines and
websites are using the concept of cloud computing like www.amazon.com, hotmail.com, facebook.com,
linkedln.com

advantages of cloud computing in context to scalability is like reduced risk , low cost testing ,ability to
segment the cusand auto-scaling based on application load.

6
7
Steps to create Virtual Machine through opennebula
1. Open Browser, type localhost:9869
2. Login using username: oneadmin, password: opennebula

3. Click on instances, select VMs then follow the steps to create Virtaul machine
a. Expand the + symbol
b. Select user oneadmin
c. Then enter the VM name,no.of instance, cpu.
d. Then click on create button.
e. Repeat the steps the C,D for creating more than one VMs.

PERFORMANCE 50

RECORD 15

VIVA-VOCE 10

TOTAL 75

Result:

Thus, the installation of VirtualBox/VMware Workstation with different flavors of Linux or


windows OSon top of windows7 or 8 has been successfully executed.

8
9
Exp No : 2
Install a C compiler in the virtual machine created usingvirtual 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:

1. Open Virtual box


2. File import Appliance
3. Browse ubuntu_gt6.ova file
4. Then go to setting, select Usb and choose USB 1.1
5. Then Start the ubuntu_gt6
6. Login using username: dinesh, password:99425.

Steps to run c program:

1. Open the terminal


2. Type cd /opt/axis2/axis2-1.7.3/bin then press enter
3. gedit hello.c
4. gcc hello.c
5. ./a.out

1. Type cd /opt/axis2/axis2-1.7.3/bin then press enter

10
2. Type gedit first.c

3. Type the c program

11
4. Running the C program

5. Display the output

12
13
PERFORMANCE 50

RECORD 15

VIVA-VOCE 10

TOTAL 75

Result:

Thus the simple C programs executed successfully.

14
15
Exp No : 3
Install Google App Engine. Create hello world app and othersimple web
applications using python/java.
Date :

Aim:

To Install Google App Engine. Create hello world app and other simple webapplications using python/java.
PROCEDURE:

1. Install Google Plugin for Eclipse


Read this guide – how to install Google Plugin for Eclipse. If you install the Google App Engine Java SDK
togetherwith “Google Plugin for Eclipse“, then go to step 2, Otherwise, get the Google App Engine Java
SDK and extract it.
2. Create New Web Application Project

In Eclipse toolbar, click on the Google icon, and select “New Web Application Project…”

Figure – Deselect the “Google Web ToolKit“, and link your GAE Java SDK via the “configureSDK” link

Click finished, Google Plugin for Eclipse will generate a sample project automatically.

3. Hello World
Review the generated project directory.

Nothing special, a standard Java web project structure.

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...

Copy
The extra is this file “appengine-web.xml“, Google App Engine need this to run and deploy

theapplication.File : appengine-web.xml

<?xml version="1.0" encoding="utf-8"?>

16
17
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application></application>

<version>1</version>

<!-- Configure java.util.logging -->


<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>

</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 startINFO: The
adminconsole is running at http://localhost:8888/_ah/admin
Copy
Access URL http://localhost:8888/, see output

1.Deploy to Google
App Engine
Register an account on https://appengine.google.com/, and create an application ID for your

webapplication.In this demonstration, I created an application ID, named “mkyong123”, and put it

in appengine-web.xml.

File : appengine-web.xml

<?xml version="1.0" encoding="utf-8"?>


<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>mkyong123</application>
<version>1</version>

<!-- Configure java.util.logging -->


<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>

</appengine-web-app>

18
19
Copy
Figure 1.3 – If everything is fine, the hello world web application will be deployed to this URL –
http://mkyong123.appspot.com/

PERFORMANCE 50

RECORD 15

VIVA-VOCE 10

TOTAL 75

Result:

Thus the simple application was created successfully.

20
21
Exp No : 4
Use GAE launcher to launch the web applications.
Date :

Aim:

To Use GAE launcher to launch the web applications

PROCEDURE;

Making your First Application

Now you need to create a simple application. We could use the “+”option to have the launcher
make us anapplication– but instead we will do it by hand to get a better sense of what is going
on.
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:

C:\Documents and
Settings\csv\Desktop\apps
And then make a sub-•‐folder in within apps called “ae-•01-•trivial” – the path to this fo
lder would be:C:\ Documents and Settings \csv\Desktop\apps\ae-•01-•trivial
Using a text editor such as JEdit (www.jedit.org), create a file called app. yaml in theae-•01-•trivial folder
with thefollowing contents:
application: ae-01-
trivial
version: 1
runtime: python api_version: 1
handlers:- url: /.*script: index.py
Note: Please do not copy and paste these lines into your text editor– you might end up with strange
characters –simply type them into your editor.
Then create a file in the ae-•01-•trivial folder called index.py with three
lines in it:print 'Content-Type: text/plain' print ' '
print 'Hello there Chuck'
Then start the Google App Engine Launcher program that can be found under Applications. Use the
File -•> Add Existing Application command and navigate into the apps directory and select the
ae-•01-•trivial folder. Once you have added the application, select it so that you can control the
application using the launcher Once youhave selected yourapplicationand press Run. Aftera few
moments your application willstart and the launcher willshow a little green icon next to your application.
Then press Browse to open a browser pointing at yourapplication which is running at
http://localhost:8080/
Paste http://localhost:8080 into your browser and you should see your
applicationas follows:

Paste http://localhost:8080 into your browser and you should see your
applicationas follows

22
23
Watching the Log

You can watch the internal log of the actions that the webserver is performing when youare interacting
with yourapplication in the browser. Select your application in the Launcher and press the Logs button to
bring up a log window:

Each time you press Refresh in your browser–you can see


it retrievingthe output with a GET request.

Dealing With Errors

With two files to edit, there are two general categories of errors that you may encounter. If you make a
mistake onthe app.yaml file, the App Engine will not start 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:

In this instance – the mistake is mis-• ‐ indenting the last line in the app.yaml (line 8).
Ifyoumake asyntaxerror in the index.pyfile, a Pythontrace backerrorwillappear inyourbrowser.

The error you need to see is likely to be the last few lines of the output
– in thiscaseI 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 mistakeand attempt to start the
applicationagain.

If you make a mistake in a file like index.py, you can simply fix the file andpress refresh in your browser
– there isno 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
Just for fun, edit he index.py to change the name“ Chuck” to your own name and press Refresh in the
browser toverify your updates.

24
25
PERFORMANCE 50

RECORD 15

VIVA-VOCE 10

TOTAL 75

Result:

Thus the GAE web applications was created.

26
27
Exp No : 5
Simulate a cloud scenario using Cloud Sim and run a schedule inAlgorithm hat
is not present in Cloud Sim.
Date :

AIM:

To Simulate a cloud scenario using Cloud Sim and run a scheduling algorithm that is not present in Cloud
Sim.

Algorithm:

How to use Cloud Sim in Eclipse


Cloud Sim is written in Java. The knowledge you need to use CloudSim is basic Java programming and
some basicsabout cloud computing. Knowledge of programming IDEs such as Eclipse or NetBeans is also
helpful. It is a library and, hence, CloudSim does not have to be installed. Normally, you can
unpack the downloaded package in any directory, add it to the Java classpath andit is ready to be used.
Please verifywhether Java is available on your system.

To use Cloud Sim in Eclipse:


1.Download Cloud Sim installable files
from
https://code.google.com/p/cloudsim/downloads/list and
unzip2.Open Eclipse
3. Create a new Java Project: File -> New
4. Import an unpacked CloudSim project into the new Java Project
The first step is to initialise the Cloud Sim package by initialising the CloudSim library, as follows

Cloud Sim.init(num_user, calendar, trace_flag)


5. Data centres are the resource providers in CloudSim; hence, creation of data centres is a second step.
To create Datacenter, you need the DatacenterCharacteristics object that stores the properties of a data
centre such asarchitecture, OS, list of machines, allocation policy that covers the time or spaceshared, the
time zone and its price:Datacenter datacenter9883 = new Datacenter(name, characteristics, new
VmAllocation PolicySimple(hostList), s 6.The third step is to create a broker:
Data center Broker broker = createBroker();
7. The fourth step is to create one virtual machine unique ID of the VM, userIdID of the VM’s owner,
mips, numberOf Pes amount of CPUs, amount of RAM,amount of bandwidth, amount of storage,
virtual machine monitor, and cloudletScheduler policy for cloudlets: Vm vm = new Vm(vmid, brokerId,
mips, pesNumber, ram, bw, size, vmm,new CloudletSchedulerTimeShared())

8. Submit the VM list to the broker: broker.submitVmList(vmlist)


9. Create a cloudlet with length, file size, output size, and utilization model:
Cloudlet = new Cloudlet(id, length, renumber, file Size, output Size, utilization Model, utilization
Mode. 10.Submit the cloudlet list to the broker: broker. Submit Cloudlet List (cloudlet List)
Sample Output from theExisting Example:
Starting CloudSimExample1... Initializing...
Starting Cloud Sim version Datacenter_0is starting...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>null
Broker is starting... Entities started.
: Broker: Cloud Resource List received with 1 resource(s) 0.0: Broker: Trying to Create VM #0in
Datacenter_0

28
Output:

========== OUTPUT ==========


Cloudlet ID STATUS Data center IDFinish Time 0SUCCESS 2
0.1400.1
*****Datacenter:
Datacenter_0***** User idDebt
3 35.6

CloudSimExample1 finished!

29
: Broker: VM #0 has been created in Datacenter #2, Host #00.1: Broker: Sending cloudlet 0 to VM #0
: Broker: Cloudlet 0 received
: Broker: All Cloudlets executed. Finishing
.................... 400.1: Broker: Destroying VM #0
Broker is shutting down... Simulation: No more future events
Cloud Information Service: Notify all Cloud Sim entities for shutting down. Datacenter_0 is shutting
down...
Broker is shutting down
Simulationcompleted.
Simulation completed.

PERFORMANCE 50

RECORD 15

VIVA-VOCE 10

TOTAL 75

Result:

Thus the simple application was created successfully.

30
31
Exp No : 6
Find a procedure to transfer the files from one virtual macanother virtual
machine.
Date :

Aim:

To Find a PROCEDURE to transfer the files from one


virtual machineto another virtual machine.

PROCEDURE

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 fromthe 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
anduse one ofthe directory shared as buffer to copy.
Installing Guest Additions you have the possibility to set Shared Folders too.As
you put afile in a shared folder from host OS or from guest OS, is immediately
visible to the other.(Keep in mind that can arise some problemsfor 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
filesdirectly copyingthem in this folder.
4. You can use usual method to copy files between 2 different computer with
client-serverapplication. (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
onthe 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
ifit is runningwith 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
orSSHFS onthe 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 machineswith
differentoperative systems, and in particular:
 Each virtual machine has its own operative system running on
and actsas aphysical machine.

32
Host:one-sandbox

33
 Each virtual machine is an instance of a program owned by an user in
the hostingoperative system and should undergo the restrictions of the
user in thehosting OS.
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 Windowsmachines 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/froma remote machine without writingpassword
anymore. Inthis 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 onthat ,the popup window display
c. On that select the target host to migrate then click on migrate.

34
After migration :

35
Host:one-sandbox

36
Host:SACET

37
PERFORMANCE 50

RECORD 15

VIVA-VOCE 10

TOTAL 75

Result:

Thus the file transfer between VM was successfully completed…..


38
39
Exp No : 7
Install Hadoop single node cluster and run simple applications l wordcount.
Date :

Aim:

To Install Hadoop single node cluster and run simple applications like wordcount.

PROCEDURE:

Install Hadoop

Step 1: Click here to download the Java 8 Package. Save this file in your

homedirectory.Step 2: Extract the Java Tar File.

Command: tar -xvf jdk-8u101-linux-i586.tar.gz

Step 3: Download the Hadoop 2.7.3 Package

Step 4: Extract the Hadoop tar File.

Step 5:Add the Hadoop and Java paths in the bash file (.bashrc). Open.

bashrcfile.Now,add Hadoop and Java Path as shown below.

For applying all these changes to the current Terminal, execute the source command

Then, save the bash file and close it.

Step 6: Edit the Hadoop

Configuration files.Command:

cd hadoop-2.7.3/etc/hadoop/

All the Hadoop configuration files are located in hadoop-2.7.3/etc/hadoop directory


as you cansee in the snapshot below:

40
Command: cd hadoop-2.7.3/etc/hadoop/

Command: vicore-site.xml\

Command: vi hdfs-site.xml

Command: cp mapred-site.xml.template mapred-site.xml

41
Step 10: Edit yarn-site.xml and edit the property mentioned
below insideconfiguration tag:

yarn-site.xml contains configuration settings of ResourceManager and NodeManager


likeapplication memory management size, the operation needed on program &
algorithm, etc.

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 ofHadoop core such as I/O settings that are common to HDFS & MapReduce.

Step 8: Edit hdfs-site.xml and edit the property mentioned below inside
configuration tag:
hdfs-site.xml contains configuration settings of HDFS daemons (i.e. NameNode, DataNode,Secondary
NameNode). It also includes the replication factor and block size of HDFS.

: Edit the mapred-site.xml file and edit the property mentioned below inside configuration tag:

mapred-site.xml contains configuration settings of MapReduce application like


number of JVM that can run in parallel, the size of the mapper and the reducer
process, CPU cores available for a process, etc.

In some cases, mapred-site.xml file is not available. So, we have to create the
mapred- site.xmlfile using mapred-site.xml template.

42
Command: vi mapred-site.xml.

Command: vi yarn-site.xml

Fig: Hadoop Installation – Configuring yarn-site.xml

Command: vi hadoop–env.sh

43
Step 11: Edit hadoop-env.sh and add the Java Path as mentioned below:

1
2
<?xml version="1.0">
3 <configuration>
4 <property>
5 <name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
6 </property>
7 <property>
8 <name>yarn.nodemanager.auxservices.mapreduce.shuffle.class</
9 name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
1 </property>
0
1

hadoop-env.sh contains the environment variables that are used in the script to
run Hadooplike Java home path, etc.

Step12: Go to Hadoop home directory and

format the NameNode.

Command: cd

Command: cd hadoop-2.7.3

Command: bin/hadoop namenode -format

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 theHDFS.

Step 13: Once the NameNode is formatted, go to hadoop-2.7.3/sbin directory and


start all thedaemons.

Command: cd hadoop-2.7.3/sbin

Either you can start alldaemons with a single command or do it individually.

Command: ./start-all.sh

44
Fig: Hadoop Installation – Formatting NameNode

Fig: Hadoop Installation – Starting NameNodeStart DataNode:

Fig: Hadoop Installation – Starting ResourceManager

Fig: Hadoop Installation – Starting NodeManager

45
The above command is a combination of start-dfs.sh, start-yarn.sh &
mr-jobhistory-daemon.sh

Or you can run all the services individually as below:

Start NameNode:

The NameNode is the centerpiece of an HDFS file system. It keeps the directory tree
of all filesstored in the HDFS and tracks all the file stored across the cluster.

Command: ./hadoop-daemon.sh start namenode

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.

Command: ./yarn-daemon.sh start nodemanager

Start JobHistoryServer:

JobHistoryServer is responsible for servicing all job history related requests from client.

Command: ./mr-jobhistory-daemon.sh start historyserver

Step 14: To check that all the Hadoop services are up and running, run thebelowcommand.

Command: jps

On startup, a DataNode connects to the Namenode and it responds to the requestsfrom the
Namenode for different operations.

Command: ./hadoop-daemon.sh start datanode

Start ResourceManager:

ResourceManager is the master that arbitrates all the available cluster resources and thushelps in
managing the distributed applications running on the YARN system. Its workis to manage each
NodeManagers and the each application’s ApplicationMaster.

Command: ./yarn-daemon.sh start resourcemanager

Fig: Hadoop Installation – Checking Daemons

46
Fig: Hadoop Installation – Starting
WebUI

47
Step 15: Now open the Mozilla browser and go
to localhost:50070/dfshealth.html to check the NameNode interface.

Congratulations, you have successfully installed a single node Hadoop cluster

PERFORMANCE 50

RECORD 15

VIVA-VOCE 10

TOTAL 75

Result:

Thus the Hadoop one cluster was installed and simple applications executed successfully.

48
49
Exp No : 8
Creating and Executing your First Container using Docker.
Date :

AIM:

To create and execute the container using Docker.

Prerequisites:

Install Docker on your machine:

For Ubuntu:

First, update your packages:

$ sudo apt update

Next, install docker with apt-get:

$ sudo apt install docker.io

Finally, verify that Docker is installed correctly:

$ sudo docker run hello-world

1. Create your project

In order to create your first Docker application, I invite you to create a folder on your computer. It must

contain the following two files:

1. A ‘main.py’ file (python file that will contain the code to be executed).

2. A ‘Dockerfile’ file (Docker file that will contain the necessary instructions to create the

environment).

Normally the folder architecture:

├── Dockerfile

└── main.py

0 directories, 2 files

50
51
2. Edit the Python file

You can add the following code to the ‘main.py’ file:

#!/usr/bin/env python3

print("Docker is magic!")
Nothing exceptional, but once you see “Docker is magic!” displayed in your

terminal you will know that your Docker is working.

3. Edit the Docker file

The first step to take when you create a Docker file is to access the
DockerHub website. This site contains many pre-designed images to save
your time
(for example: all images for linux or code languages).

In our case, we will type ‘Python’ in the search bar. The first result is the official image
created to execute Python.
# A dockerfile must always start by importing the base image.

# We use the keyword 'FROM' to do that.

# In our example, we want import the python image.

# So we write 'python' for the image name and 'latest' for the version.

FROM python:latest

# In order to launch our python code, we must import it into our image.

# We use the keyword 'COPY' to do that.

# The first parameter 'main.py' is the name of the file on the host.
# The second parameter '/' is the path where to put the file on the image. # Here we put the
file at the image root folder.

52
53
COPY main.py /

# We need to define the command to launch when we are going to run the image.

# We use the keyword 'CMD' to do that.

# The following command will execute "python ./main.py".

CMD [ "python", "./main.py" ]

4. Create the Docker image

Once your code is ready and the Dockerfile is written, all you have to do is create your

image to contain your application.

$ docker build -t python-test .

The ’-t’ option allows you to define the name of your image. In our

case we have chosen ’python-test’ but you can put what you want.

5. Run the Docker image

Once the image is created, your code is ready to be launched.

$ docker run python-test

You need to put the name of your image after ‘docker run’.

You should normally see “Docker is magic!” displayed in your terminal.

PERFORMANCE 50

RECORD 15

VIVA-VOCE 10

TOTAL 75

RESULT:

Thus the creation and execution of container program using Docker executed
successfully.

54
55
Exp No : 9
Run a Container from Docker Hub.
Date :

AIM:

To run a Container from Docker Hub.

PROCEDUREs:

Step-1: Verify Docker version and also login to Docker Hub docker
versiondocker login

Step-2: Pull Image from Docker Hub docker pull stacksimplify/dockerintro-springboot- helloworld-
rest-api:1.0.0-RELEASE

Step-3: Run the downloaded Docker Image & Access the Application Copy the docker image name
from Docker Hub docker run --name app1 -p 80:8080 -d stacksimplify/dockerintro-spring boot-
helloworld-rest-api:1.0.0-RELEASE
http://localhost/hello

Step-4: List Running Containers


docker psdocker ps -a
docker ps -a -q

Step-5: Connect to Container Terminal docker exec -it <container-name> /bin/sh

Step-6: Container Stop, Start


docker stop <container-name> docker start <container-name>

Step-7: Remove Container

docker stop <container-name> docker rm <container-name>

Step-8: Remove Image docker


imagesdocker rmi<image-id>

56
57
PERFORMANCE 50

RECORD 15

VIVA-VOCE 10

TOTAL 75

RESULT:

Thus the Container from Dockerhub executed successfully.

58
59
Exp No : 10
Develop new OGSA-compliant Web Service
Date :

AIM:

To build a newOGSA- Compliant web service.

PROCEDURE:

Steps:

1. Setup the Development Environment for


PATH,JAVA_HOME,TOMCAT_HOME.(My computerProperties
Advanced System SettingEnvironment variables)
2. Open the Eclipse then select windowspreferenceswebservice
3. Then select Axis2 preferences and choose Axis2 runtime tab.
4. Then browse the Axis2 path.
5. FileNew Dynamic web project
6. Name the project name eg.Myfirstwebservice ,select the Target run
time environment as Apache Tomcat v6.0
7. Then choose custom on configuration and click on Modify button
8. Then project facets window will popup .
9. On that check-in the Axis2 Web Services,clickoK then Next
10. Right Click on MyFirstWebService in Project Explorer and select New –->
Class and give suitable package name and class name. I have given
com.sencide as package name and FirstWebService as class name.
11. Type the following code on class file

packagecom.sencide;
public class FirstWebService {
public int addTwoNumbers(int firstNumber, int
secondNumber){ return firstNumber + secondNumber;
}
}
12. Then, select File --> New –-> Other and choose Web Service
13. Select the FirstWebService class as service implementation and to make sure
that the Configuration is setup correctly click on Server runtime.
14. There set the Web Service runtime as Axis2 (Default one is Axis) and click Ok.
15. Click Next and make sure Generate a default service.xml file is selected.
16. Click Next and Start the Server and after server is started you can Finish if you
do not want to publish the Web service to a test UDDI repository
17. You can go to http://localhost:8080/MyFirstWebService/services/listServices to
see your running service which is deployed by Axis2. You can see the WSDL by
clicking the link FirstWebService.
18. Select File --> New --> Other… and choose Web Service Client

60
OUTPUT:

61
19. Set he newly created Axis2 Web service
(http://localhost:8080/axis2/services/FirstWebService?wsdl) as the
Service definition. Then configure the Server runtime as previously and
click finish.
20. This will generate two new classes called FirstWebServiceStub.java and
FirstWebServiceCallbackHandler.java. Now we can create test class for client
and use our web service. Create new class called TestClient.java and paste
following code.
packagecom.sencide;

importjava.rmi.RemoteException;
importcom.sencide.FirstWebServiceStub.AddTwoNumbers;
importcom.sencide.FirstWebServiceStub.AddTwoNumbersResponse;

publicclassTestClient {

publicstaticvoidmain(String[] args) throwsRemoteException {

FirstWebServiceStub stub = newFirstWebServiceStub();


AddTwoNumbersatn = newAddTwoNumbers();
atn.setFirstNumber(5);
atn.setSecondNumber(7);
AddTwoNumbersResponse res = stub.addTwoNumbers(atn);
System.out.println(res.get_return());

}
}

21. Now you can run the above code as java application and you will get the output
as 12 since we are adding 7 and 5.

62
63
64
65
66
67
68
69
APPLICATIONS:

OGSA has contributed to projects and organisations around the world, in sectors including
medical research, geographical information systems, meteorology, transport, computer-aided
design, engineering and astronomy.

PERFORMANCE 50

RECORD 15

VIVA-VOCE 10

TOTAL 75

RESULT:

Thus build a new OGSA- Compliant web service is successfully executed.

70
71
Exp No : 11
Develop applications using Java or C/C++ Grid APIs
Date :

AIM:

To develop applications using Java or C/C++ Grid APIs

PROCEDURE:

Steps:

1. Open the terminal


2. Type cd /opt/axis2/axis2-1.7.3/bin then press enter
3. gedit thello.c
4. gcc hello.c
5. ./a.out

1. Type cd /opt/axis2/axis2-1.7.3/bin then press enter

72
2. Type geditfirst.c

3. Type the c program

73
4. Running the C program

5. Display the output:

74
75
PERFORMANCE 50

RECORD 15

VIVA-VOCE 10

TOTAL 75

RESULT:

Thus develop applications using Java or C/C++ Grid APIs is successfully executed.

76

You might also like