CCSM New LabManual1
CCSM New LabManual1
LAB MANUAL
OBJECTIVES:
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:
TOTAL: 45 PERIODS
Aim:
Find procedure to Install Virtualbox/VMware Workstation with different flavours 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.
Screenshot for VMware Workstation 15 pro installation begin confirmation dialog box on windows 10.
Below screenshot shows Installation in progress. Wait for this to complete.
CLICK
MAC PC
MAC PC
MAC PC
MAC PC
MAC PC
main()
{
printf("Hello World\n");
}
Download
the
Windows
installer
–
the
simplest
thing
is
to
download
it
to
your
Desktop
or
another
folder
that
you
remember.
Click
through
the
installation
wizard,
and
it
should
install
the
App
Engine.
If
you
do
not
have
Python
2.5,
it
will
install
Python
2.5
as
well.
Once
the
install
is
complete
you
can
discard
the
downloaded
installer
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
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.
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.
Watching
the
Log
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:
To
get
more
detail
on
what
is
going
wrong,
take
a
look
at
the
log
for
the
application:
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.
Vm vm = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new
CloudletSchedulerTimeShared())
9. Submit the VM list to the broker:
broker.submitVmList(vmlist)
10. Create a cloudlet with length, file size, output size, and utilisation model:
Cloudlet cloudlet = new Cloudlet(id, length, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel
11. Submit the cloudlet list to the broker:
broker.submitCloudletList(cloudletList)
12. Start the simulation:
CloudSim.startSimulation()
CloudSimExample1 finished!
• 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.
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
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? 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.
OpenStack has a feature like a firewall. It can whitelist/blacklist your in/out connection. It is
called Security Group.
1. Go to Compute > Access & Security and then open Security Groups tab.
2. In default row, click Manage Rules.
3. Click Add Rule, choose ALL ICMP rule to enable ping into your instance, and then click Add.
4. Click Add Rule, choose HTTP rule to open HTTP port (port 80), and then click Add.
5. Click Add Rule, choose SSH rule to open SSH port (port 22), and then click Add.
6. You can open other ports by creating new rules.
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.
Step 5: Add the Hadoop and Java paths in the bash file (.bashrc).
Open. bashrc file. Now, add Hadoop and Java Path as shown below.
Command: vi .bashrc
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/
Instructor-led Sessions
Real-life Case Studies
Assessments
Lifetime Access
Explore Curriculum
Command: ls
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
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>
<value>hdfs://localhost:9000</value>
6
</property>
7 </configuration>
8
Step 8: Edit hdfs-site.xml and edit the property mentioned below inside
configuration tag:
This PDF document was edited with Icecream PDF Editor.
Upgrade to PRO to remove watermark.
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.
Command: vi hdfs-site.xml
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>
<property>
8
<name>dfs.permission</name>
9 <value>false</value>
10 </property>
11 </configuration>
12
Step 9: Edit the mapred-site.xml file 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.
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>
<value>yarn</value>
6
</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>
</property>
0 </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
Command: cd
This PDF document was edited with Icecream PDF Editor.
Upgrade to PRO to remove watermark.
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
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 DataNode:
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.
LIST OF EXPERIMENTS:
1. Develop a new Web Service for Calculator.
2. Develop new OGSA-compliant Web Service.
3. Using Apache Axis develop a Grid Service.
4. Develop applications using Java or C/C++ Grid APIs
OBJECTIVE:
To develop a new Web service for Calculator applications.
PROCEDURE:
When you start Globus toolkit container, there will be number of services starts up. The service
for this task will be a simple Math service that can perform basic arithmetic for a client.
It is possible to start with this interface and create the necessary WSDL file using the standard
Web service tool called Java2WSDL. However, the WSDL file for GT 4 has to include details
of resource properties that are not given explicitly in the interface above. Hence, we will provide
the WSDL file.
GT4services\org\globus\examples\services\core\first\impl\MathService.java.
Deployment Descriptor -- The deployment descriptor gives several different important sets of
information about the service once it is deployed. It is located within the GT4services folder
at:
GT4services\org\globus\examples\services\core\first\deploy-server.wsdd.
When the client is run from the command line, you pass it one argument. The argument is the
URL that specifies where the service resides. The client will create the end point rerference and
incorporate this URL as the address. The end point reference is then used with the
This PDF document was edited with Icecream PDF Editor.
getMathPortTypePort
Upgrade to PRO to remove watermark. method of a MathServiceAdressingLocator object to obtain a
reference to the Math interface (portType). Then, we can apply the methods available in the
service as though they were local methods Notice that the call to the service (add and subtract
method calls) must be in a “try {} catch(){}” block because a “RemoteException” may be
thrown. The code for the “MathServiceAddressingLocator” is created during the build
process. (Thus you don’t have to write it!)
globus-undeploy-gar org_globus_examples_services_core_first
which should result with the following output:
Undeploying gar...
Deleting /.
.
.
Undeploy successful
This PDF document was edited with Icecream PDF Editor.
6 Adding
Upgrade to PRO to Functionality to the Math Service
remove watermark.
In this final task, you are asked to modify the Math service and associated files so the srvice
supports the multiplication operation. To do this task, you will need to modify:
MathService.java)
Math.wsdl)
The exact changes that are necessary are not given. You are to work them out yourself. You
will need to fully understand the contents of service code and WSDL files and then modify them
accordingly. Appendix A gives an explanation of the important parts of these files. Keep all file
names the same and simply redeploy the service afterwards. You will also need to add a code
to the client code (Client.java) to test the modified service to include multiplication.
Result:
Thus the Develop a new Web Service for Calculator was executed successfully.
OBJECTIVE:
PROCEDURE:
Writing and deploying a WSRF Web Service is easier than you might think. You just have to
follow five simple steps
To run this program, as a minimum you will be required to have installed the following
prerequisite software
a. Download the latest Axis2 runtime from the above link and extract it. Now we
point Eclipse WTP to downloaded Axis2 Runtime. Open Window -> Preferences
-> Web Services -> Axis2 Emitter
Select the Axis2 Runtime tab and point to the correct Axis2 runtime location.
Alternatively at the Axis2 Preference tab, you can set the default setting that will
come up on the Web Services Creation wizards. For the moment we will accept
the default settings.
b. Click OK.
Click next
d. Select the name Axis2WSTest as the Dynamic Web project name (you can specify
any name you prefer), and select the configured Tomcat runtime as the target
runtime.
Click next.
e. Select the Axis2 Web service facet
Click Finish.
g. Import the wtp/Converter.java class into Axis2WSTest/src (be sure to preserve the
package).
Click next.
i. The Web service wizard would be brought up with Web service type set to
Bottom up Java bean Web Service with the service implementation
automatically filled in. Move the service scale to Start service.
Click OK.
k. Ensure that the correct server and service project are selected as displayed below.
Click next.
l. This page is the service.xml selection page. if you have a custom services.xml,
This PDF document was editedyou
with can
Icecream PDFthat
include Editor.
by clicking
the Browse button. For the moment, just leave it
Upgrade to PRO to remove watermark.
at the default.
Click next.
m. This page is the Start Server page. It will be displayed if the server has not been
started. Click on the Start Server button. This will start the server runtime.
Click next.
Click Finish.
o. Now, select the Axis2WSTest dynamic Web project, right-click and select Run ->
Run As -> Run on Server to bring up the Axis2 servlet.
Click Next.
Click Finish.
q. This will deploy the Axis2 server webapp on the configured servlet container and
will display the Axis2 home page. Note that the servlet container will start up
according to the Server configuration files on your workspace.
r. Click on the Services link to view the available services. The newly created
converter Web service will be shown there.
t. Now we'll generate the client for the newly created service by referring the ?wsdl
generated by the Axis2 Server. Open File -> New -> Other... -> Web Services ->
Web ServiceClient
Back on the Web Services Client wizard, make sure the Web service runtime is set
to Axis2 and the server is set correctly. Click Next.
The Clients stubs will be generated to your Dynamic Web project Axis2WSTestClient.
Now we are going to write Java main program to invoke the client stub. Import the
ConverterClient.java file to the workspace into the wtp package in the src folder of
This PDF document was edited with Icecream PDF Editor.
Axis2WSTestClient.
Upgrade to PRO to remove watermark.
Then select the ConverterClient file, right-click and select Run As -> Java Application.
Here's what you get on the server console:
Another way to test and invoke the service is to select Generate test case to test the
service check box on the Axis2 Client Web Service Configuration Page when going
If that option is selected, the Axis2 emitter will generate JUnit testcases matching the
WSDL we provide to the client. These JUnit testcases will be generated to a newly added
source directory to the Axis2WSTestClient project called test.
Next thing we need to do is to insert the test case with the valid inputs as the Web
service method arguments. In this case, let's test the
ConverterConverterSOAP11Port_httpTest.java by provide values for Celsius and
Farenheit for the temperature conversion. As an example, replace the generated
TODO statement in each test method to fill in the data with values as:
This PDF document was edited with Icecream PDF Editor.
testfarenheitToCelsius() -> farenheitToCelsius8.setFarenheit(212);
Upgrade to PRO to remove watermark.
testStartfarenheitToCelsius() -
>farenheitToCelsius8.setFarenheit(212);
testcelsiusToFarenheit() -> celsiusToFarenheit10.setCelsius(100);
testStartcelsiusToFarenheit() ->
celsiusToFarenheit10.setCelsius(100);
Here the testcases were generated to test both the synchronous and asynchronous
clients.
w. After that, select the testcase, right-click, select Run As -> JUnit Test. You will be
able to run the unit test successfully invoking the Web service.
You can choose Web Services -> Test with Web Services Explorer to test the
service.
You can choose Web Services -> Publish WSDL file to publish the service to a
public UDDI registry.
RESULT:
Thus the development of a new OGSA-compliant web service was executed successfully.
OBJECTIVE:
PROCEDURE:
You will need to download and install the following software:
1. Java 2 SDK v1.4.1, http://java.sun.com/j2se/1.4.1/download.html
2. Apache Tomcat v4.124
http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.1.24/bin/jakarta
tomcat4.1.24.exe.
3. XML Security v1.0.4,
http://www.apache.org/dist/xml/security/java-library/xmlsecurity bin1.0.4.zip
4. Axis v1.1, http://ws.apache.org/axis/dist/1_1/axis-1_1.zip
1. Java 2 SDK
• Run the downloaded executable (j2sdk-1_4_1-windows-i586.exe) which will install
the
• SDK in C:\j2sdk1.4.1. Set the JAVA_HOME environment variable to point to this
directory as follows:
• Click on START->CONTROL PANEL->SYSTEM
• Click on the Advanced tab
• Click on the Environment Variables button
• Click on the New… button in the user variable section and enter the details
• Add the Java binaries to your PATH variable in the same way by setting a user
variable called PATH with the value “%PATH%;C:\j2sdk1.4.1\bin”
2. Apache Tomcat
3. XML Security
• Download and unzip
http://www.apache.org/dist/xml/security/javalibrary/xmlsecurity-bin
This PDF document was edited with Icecream PDF Editor. 1_0_4.zip
• Copy xml-sec.jar
Upgrade to PRO to remove watermark. to C:\axis-1_1\lib\
• Set-up your CLASSPATH environment variable to including the following:
C:\axis1_1\lib\xml-sec.jar;
4. Apache Axis
• Unzip the downloaded Axis archive to C: (this will create a directory C:\axis-1_1).
• Extract the file xmlsec.jar from the downloaded security archive to
C:\axis1_1\webapps\axis\WEB-INF\lib.
• Set-up your CLASSPATH environment variable to including the following:
o The current working directory
o All the AXIS jar files as found in C:\axis-1_1\lib
C:\jakarta-tomcat-4.1.24\common\lib\servlet.jar
• Your CLASSPATH should therefore look something like:
C:\axis-1_1\lib\axis.jar;
C:\axis 1_1\lib\axis-ant.jar;
C:\axis-1_1\lib\commons-discovery.jar;
C:\axis-1_1\lib\commons-logging.jar;
C:\axis-1_1\lib\jaxrpc.jar;
C:\axis-1_1\lib\log4j-1.2.8.jar;
C:\axis-1_1\lib\saaj.jar;
C:\axis-1_1\lib\wsdl4j.jar;
C:\axis-1_1\lib\xercesImpl.jar
C:\axis-1_1\lib\xmlParserAPIs.jar;
C:\jakarta-tomcat-4.1.24\common\lib\servlet.jar
C:\axis-1_1\lib\xml-sec.jar;
• Now tell Tomcat about your Axis web application by creating the file
C:\jakarta- tomcat-4.1.24\webapps\axis.xml with the following content:
<Context path="/axis" docBase="C:\axis-1_1\webapps\axis" debug="0"
privileged="true">
<LoggerclassName="org.apache.catalina.logger.FileLogger"prefix="axis_log."
suffix=".txt" timestamp="false"/>
Deploy one of the sample Web Services to test the system and to create the C:\axis-
1_1\webapps\axis\WEB-INF\server-config.wsdd file. From C:\axis-1_1 issue the
command (on one line):
java org.apache.axis.client.AdminClient
http://localhost:8080/axis/services/AdminService/samples/stock/deploy.wsdd
This should return the following:
.- Processing file samples/stock/deploy.wsdd
.- <Admin>Done processing</Admin>
RESULT:
Thus the development of a Grid Service using Apache Axis is executed successfully.
This PDF document was edited with Icecream PDF Editor.
Upgrade to PRO to remove watermark.
4. Develop applications using Java or C/C++ Grid APIs
OBJECTIVE:
To develop an applications using Java or C/C++ Grid APIs.
SAMPLE CODE:
import AgentTeamwork.Ateam.*;
import MPJ.*;
public class UserProgAteam extends AteamProg {
private int phase;
public UserProgAteam( Ateam o )
{}
public UserProgAteam( )
{}
// real const
public UserProgAteam( String[] args ) {
phase = 0;
}
// phase recovery
private void userRecovery( ) {
phase = ateam.getSnapshotId( );
}
private void compute( ) {
for ( phase = 0; phase < 10; phase++ ) {
try {
Thread.currentThread( ).sleep( 1000 );
}
catch(InterruptedException e ) {
}
ateam.takeSnapshot( phase );
System.out.println( "UserProgAteam at rank " + MPJ.COMM_WORLD.Rank( ) + " : took a
snapshot " + phase );
}
}
public static void main( String[] args ) {
System.out.println( "UserProgAteam: got started" );
MPJ.Init( args, ateam);
UserProgAteam program = null;
// Timer timer = new Timer( );
if ( ateam.isResumed( ) ) {
program = ( UserProgAteam )
ateam.retrieveLocalVar( "program" );
program.userRecovery( );
}
else
{
program = new UserProgAteam( args );
ateam.registerLocalVar( "program", program );
}
program.compute( );
MPJ.Finalize(
This PDF document was edited with);
Icecream PDF Editor.
}
Upgrade to PRO to remove watermark.
public class UserProgAteam extends AteamProg {
// application body private void compute( ) {
for ( phase = 0; phase < 10; phase++ ) {
try {
Thread.currentThread( ).sleep( 1000 );
}
catch(InterruptedException e ) {
}
ateam.takeSnapshot( phase );
System.out.println ( "UserProgAteam at rank " + MPJ.COMM_WORLD.Rank( ) + " : took a snapshot
" + phase );
}}
RESULT:
Thus the development of applications using Java or C/C++ Grid APIs is executed successfully
VIVA QUESTIONS
2) Mention platforms which are used for large scale cloud computing?
13) Before going for cloud computing platform what are the essential things to be taken in
concern by users?
15) What are the security laws which are implemented to secure data in a cloud ?
16) Mention the name of some large cloud providers and databases?
20) What are the different data centers deployed for cloud computing?
27) Which are the companies suporting, working, and doing researching on the Grid ?
28) Which are the Academic Institutions interested and doing research on Grid ?
29) What are the terminologies that different companies use for the same term "Grid" ?
30) What are the different types of computing on the Grid ? (HPC , HTC )
32) Why do we need Grid ? What are the applications of the Grid that one can explain to a
naive person ?
39) What are Grid Test beds ? Who started it ? Who made it ?
40) Which are the existing Grid Test Beds in the world ?