0% found this document useful (0 votes)
4 views66 pages

CC Lab Manual

The document outlines the procedures for installing VirtualBox/VMware Workstation, a C compiler, and Google App Engine on Windows, along with creating and deploying applications. It includes step-by-step instructions for downloading, installing, and configuring each software, as well as running sample programs and web applications. Additionally, it describes setting up a CloudSim simulation environment for cloud scenario simulation and scheduling algorithm implementation.
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)
4 views66 pages

CC Lab Manual

The document outlines the procedures for installing VirtualBox/VMware Workstation, a C compiler, and Google App Engine on Windows, along with creating and deploying applications. It includes step-by-step instructions for downloading, installing, and configuring each software, as well as running sample programs and web applications. Additionally, it describes setting up a CloudSim simulation environment for cloud scenario simulation and scheduling algorithm implementation.
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

EX.

No:1 Install VirtualBox/VMware Workstation

Aim:

Find procedure to Install VirtualBox/VMware Workstation with different flavours of


Linux or windows OS on top of windows7 or 8.

This experiment is to be performed through portal.

PROCEDURE TO INSTALL
1- Download Link
Link for downloading the software is [Link]
pro/workstation- [Link]. Download the software for windows. Good thing is that
there is no signupprocess. Click and download begins. Software is around 541 MB.

2- Download the installer file


It should probably be in the download folder by default, if you have not changed the settings in
your browser. File name should be something like [Link].
This file name can change depending on the version of the software currently available for
download. But for now, till the next version is available, they will all be VMware Workstation 15
Pro.

3- Locate the downloaded installer file


For demonstration purpose, I have placed the downloaded installer on my desktop. Find the
installer on your system and double click to launch the application.

4- User Access Control (UAC) Warning


Now you should see User Access Control (UAC) dialog box. Click yes to continue.
VMware Workstation 12 Pro installer windows 10 UAC screenshot

Initial Splash screen will appear. Wait for the process to complete.

5- VMware Workstation Setup wizard

Now you will see VMware Workstation setup wizard dialog box. Click next to continue.
6- End User Licence Agreement

This time you should see End User Licence Agreement dialog box. Check “I accept the terms in the
Licence Agreement” box and press next to continue.

7- Custom Setup options

Select the folder in which you would like to install the application. There is no harm in leaving the
defaults as it is. Also select Enhanced Keyboard Driver check box.
8- User Experience Settings

Next you are asked to select “Check for Updates” and “Help improve VMware Workstation Pro”. Do
as
you wish. I normally leave it to defaults that is unchecked.

VMware Workstation 15 Installation – User Experience Settings


9- Application Shortcuts preference

Next step is to select the place you want the shortcut icons to be placed on your system to launch
the application. Please select both the options, desktop and start menu and click next.
VMware workstation 15 pro installation shortcut selection checkbox screenshot.
10- Installation begins

Now you see the begin installation dialog box. Click install to start the installation process.

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.


At the end you will see installation complete dialog box. Click finish and you are done with the
installation process. You may be asked to restart your computer. Click on Yes to restart.

VMware Workstation 15 Installation – Installation Complete


11- Launch VMware Workstation

After the installation completes, you should see VMware Workstation icon on the desktop. Double
click on it to launch the application.
Screenshot for VMware Workstation 15 Pro icon on windows 10 desktop.

12- Licence Key

If you see the dialog box asking for licence key, click on trial or enter the licence key.
Then what you have is the VMware Workstation 15 Pro running on your windows 10
desktop. If don’t have the licence key, you will have 30 days trial.

VMware Workstation 15 Pro home screen


13- At some point if you decide to buy
At some point of time if you decide to buy the License key, you can enter the License
key by going to Help->Enter a License Key

You can enter the 25-character license key in the dialog box shown below and click OK.
Now you have the license version of the software.

RESULT:
Thus the procedure to run the virtual machine of different configuration.
EX NO: 2 Install a C compiler in the virtual machine and execute a sample program

Aim:

To Install a C compiler in the Virtual machine and execute a sample program

Procedure:

Step 1: Installation of GCC compiler

1. Yum install gcc

(GCC will be installed from the local repository. After completion of gcc
compiler,ready to run the C program)

Ø To run the C program


Ø Open the terminal
Ø Execute the c program

2. vi programname.c (for opening the program)

