Cloud Lab Manual
Cloud Lab Manual
Branch__________________________________ Batch_______________________
Certified that this is bonafide record of work done by the above student during
the year 20 -20
ADDITIONAL EXPERIMENTS
Date:
Aim:
Find procedure to Install Virtual box/VMware Workstation with different flavors of
Linux or windows OS on top of windows7 or 8.
PROCEDURE TO INSTALL
Step 1- Download Link
Link for downloading the software is https://www.vmware.com/products/workstation-
pro/workstation- pro-evaluation.html. Download the software for windows. Good thing is that there
is no signup process. Click and download begins. Software is around 541 MB.
Result:
Date:
INSTALLVIRTUALBOX
1. Visithttp://www.virtualbox.org/wiki/downloads
2. Download VirtualBox platform packages for yourOS
3. Open the Installation Package by double clicking
DOWNLOAD LINUX
CL¦
CK
12.Click the folder icon and choose the ubuntu iso file you downloaded.
I3. Select the size of the Virtual Disk (I recommend choosing 8 GB) and click continue
14. Click Create
RUNNING LINUX
3. Click the folder icon and choose the ubuntu iso file you downloaded and click continue and start
4. Click Install Ubuntu
C Programming on Linux
Result:
Thus the C compiler is created using virtual box and execute Simple Programs are executed
successfully.
EX.No:3 INSTALLING AND RUNNING THE GOOGLE APP
ENGINE ON WINDOWS
Date:
The App Engine SDK allows you to run Google App Engine Applications on your local computer. It
simulates the run--‐time environment of the Google App Engine infrastructure.
If you don't already have Python 2.5.4 installed in your computer, download and Install Python 2.5.4
from:http://www.python.org/download/releases/2.5.4/
You can download the Google App Engine SDK by going to:
http://code.google.com/appengine/downloads.html
Download the Windows installer – the simplest thing is to download it to your Desktop or
another folder that you remember.
Now you need to create a simple application. We could use the “+” option to have
the launcher make us an application – 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:
application: ae-
01-trivial
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
script: index.py
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 GoogleAppEngineLauncher 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 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/
Paste http://localhost:8080 into your browser and you should see your application as follows:
Just for fun, edit the index.py to change the name “Chuck” to your own name and press Refresh in the
browser to verify your updates.
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:
Each time you press Refresh in your browser – you can see it retrieving the output with a
GET request.
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).
If you make a syntax error in the index.py file, a Python trace back error will appear in your
browser.
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
start the 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.
To shut down the server, use the Launcher, select your application and press the Stop button.
Result:
Thus the Google App Engine is installed and simple web application is executed successfully.
EX.No:4 GAE LAUNCHER TO LAUNCH THE WEB
APPLICATIONS
Date
Google App Engine is a great way to get started with learning web development. It provides a
bunch of useful features such as sharding, automatic database replication, automatic scaling,
memcache, and so on.
PROCEDURE:
No matter what platform you build products on, there is always some housekeeping stuff you
need to put in place before you can hit the ground running. And deploying apps within the Google
App Engine is no exception.
As of when this article was written, the Google App Engine standard environment supports
Python only upto version 2.7. However, it is only a matter of time before support for Python
3.x is added. You can check the App Engine docs for the latest info.
This will allow you to fork apps onto your local machine, make changes (edit and develop the
app), and deploy your app back to the cloud.
After downloading the SDK, launch the App Engine launcher, go to Edit -> Preferences and
make sure you set the path for where you installed Python in step 1 above.
Step 2. App Engine sign-up
This is often the most confusing part of the entire setup. Things you should know when you sign-up:
The next step is to create a new Python project that you can work on. Follow the screenshots below to
create a new project.
Hit the create button and Google should take a few minutes to set up all that is necessary for your newly
created app.
The next step in the process is to fork the app on your local machine. This will allow you to make
changes to the app locally and deploy it whenever you wish to.
Hit the create button, and you should see your app listed on the window that follows. You should also check that
you now see some files in your local storage (the directory you chose in the screenshot above) after this step.
Before you go ahead and make some changes to the app, it is important to check whether or not you
have executed all the above steps correctly. This can be done by simply running the app locally.
Select the app and hit the run button on the window.
Wait for a few seconds until you can hit the Browse button. Once the Browse button becomes clickable,
click it. This should take you to the browser, and you should see the hello world text appear in your
browser window. Alternatively, you can manually go to the browser and use the port specified to access
the app.
Step 6. Understand the app structure
It is finally time to look at the lines of code which are running this webapp. Open your app folder in the
text editor of your choice. I recommend Sublime text or VS Code. However, feel free to choose the one
you prefer.
app.yaml
This file is a basic markup file that stores information (some metadata) about the app. It is important to
note the following crucial parts of the file.
1. application
This is the project ID which you should never change. This is the unique identifier for the app
2. url -> script
This is the homepage for the app. In other words, this file will be rendered in your browser when
you launch the app
3. libraries
This is where you can include external libraries to use within the webapp
main.py
This is the homepage of the app (as discussed above). Note that the hello world text in the browser
window (step 5) is due to the code you see highlighted below.
No hello world app is ever complete without the developer changing the hello world text to something
else just to make sure that everything happening behind the scenes is working as it should.
Go ahead and change the text in the above screenshot to something else.
Save the changes, go to the browser and refresh the page. You should see the page with the text “MEOW”
displayed.
Finally, it is time to deploy your changes to the cloud to make them globally accessible via a URL. Go to the App
Engine launcher, select the app, and hit the Deploy button.
This will ensure your app gets deployed onto Google Cloud. To check whether or not everything worked
just fine, go to the URL below:
https://<yourProjectID>.appspot.com/
You should see the exact same window as above, expect now, it is a URL that is globally accessible.
Step 8. Misc
Congratulations, you’ve finally gotten your first Python webapp deployed on the Google App Engine.
Here are some other points which you may find useful.
1. Jinja 2 is an amazing front end templating library for Python that can do some cool stuff, such as passing
objects form Python to HTML, using for loops, if conditions, and so on directly out of the box
2. Here’s a very useful Udacity course on web development that I have personally found quite resourceful
3. Viewing the logs while running your webapp can be handy to debug and also discover some bugs on the
fly
Result:
Thus the GAE launcher is installed successfully and web application is launched.
EX.No:5 CLOUD SCENARIO USING CLOUD SIM
Date
CloudSim is written in Java. The knowledge you need to use CloudSim is basic Java programming
and some basics about 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 and it is ready to
be used. Please verify whether Java is available on your system.
CloudSimExample1 finished!
Result:
Thus the Cloud Sim is installed and Scheduling Algorithm is executed Successfully.
EX.No:6 TRANSFER THE FILES FROM ONE VIRTUAL
MACHINE TO ANOTHER VIRTUAL MACHINE
Date:
VirtualBox is a program that allows you to run multiple operating systems (guests) on one computer
(the host computer). You may need to transfer files between the host and the guest. It’s easy to set up
in Windows guests, but tricky in Ubuntu guests
Once you’ve installed the guest additions, enable shared folders by adding a folder from your host
machine in the settings for the guest machine. To do this, first make sure the guest machine is
powered off. Then, select the guest machine in the list on the left of the VirtualBox Manager and
click Settings on the toolbar.
On the Settings dialog box, click Shared Folders in the list of options on the left. On the Shared
Folders screen, click the folder button with the plus sign to add a folder.
On the Add Share dialog box, select Other from the Folder Path drop-down list.
The Browse For Folder dialog box displays. Navigate to the folder you want to share between the
host and the guest, select it, and click OK.
The path to the selected folder is inserted in the Folder Path edit box. The name of the folder
automatically becomes the Folder Name, but you can change this name if you want. If you don’t want
to be able to change items in this folder in the guest machine, select the Read-only check box. To
have the selected folder automatically mounted in the guest machine when you boot it, select the
Auto-mount check box. Click OK once you’ve finished choosing your settings for the shared folder.
The selected folder displays in the Folders List. Click OK to close the dialog bo x.
Now, make sure the guest machine is still selected in the VirtualBox Manager and click Start to boot
it.
Once the guest machine is booted, open Nautilus (File Manager) by clicking the file cabinet on the
Unity bar on the left side of the desktop.
In the Devices list on the left, click Computer and then double-click the Media folder on the right.
You’ll see a folder named similarly to the folder you selected to share on your host machine with
“sf_” added to the beginning of the name.
If you double-click on that folder, the following dialog box displays. This is because there is one
more task to perform before you can access the shared folder.
In addition to users in Ubuntu, there are also groups. When VirtualBox installed the Ubuntu operating
system, it added a group called “vboxsf”. Before you can access any shared folders, you must add
yourself to the vboxsf group. To do this, press Ctrl + Alt + T to open a Terminal window. Type the
following at the prompt, replacing “[username]” with your username, and press Enter.
Type your password when prompted and press Enter again. Messages display as you are being added
to the group and “Done.” displays when the process has been successfully completed.
To close the Terminal window, type “exit” (without the quotes) at the prompt and press Enter
To verify you are in the vboxsf group, you can type “id [username]” (without the quotes, and
replacing “[username]” with your username) at the prompt and press Enter. All the groups of which
the specified user is a member display.
Now, when you access the shared folder in the Media folder as described above, you should see any
files in that exist in that folder on the host machine.
You can edit these files directly in this folder if you DID NOT select the “Read-only” option when
selecting the folder in the Settings. You can also copy files into and out of this folder. If the folder
was set to “Read-only”, you can only copy files from this folder and cannot copy files into it.
Result:
Thus the file is successfully transferred from one virtual machine to another.
EX.No:7 LAUNCH VIRTUAL MACHINE USING TRYSTACK
Date
TryStack.org Homepage
I assume that you already join to the Facebook Group and login to the
dashboard. After you log in to the TryStack, you will see the Compute
Dashboard like:
In this post, I will show you how to run an OpenStack instance. The instance will
be accessible through the internet (have a public IP address). The final topology
will like:
Network topology
As you see from the image above, the instance will be connected to a local
network and the local network will be connected to internet.
Network? Yes, the network in here is our own local network. So, your instances
will be not mixed up with the others. You can imagine this as your own LAN
(Local Area Network) in the cloud.
I guess you already know what router is. In the step 1, we created our network,
but it is isolated. It doesn’t connect to the internet. To make our network has an
internet connection, we need a router that running as the gateway to the internet.
Now, you can SSH your instances to the floating IP address that you got in the
step 4. If you are using Ubuntu image, the SSH user will be ubuntu.
Result:
The Virual machine using try stack is launched successfully.
EX.No:8 INSTALL HADOOP SINGLE NODE CLUSTER
Date
Install Hadoop
Step 1: Click here to download the Java 8 Package. Save this file in your home directory.
Step 5: Add the Hadoop and Java paths in the bash file (.bashrc). Open. bashrc file. Now,
Command: vi .bashrc
Fig: Hadoop Installation – Setting Environment Variable
For applying all these changes to the current Terminal, execute the source command.
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
Step 7: Open core-site.xml and edit the property mentioned below inside
configuration tag:
1
<?xml version="1.0" encoding="UTF-8"?>
2 <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
3 <configuration>
4 <property>
5 <name>fs.default.name</name>
6 <value>hdfs://localhost:9000</value>
</property>
7 </configuration>
8
Command: vi hdfs-site.xml
Step 9: Edit the mapred-site.xml file and edit the property mentioned below
1
2 <?xml version="1.0" encoding="UTF-8"?>
3 <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
4 <property>
5 <name>dfs.replication</name>
6 <value>1</value>
7 </property>
8 <property>
<name>dfs.permission</name>
9 <value>false</value>
10 </property>
11 </configuration>
12
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.
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>
8
Step 10: Edit yarn-site.xml and edit the property mentioned below inside
configuration tag:
Command: vi yarn-site.xml
1
2
<?xml version="1.0">
3 <configuration>
4 <property>
5 <name>yarn.nodemanager.aux-services</name>
6 <value>mapreduce_shuffle</value>
</property>
7 <property>
8 <name>yarn.nodemanager.auxservices.mapreduce.shuffle.class</
9 name>
1 <value>org.apache.hadoop.mapred.ShuffleHandler</value>
0 </property>
</configuration>
1
1
Step 11: Edit hadoop-env.sh and add the Java Path as mentioned below:
hadoop-env.sh contains the environment variables that are used in the script
to run Hadoop like Java home path, etc.
Command: vi hadoop–env.sh
Step 12: Go to Hadoop home directory and format the NameNode.
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.
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
The above command is a combination of start-dfs.sh, start-yarn.sh & mr-
jobhistory- daemon.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.
On startup, a DataNode connects to the Namenode and it responds to the requests from the
Namenode for different operations.
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:
The Hadoop is successfully installed on a single node cluster.
EX.NO:
DATE Develop a new Web Service for Calculator
Aim:
To develop a new Web Service for Calculator using Globus toolkit.
Algorithm
MathService.java:
package gt3tutorial.core.first.impl;
import org.globus.ogsa.impl.ogsi.GridServiceImpl;import
gt3tutorial.core.first.Math.MathPortType; import
java.rmi.RemoteException;
public class MathImpl extends GridServiceImpl implements MathPortType
{
public MathImpl()
{
super("Simple Math Service");
}
public int add(int a, int b) throws
RemoteException
{
return a + b;
}
public int subtract(int a, int b) throws
RemoteException
{
return a - b;
}
public int multiply(int a, int b) throws
RemoteException
{
return a * b;
}
public float divide(int a, int b) throwsRemoteException
{
return a / b;
}}
OUTPUT:
Result:
Thus the Web Service for Calculator is developed using Globus Toolkit successfully.
EX.NO:
DATE Develop new OGSA-compliant Web Service.
Aim:
To develop new OGSA-compliant Web Service.
Procedure:
Choose New Project from the main menu.
Select POM Project from the Maven category.
<packaging>pom</packaging>
<properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties></project>
Modify the parent pom.xml to add the following elements. Save your changes.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven- 4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>MavenOSGiCDIProject</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement><dependencies><dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.2.0</version>
<scope>provided</scope>
</dependency></dependencies></dependencyManagement></project>
The maven-bundle-plugin handles the generation of the MANIFEST.MF file
when you build the project. If you open the MANIFEST.MF file in the compiled JAR you
will see that the plugin generated a manifest header that declares the export packages. For
OSGi, all bundles that you want to be exposed and available to other bundles must be listed
in the Export-Package element in MANIFEST.MF.
Confirm that the MANIFEST.MF contains the Export-Package element (the element shown in
bold in the example below).
Manifest-Version: 1.0
Bnd-LastModified: 1395049732676
Build-Jdk: 1.7.0_45
Built-By: nb
Bundle-Activator: com.mycompany.mavenhelloserviceapi.Activator
Bundle-ManifestVersion: 2
Bundle-Name: MavenHelloServiceApi OSGi Bundle
Bundle-SymbolicName: com.mycompany.MavenHelloServiceApi
Bundle-Version: 1.0.0.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Export-Package:
com.mycompany.mavenhelloserviceapi;uses:="org.osgi.frame
work";version="1.0.0.SNAPSHOT"
Import-Package: org.osgi.framework;version="[1.6,2)"
Tool: Bnd-1.50.0
The OSGi container will read the Export-Package manifest header to
determine the classes in the bundle that can be accessed from outside the bundle. In this
example, the classes in the com.mycompany.mavenhelloserviceapi package are exposed.
Note. If the MANIFEST.MF does not contain the Export-Package element,
you will need to enable the default plugin behavior for the plugin in the Project Properties
window and rebuild the project. In the Project Properties window, select the Export
Packages category and select the Default maven-bundle-plugin behavior option. You
can use the Export Packages panel of the Project Properties window to explicitly specify
the packages that should be exposed or specify the packages directly in pom.xml.
Creating the MavenHelloServiceImpl Implementation Bundle
In this exercise you will create the MavenHelloServiceImpl in the POM
project.
Choose File > New Project to open the New Project wizard.
Choose OSGi Bundle from the Maven category. Click Next.
Type MavenHelloServiceImpl for the Project Name.
Click Browse and select the MavenOSGiCDIProject POM project as the Location
(if not selected). Click Finish.
Right-click the project node in the Projects window and choose Properties.
Select the Sources category in the Project Properties dialog box.
Set the Source/Binary Format to 1.6 and confirm that the Encoding is UTF-8. Click OK.
Right-click Source Packages node in the Projects window and choose New > Java Class.
Type HelloImpl for the Class Name.
Select com.mycompany.mavenhelloserviceimpl as the Package. Click Finish.
Type the following (in bold) and save your changes.
public class HelloImpl implements Hello {
public String sayHello(String name) { return "Hello " + name; }}
When you implement Hello, the IDE will display an error that you need to
resolve by adding the MavenHelloServiceApi project as a dependency.
Right-click the Dependencies node of MavenHelloServiceImpl in the Projects
window and choose Add Dependency.
Click the Open Projects tab in the Add Library dialog.
Select MavenHelloServiceApi OSGi Bundle. Click Add.
Right-click in the HelloImpl.java class that is open in the editor and choose Fix
Imports (Alt-Shift- I; □-Shift-I on Mac) to add an import statement for
com.mycompany.mavenhelloserviceapi.Hello. Save your changes.
Expand the com.mycompany.mavenhelloserviceimpl package and double-click Activator.java
to open the file in the editor.
The IDE automatically created the Activator.java bundle activator class in your
project. A bundle activator is used to manage the lifecycle of a bundle. The bundle activator
class is declared in the MANIFEST.MF of the bundle and instantiated when the bundle is
started by the container.
An OSGi bundle does not require a bundle activator class, but you can use the
start() method in the activator class, for example, to initialize services or other resources that
are required by the bundle. In this exercise you will add some lines of code to the class that
will print messages to the Output window. This will make it easier for you to identify when
the bundle starts and stops.
Modify the start() and stop() methods in the bundle activator class to add the
following lines (in bold).
public class Activator implements BundleActivator {
INFO: HelloActivator::start
INFO: HelloActivator::registration of Hello service successful
INFO: Started bundle: file:/glassfish-
4.0/glassfish/domains/domain1/autodeploy/bundles/MavenHelloServiceImp
l-1.0- SNAPSHOT.jar
INFO: Started bundle: file:/glassfish-
4.0/glassfish/domains/domain1/autodeploy/bundles/MavenHelloServiceImp
l-1.0- SNAPSHOT.jar
Result
Thus the OGSA-compliant Web Service using Globus Toolkit is developed successfully.
EX.NO: Using Apache Axis develop a Grid Service
DATE
Aim:
Algorithum:
Create a new project
start by creating a new Java Project called ProvisionDirService.SelectFile > New > Project...and select Java >
Java Project from the selection wizard. Click Next and enter ProvisionDirService in the Project Name textbox.
Accept the remaining project creation defaults by clicking Finish.
Go to
Window > Preferences
and select the
Tomcat > Source Path
Select the checkbox next to our
ProvisionDirService
project
Result
Thus the Apache Axis webserver to develop a Grid Service using Globus Toolkit is
developedsuccessfully.