3. Press esc:wq (saving the program


4. cc programname.c (for compiling the program)
5 ./[Link] (to see the output)

Result:

Thus, the image(gcc) has been created and the C program has been compiled successfully.
Ex. No. 3 Install Google App Engine

Aim:

Install Google App Engine. Create hello world app and other simple web applications using
python/java

This document describes the installation of the Google App Engine Software
Development Kit (SDK) on a Microsoft Windows andrunninga simple “helloworld”
application.

The App Engine SDK allows you torun Google App Engine Applications on your local
computer. It simulates the run---time environment of the Google App Engine
infrastructure.

Pre--Requisites: Python 2.5.4

Ifyoudon'talreadyhavePython2.5.4installedinyourcomputer,downloadand
Install Python 2.5.4 from:

[Link]

Download and Install

You can download the Google App Engine SDK by going to:

[Link]

and download the appropriate install package.

Downloadthe Windows installer –the simplest thing istodownload ittoyour


Desktop or another folder that you remember.
Double Click on the GoogleApplicationEngine installer.

Clickthroughtheinstallationwizard,anditshouldinstalltheAppEngine. Ifyoudo not


have Python 2.5, itwill install Python 2.5 aswell.

Once the install is complete you can discard the downloaded installer
MakingyourFirstApplication

1. Now you need tocreateasimpleapplication. Wecould use the“+”option to


have the launcher make us an application –but instead we will doitbyhand to
get a better sense of what is going on.

Makeafolder for your GoogleAppEngine applications. Iam going to make the


Folder on my Desktop called“apps”– thepathtothisfolderis:

C:\Documents andSettings\csev\Desktop\apps

And then make a sub---folder in within apps called “ae--01--trivial” – the path to this
folder wouldbe:

C:\ Documents and Settings \csev\Desktop\apps\ae--01--trivial

Using a text editor such as JEdit ([Link]), create a file called [Link] in the
ae--01--trivial folder with the following contents:

application: ae-01-trivial
version: 1
runtime: python
api_version: 1

handlers:
- url: /.*
script: [Link]

Note:Pleasedonotcopyandpastetheselinesintoyourtexteditor–youmightend up
with strangecharacters – simply type them intoyour editor.

Then create a file in the ae--01--trivial folder called [Link] 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,selectitsothatyoucancontroltheapplicationusingthelauncher.
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 [Link]

Paste [Link] into your browser and you should see your
application asfollows:

Justforfun,[Link]“Chuck”toyourownnameand press
Refresh in thebrowser to verify your updates.

Watching the Log

You can watch the internal log of the actions that the webserver isperforming when
youareinteractingwithyour application in thebrowser. Selectyourapplicationin the
Launcher andpress the Logs button tobring up a log window:
Eachtime youpress Refresh in yourbrowser– you can see it retrieving theoutput
with a GET request.

Dealing With Errors

With two files to edit, there are two general categories of errors that you may
encounter. Ifyoumakeamistakeonthe [Link] file, theAppEnginewill not start and
your launcherwill show ayellow icon near your application:

To get more detail on what is going wrong; take a look at the log for the application:

5
In this instance – the mistake is mis---indenting the last line in the [Link] (line 8).

If you make a syntax error in the [Link] file, a Python trace back error will appear in
yourbrowser.

Theerroryouneedtoseeislikelytobethelastfewlinesoftheoutput–inthiscase I made
a Python syntax error on line one of our one---line application.

Reference: [Link]

When you make a mistake in the [Link] file – you must the fix the mistake and
attempt to start the application again.
If you make a mistake in a file like [Link], you can simply fix the file and press
refreshinyour browser – thereisnoneed torestart theserver.

Shutting Down the Server

To shut down the server, use the Launcher, select your application and press the
Stop button.

This material is Copyright All Rights Reserved – Charles Severance

Comments and questions to csev@[Link] [Link]

Result:

Thus, the Google App Engine is installed and the ‘hello world’ app and other simple web
applications using python/java has been compiled successfully.
EX NO 4: Use GAE launcher to launch the web applications.

AIM:

To use GAE launcher to launch the web applications

Procedure:
You can use Google App Engine to host a static website.
Static web pages can contain client-side technologies such as HTML, CSS, and JavaScript.
Hosting your static site on App Engine can cost less than using a traditional hosting provider,
as App Engine provides a free tier.
Sites hosted on App Engine are hosted on the REGION_ID.[Link] sub domain,
Such as [my-project-id].[Link].
After you deploy your site, you can map your own domain name to your App Engine-hosted website

Before you begin

Before you can host your website on Google App Engine:

1. Create a new Cloud Console project or retrieve the project ID of an existing project to use:
Goto the Project page

2. Install and then initialize the Google Cloud SDK: Google Cloud CLI:

Download the SDK

Creating a website to host on Google App Engine


Basic structure for the projectThis guide uses the following structure for the project:

[Link]:
Configure the settings of your App Engine application

 www/: Directory to store all of your static files, such as HTML, CSS, images, and JavaScript.

 css/: Directory to store stylesheets.

 [Link]: Basic stylesheet that formats the look and feel of your site.

 images/: Optional directory to store images.

 [Link]: An HTML file that displays content for your website.

 js/: Optional directory to store JavaScript files.

 Other asset directories.

Creating the [Link] file


The [Link] file is a configuration file that tells App Engine how to map URLs to your static files. In the
following steps, you will add handlers that will load www/[Link] when someone visits your website,

and all static files will be stored in and called from the www directory.

Create the [Link] file in your application's root directory:

1. Create a directory that has the same name as your project ID. You can find your

project ID in the Console.

2. In directory that you just created, create a file named [Link].

3. Edit the [Link] file and add the following code to the file:

runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /
static_files: www/[Link]
upload: www/[Link]

- url: /(.*)
static_files: www/\1
upload: www/(.*)
More reference information about the [Link] file can be found in the [Link]

Creating the [Link] file

Create an HTML file that will be served when someone navigates to the root page of your website.

Store this file in your www directory.

<html>
<head>
<title>Hello, world!</title>
<link rel="stylesheet" type="text/css" href="/css/[Link]">
</head>
<body>
<h1>Hello, world!</h1>
<p>
This is a simple static HTML file that will be served from Google App
Engine.
</p>
</body>
</html>
Deploying your application to App Engine

When you deploy your application files, your website will be uploaded to App Engine.

To deploy your app, run the following command from within the root directory of your application

where the [Link] file is located:

gcloud app deploy

Optional flags:

 Include the --project flag to specify an alternate console project ID to what you initialized as the default

 in the gcloud CLI. Example: --project [YOUR_PROJECT_ID]

 Include the -v flag to specify a version ID, otherwise one is generated for you.

Example: -v [YOUR_VERSION_ID]

Viewing your application

To launch your browser and view the app at [Link]

run the following command:

gcloud app browse

Result:

Thus, the Google App Engine is used to launch the web applications successfully.
EX NO 5: Simulate a Cloud Scenario using CloudSim and
Run a scheduling algorithm that is not present in CloudSim.

Aim:
To Simulate a Cloud Scenario using CloudSim and Run a scheduling algorithm that is
not present in CloudSim.

Procedure:
1. To start working with 'CloudSim simulation toolkit' requires it to first configured
Correctly.
2. Before you start to setup CloudSim, following resources must be Installed/downloaded
on the local System Cloudsim simulation toolkit setup is easy. Before you start to setup CloudSim,
following resources must be Installed/downloaded on the local system.
 Java Development Kit(JDK): As the Cloudsim simulation toolkit is a class library written in the
 Java programming language, therefore, the latest version of Java(JDK) should be installed on
your machine, which can be downloaded from Oracles Java portal. For assistance in the
installation process, detailed documentation is provided by Oracle itself and you may follow
the installation instructions
 Eclipse IDE for Java developers: As per your current installed operating system(Linux/
Windows). Before you download to make sure to check if 32-bit or 64-bit version is applicable to
your Computer machine. Link for Eclipse Kepler version is available at the following link
 Download CloudSim source code: To date, various versions of CloudSim are released the
latest version is 5.0, which is based on a container-based engine. Whereas to keep the setup
simple for beginners we will be setting up the most used version i.e. 3.0.3, which can be
directly downloaded by clicking on any of the following: Click for Windows or click for Linux.
 One external requirement of Cloudsim i.e. common jar package of math-related functions
is to be downloaded from the Apache website or you may directly download by clicking here.

 Unzip Eclipse, Cloudsim and Common Math libraries to some common folder.

3. To install cloud sim First of all, navigate to the folder where you have
unzipped the eclipse folder and open [Link]
4. Now within Eclipse window navigate the menu: File -> New -> Project, to open the new project
wizard

5. A ‘New Project‘ wizard should open. There are a number of options displayed and you have to
find & select the ‘Java Project‘ option, once done click ‘Next‘.
6. Now a detailed new project window will open, here you will provide the project name and the
path of CloudSim project source code, which will be done as follows:

 Project Name: CloudSim.


7. Unselect the ‘Use default location’ option and then click on ‘Browse’ to open the path
where you have unzipped the Cloudsim project and finally click Next to set project settings.
8. Make sure you navigate the path till you can see the bin, docs, examples etc folder in the
navigation plane.
9. Once done finally, click ‘Next’ to go to the next step i.e. setting up of project settings.
10. Now open ‘Libraries’ tab and if you do not find [Link] (here ‘x’ means the
minor version release of the library which could be 2 or greater) in the list then simply click on ‘Add
External Jar’ ([Link] will be included in the project from this step)

11. Once you have clicked on ‘Add External JAR’s‘ Open the path where you have unzipped the
commons-math binaries and select ‘[Link]’ and click on open.
12. Ensure external jar that you opened in the previous step is displayed in the list and then click
on ‘Finish’ (your system may take 2-3 minutes to configure the project)

13. Once the project is configured you can open the ‘Project Explorer‘ and start exploring the
Cloudsim project. Also for the first time eclipse automatically start building the workspace for
newly configured Cloudsim project, which may take some time depending on the configuration of
the computer system.
14. Following is the final screen which you will see after Cloudsim is configured.

15. Now just to check you within the ‘Project Explorer‘, you should navigate to the ‘examples‘
folder, then expand the package ‘[Link]‘ and double click to open the
‘[Link]‘.
16. Now navigate to the Eclipse menu ‘Run -> Run‘ or directly use a keyboard shortcut ‘Ctrl +
F11’ to execute the ‘[Link]‘.
17. if it is successfully executed it should be displaying the following type to output in the console
window of the Eclipse IDE.

Result
Now successfully setup/Installed the CloudSim Simulation Toolkit on your computer machine and you
are ready to start with the experimentation.
EX. NO 6: Find a Procedure to Transfer the files from one Virtual Machine
To Another Virtual Machine

AIM

To find a procedure to transfer the files from one virtual machine to 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 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.
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!

RESULT

Thus, the procedure to transfer the files from one virtual machine to another virtual
machine was completed successfully.
Ex no. 7 Install Hadoop Single Node Cluster and Run Simple Applications like Word Count

Aim: To Install Hadoop Single Node Cluster and Run Simple Applications like word count

PROCEDURE:

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 [Link]

Fig: Hadoop Installation – Extracting Java Files

Step 3: Download the Hadoop 2.7.3 Package.

Command: wget [Link]


2.7.3/hadoop- [Link]

Fig: Hadoop Installation – Downloading Hadoop

Step 4: Extract the Hadoop tar File.

Command: tar -xvf [Link]

Fig: Hadoop Installation – Extracting Hadoop Files 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

Fig: Hadoop Installation – Setting Environment Variable

Then, save the bash file and close it.

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

Command: source .bashrc

Fig: Hadoop Installation – Refreshing environment variables

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: java -version


Fig: Hadoop Installation – Checking Java Version

Command: hadoop version

Fig: Hadoop Installation – Checking Hadoop Version

Step 6: Edit the Hadoop Configuration files.

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:
Fig: Hadoop Installation – Hadoop Configuration Files

Step 7: Open [Link] and edit the property mentioned below inside configuration tag:

[Link] 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 [Link]

Fig: Hadoop Installation – Configuring [Link]

1
2 <?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="[Link]"?>
3 <configuration>
4 <property>
5 <name>[Link]</name>
6 <value>hdfs://localhost:9000</value>
</property>
7 </configuration>
8

Step 8: Edit [Link] and edit the property mentioned below inside
configuration tag:
[Link] 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 [Link]

Fig: Hadoop Installation – Configuring [Link]

1
2 <?xml version="1.0" encoding="UTF-8"?>
3 <?xml-stylesheet type="text/xsl" href="[Link]"?>
<configuration>
4
<property>
5 <name>[Link]</name>
6 <value>1</value>
7 </property>
8 <property>
<name>[Link]</name>
9 <value>false</value>
10 </property>
11 </configuration>
12
Step 9: Edit the [Link] file and edit the property mentioned below
inside configuration tag:

[Link] 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, [Link] file is not available. So, we have to create the mapred-
[Link] file using [Link] template.

Command: cp [Link] [Link]


Command: vi [Link].

Fig: Hadoop Installation – Configuring [Link]

1
<?xml version="1.0" encoding="UTF-8"?>
2
<?xml-stylesheet type="text/xsl" href="[Link]"?>
3 <configuration>
4 <property>
5 <name>[Link]</name>
6 <value>yarn</value>
</property>
7 </configuration>
8

Step 10: Edit [Link] and edit the property mentioned below inside configuration tag:

[Link] contains configuration settings of ResourceManager and NodeManager like


application memory management size, the operation needed on program & algorithm, etc.
Command: vi [Link]
Fig: Hadoop Installation – Configuring [Link]

1
2
<?xml version="1.0">
3 <configuration>
4 <property>
5 <name>[Link]-services</name>
6 <value>mapreduce_shuffle</value>
</property>
7 <property>
8 <name> [Link]</
9 name>
1 <value>[Link]</value>
0 </property>
</configuration>
1
1
Step 11: Edit [Link] and add the Java Path as mentioned below:

[Link] contains the environment variables that are used in the script to run
Hadoop like Java home path, etc.

Command: vi hadoop–[Link]

Fig: Hadoop Installation – Configuring [Link]


Step 12: Go to Hadoop home directory and format the Name Node.

Command: cd

Command: cd hadoop-2.7.3

Command: bin/hadoop namenode -format

Fig: Hadoop Installation – Formatting NameNode

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
[Link] 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: ./[Link]

The above command is a combination of [Link], [Link] & mr-jobhistory-


[Link]

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
files stored in the HDFS and tracks all the file stored across the cluster.

Command: ./[Link] start namenode


Start DataNode:
Fig: Hadoop Installation – Starting NameNode

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

Command: ./[Link] start datanode

Fig: Hadoop Installation – Starting 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.

Command: ./[Link] start resourcemanager


Fig: Hadoop Installation – Starting ResourceManager

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: ./[Link] start nodemanager

See Batch Details

Fig: Hadoop Installation – Starting NodeManager

Start JobHistoryServer:

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

Command: ./[Link] start historyserver

Step 14: To check that all the Hadoop services are up and running, run the below
command.
Command: jps

Fig: Hadoop Installation – Checking Daemons

Step 15: Now open the Mozilla browser and go


to localhost:50070/[Link] to check the NameNode interface.

Fig: Hadoop Installation – Starting WebUI

Congratulations, you have successfully installed a single node Hadoop cluster.

RESULT

Thus, the installation of a Hadoop single node cluster and run simple applications like wordcount.
Ex no. 8 Install Hadoop Single Node Cluster and Run Simple Applications like Word Count

AIM:
To Create and Execute Your First Container Using Docker and 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:

docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

...

Management Commands:
builder Manage builds
config Manage Docker configs
container Manage containers engine
Manage the docker engine
image 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
willmainly focus on the container command.

If podman is installed, you can run the alternative command for comparison.

sudo podman -h

You can additionally review the version of your Docker installation, docker version
Client:
Version: 19.03.6
...

Server: Docker Engine - Community


Engine
Version: 19.03.5
...

sudo podman version --events-backend=none


Version: 2.1.1
API Version: 2.0.0
Go Version: go1.15.2
Built: Thu Jan 1 00:00:00 1970
OS/Arch: linux/amd64

Step 1: Run your first container

We are going to use the Docker CLI to run our first container. Open

a terminal on your local computer


Run docker container run -t ubuntu top
Use the docker container run command to run a container with the ubuntu image using
the top command. The -t flags allocate a pseudo-TTY which we need for the top to work correctly.
$ docker container run -it ubuntu top Unable
to find image 'ubuntu:latest' locally latest:
Pulling from library/ubuntu aafe6b5e13de:
Pull complete 0a2b43a72660: Pull complete
18bdd1e546d2: Pull complete 8198342c3e05:
Pull complete f56970a44fd4: Pull complete
Digest: sha256:f3a61450ae43896c4332bda5e78b453f4a93179045f20c8181043b26b5e79028 Status:
Downloaded newer image for ubuntu:latest
The docker run command will result first in a docker pull to download the ubuntu image onto your host.
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
Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.0 us, 0.1 sy, 0.0 ni, 99.9 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

KiB Mem : 2046768 total, 173308 free, 117248 used, 1756212 buff/cache
KiB Swap: 1048572 total, 1048572 free, 0 used. 1548356 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
COMMAND 1 root 20 0 36636 3072 2640 R 0.3 0.2 0:00.04 top
Inspect the container with docker container exec
The docker container exec command is a way to "enter" a running container's namespaces with a new
process.
Open a new terminal. On [Link], select Terminal > New Terminal.
Using [Link], to open a new terminal connected to node1, click "Add New Instance" on
the lefthand side, then ssh from node2 into node1 using the IP that is listed by 'node1 '. For example:
[node2] (local) root@[Link] ~
$ ssh [Link]
[node1] (local) root@[Link] ~
$
In the new terminal, use the docker container ls command to get the ID of the running container you just
created.
$ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
b3ad2a23fab3 ubuntu "top" 29 minutes ago Up 29 minutes
goofy_nobel

$ docker container exec -it b3ad2a23fab3 bash


root@b3ad2a23fab3:/#
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

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

docker rm <CONTAINER ID>

Step 2: Run Multiple Containers


Explore the Docker Hub
The Docker Hub is the public central registry for Docker images, which contains community and official images.
Run an Nginx server
Let's run a container using the official Nginx image from the Docker Hub.
$ docker container run --detach --publish 8080:80 --name nginx nginx
Unable to find image 'nginx:latest' locally
latest: Pulling from library/nginx
36a46ebd5019: Pull complete 57168433389f:
Pull complete 332ec8285c50: Pull complete
Digest: sha256:c15f1fb8fd55c60c72f940a76da76a5fccce2fefa0dd9b17967b9e40b0355316 Status:
Downloaded newer image for nginx:latest

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;
}

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

Check your running containers with docker container ls


$ docker container ls
lOMoAR cPSD| 30499130

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

d6777df89fea nginx "nginx -g 'daemon ..." Less than a second ago Up 2


seconds0.0.0.0:8080-
>80/tcp nginx
ead80a0db505 mongo "docker-entrypoint..." 17 seconds ago Up 19 seconds [Link]: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
minutes0.0.0.0:8080-
>80/tcp nginx
ead80a0db505 mongo "docker-entrypoint..." 3 minutes
agoUp 3 minutes [Link]:8081->27017/tcp mongo
af549dccd5cf ubuntu "top" 8 minutes
agoUp 8 minutes priceless_kepler
Next, run docker container stop [container id] for each container in the list. You can also use
thenames of the containers that you specified before.
$ docker container
stopd67 ead af5 d67
e
a
d

a
f
5
1. Remove the stopped containers
docker system prune is a really handy command to clean up your system. It will remove
anystopped containers, unused volumes and networks, and dangling images.
$ docker system
prune
WARNING!
lOMoAR cPSD| 30499130

This will
remove:
- all stopped containers
- all volumes not used by at least one container
- all networks not used by at least one container
- all dangling
images Are you sure
you want to continue?
[y/N] y Deleted

- Containers:
7872fd96ea4695795c41150a06067d605f69702dbcb9ce49492c9029f0e1b44b

60abd5ee65b1e2732ddc02b971a86e22de1c1c446dab165462a08b037ef78
35c
31617fdd8e5f584c51ce182757e24a1c9620257027665c20be75aa3ab6591
740

Total reclaimed space: 12B

Result:
Thus, Creating and Executing of our First Container Using Docker and to Run a container from
Docker Hub has been executed successfully.
lOMoAR cPSD| 30499130

Ex. No 9 : Find a procedure to launch virtual machine using TryStack

Aim : To Find a procedure to launch virtual machine using TryStack

Procedure :
OpenStack is an open-source software cloud computing platform. OpenStack is primarily used for
deploying an infrastructure as a service (IaaS) solution like Amazon Web Service (AWS). In other
words, you can make your own AWS by using OpenStack. If you want to try out OpenStack,
TryStack is the easiest and free way to do it.

In order to try OpenStack in TryStack, you must register yourself by joining TryStack Facebook Group.
The acceptance of group needs a couple days because it’s approved manually. After you have been
accepted in the TryStack Group, you can log in TryStack.

[Link] 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:
lOMoAR cPSD| 30499130

OpenStack Compute Dashboard

Overview: What we will do?

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.
lOMoAR cPSD| 30499130

Step 1: Create Network

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.

1. Go to Network > Networks and then click Create Network.


2. In Network tab, fill Network Name for example internal and then click Next.
3. In Subnet tab,
1. Fill Network Address with appropriate CIDR, for example
[Link]/24. Use private network CIDR block as the best practice.
2. Select IP Version with appropriate IP version, in this case IPv4.
3. Click Next.
4. In Subnet Details tab, fill DNS Name Servers with [Link]
(Google DNS) and then click Create.

Step 2: Create Instance


Now, we will create an instance. The instance is a virtual machine in the
cloud, like AWS EC2. You need the instance to connect to the network that
we just created in the previous step.

1. Go to Compute > Instances and then click Launch Instance.


2. In Details tab,
1. Fill Instance Name, for example Ubuntu 1.
2. Select Flavor, for example [Link].
3. Fill Instance Count with 1.
4. Select Instance Boot Source with Boot from Image.
5. Select Image Name with Ubuntu 14.04 amd64 (243.7 MB) if you want install Ubuntu
14.04 in your virtual machine.
3. In Access & Security tab,
1. Click [+] button of Key Pair to import key pair. This key pair is a public
and private key that we will use to connect to the instance from our
machine.
2. In Import Key Pair dialog,
1. Fill Key Pair Name with your machine name (for example Edward-Key).
2. Fill Public Key with your SSH public key (usually is in
~/.ssh/id_rsa.pub). See description in Import Key Pair dialog
box for more information. If you are using Windows, you can
use Puttygen to generate key pair.
3. Click Import key pair.
3. In Security Groups, mark/check default.
4. In Networking tab,
1. In Selected Networks, select network that have been created in Step 1, for example
internal.

5. Click Launch.
6. If you want to create multiple instances, you can repeat step 1-5. I created
one more instance with instance name Ubuntu 2.
lOMoAR cPSD| 30499130

Step 3: Create Router

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.
1. Go to Network > Routers and then click Create Router.
2. Fill Router Name for example router1 and then click Create router.
3. Click on your router name link, for example router1, Router Details page.
4. Click Set Gateway button in upper right:
1. Select External networks with external.
2. Then OK.

5. Click Add Interface button.


1. Select Subnet with the network that you have been created in Step 1.
2. Click Add interface.
6. Go to Network > Network Topology. You will see the network topology. In
the example, there are two network, i.e. external and internal, those are
bridged by a router. There are
instances those are joined to internal network.

Step 4: Configure Floating IP Address


Floating IP address is public IP address. It makes your instance is accessible
from the internet. When you launch your instance, the instance will have a
private network IP, but no public IP. In OpenStack, the public IPs is collected
in a pool and managed by admin (in our case is TryStack). You need to request
a public (floating) IP address to be assigned to your instance.
1. Go to Compute > Instance.
2. In one of your instances, click More > Associate Floating IP.
3. In IP Address, click Plus [+].
4. Select Pool to external and then click Allocate IP.
5. Click Associate.
6. Now you will get a public IP, e.g. [Link], for your instance.

Step 5: Configure Access & Security

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.
lOMoAR cPSD| 30499130

Step 6: SSH to Your Instance

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:

Thus, a procedure to launch a virtual machine using TryStack was completed successfully.
lOMoAR cPSD| 30499130

Ex. No: 10 Simulate a cloud scenario using Grid Sim

Aim:

To install GridSim and implement the java code for GridSim Environment to create ‘n’ users and
datacenters with the Gridlets running in each datacenter.

Procedure:

1. Open the eclipse tool using the path E:\cloud grid\eclipse-SDK-4.2.2-


win32x86_64\eclipse\[Link]\
2. Click on File Menu → New → Java Project
3. Give name to the project (for instance, grid1) and click on Next Button
lOMoAR cPSD| 30499130

4. Click Finish Button


5. Right Click on the project in project explorer --> click Import
lOMoAR cPSD| 30499130

6. Select General → File System and click Next

7. Click Browse and browse the gridSim folder and Select the folder.

8. Click OK ,Then Select the GridSim folder


9. Click Finish Button-->Click yes to All to import
10. Right Click the project in project explorer and click properties

11. Click on Java Build Path and then libraries tab


12. Click on Add External Jars
lOMoAR cPSD| 30499130

13. Browse and Select all the jar files within gridSim folder → jars

14. Expand the project and Navigate into grid1 → examples → gridsim.example01 →

example1
15. open the source code by double clicking the example code

Example code:

Question:

Implement the following scenario in a grid [Link] 6 users and 2


datacenters with 25 gridlets running in each [Link] the workload and
maintain the load balancing in the 2 datacenters./*note the bolded portion is the
code to be added in the program in example 2*/

package gridsim.example02;

/*
* Author Anthony Sulistio
* Date: April 2003
* Description: A simple program to demonstrate of how to use GridSim package.
* This example shows how to create one or more Grid users.
* A Grid user contains one or more Gridlets.
lOMoAR cPSD| 30499130

* Therefore, this example also shows how to create Gridlets with


* and without using GridSimRandom class.
*
* NOTE: The values used from this example are taken from the GridSim paper.
* [Link]
* $Id: [Link],v 1.4 2003/05/19 13:17:49 anthony Exp $
*/
import [Link].*;
import gridsim.*;
/**
* This class shows how to create one or more grid users. In addition, the
* creation of Gridlets also discussed.
*/
class Example2
{
/**
* Main function to run this
example */
public static void main(String[] args)
{
[Link]("Starting example of how to create Grid users");
[Link]();

try
{

// Creates a list of Gridlets

GridletList list = createGridlet(); [Link]("Creating " +


[Link]() + " Gridlets"); ResourceUserList userList =
createGridUser(list); [Link]("Creating " + [Link]() +
" Grid users");

// print the Gridlets


lOMoAR cPSD| 30499130

printGridletList(list);

[Link]("Finish the example");


}
catch (Exception e)
{
[Link]();
[Link]("Unwanted error happens");
}
}
/**
* A Grid user has many Gridlets or jobs to be processed.
* This method will show you how to create Gridlets with and without
* GridSimRandom class.
* @return a GridletList object
*/

private static GridletList createGridlet()


{
// Creates a container to store Gridlets

GridletList list = new GridletList();

// We create three Gridlets or jobs/tasks manually without the help


// of GridSimRandom
int id = 0;
double length = 3500.0;
long file_size = 300;
long output_size = 300;
Gridlet gridlet1 = new Gridlet(id, length, file_size, output_size); id++;

Gridlet gridlet2 = new Gridlet(id, 5000, 500, 500);

id++;
Gridlet gridlet3 = new Gridlet(id, 9000, 900, 900);
lOMoAR cPSD| 30499130

// Store the Gridlets into a list


[Link](gridlet1);
[Link](gridlet2);
[Link](gridlet3);
// We create 5 Gridlets with the help of GridSimRandom and
// GriSimStandardPE class
Random random = new Random();
// sets the PE MIPS Rating
[Link](100);
// creates 22 Gridlets
int count = 22;
double min_range = 0.10;
double max_range = 0.50;
for (int i = 1; i < count+1; i++)
{
// the Gridlet length determines from random values and the
// current MIPS Rating for a PE
length = [Link]([Link]()*output_size);
// determines the Gridlet file size that varies within the range
// 100 + (10% to 50%)
file_size = (long) [Link](100, min_range, max_range,
[Link]());
// determines the Gridlet output size that varies within the range
// 250 + (10% to 50%)
output_size = (long) [Link](250, min_range, max_range,
[Link]());
// creates a new Gridlet object

Gridlet gridlet = new Gridlet(id + i, length, file_size,


output_size);
// add the Gridlet into a list
[Link](gridlet);
}
lOMoAR cPSD| 30499130

return list;
}

/**
* Creates Grid users. In this example, we create 3 users. Then assign
* these users to Gridlets.
* @return a list of Grid users
*/
private static ResourceUserList createGridUser(GridletList list)
{
ResourceUserList userList = new ResourceUserList();

[Link](0); // user ID starts from 0


[Link](1);
[Link](2);
[Link](3);
[Link](4);
[Link](5);
int userSize = [Link]();
int gridletSize = [Link]();
int id = 0;

// assign user ID to particular Gridlets for


(int i = 0; i < gridletSize; i++)
{
if (i != 0 && i % userSize == 0)
id++;
( (Gridlet) [Link](i) ).setUserID(id);
}

return userList;

private static void printGridletList(GridletList list)


lOMoAR cPSD| 30499130

{
int size = [Link]();
Gridlet gridlet;

String indent = " ";


[Link]();
[Link]("Gridlet ID" + indent + "User ID" + indent +
"length" + indent + " file size" + indent +
"output size");

for (int i = 0; i < size; i++)


{
gridlet = (Gridlet) [Link](i);
[Link](indent + [Link]() + indent + indent
+ indent + [Link]() + indent + indent + (int)
[Link]() + indent + indent +
(int) [Link]() + indent + indent +
(int) [Link]() );
}
}

} // end class

Output:

Starting example of how to create Grid users

Creating 25 Gridlets
Creating 6 Grid users
Gridlet ID User ID length file size output size
0 0 3500 300 300
1 0 5000 500 500
2 0 9000 900 900
lOMoAR cPSD| 30499130

3 0 24798 91 253
4 0 4921 136 362
5 0 13917 112 361
6 1 22766 103 244
7 1 22048 129 354
8 1 12355 140 348
9 1 4891 136 324
10 1 26116 108 241
11 1 7467 144 334
12 2 17698 111 301
13 2 2130 129 300
14 2 16183 115 253
15 2 7842 128 354
16 2 31062 115 238
17 2 3469 135 225
18 3 17362 133 288
19 3 2061 135 346
20 3 13402 113 368
21 3 30585 106 348
22 3 22877 134 318
23 3 5026 94 271
24 4 14461 109 308

Result:

Thus, grid is simulated in GridSim environment and the program is executed successfully.

You might also like