Professional Documents
Culture Documents
Cloud Computing LAB
Cloud Computing LAB
ENGINEERING COLLEGE
(Autonomous Institution)
Accredited by MBA, NAAC with ‘A’ grade & ISO 9001:2015 Certified Institution
POONAMALLEE – AVADI ROAD
THIRUVERKADU POST, CHENNAI – 600 077
Name : AAKASH N
Reg.No : 111917104001
CERTIFICATE
Name……………………………….AAKASH N…………….………………………..
Certified that this is the bonafide record of work done by the above student in the CS8711-
Cloud Computing Laboratory during the Academic year 2020 – 2021.
(Autonomous Institution)
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
VISION
To conceive our department as Centre of Academic Excellence by catering quality education with
ethical standards
MISSION
● To create a conducive atmosphere to achieve active professionalism by fortifying academic
proficiency with ethical standards
● To enhance the confidence level to develop sustainable solution to upgrade the society forever
● To empower the students with prerequisite professional skills for enhancing employability and
entrepreneurship, continuing education and research
1. To enable graduates to pursue higher education and research, or have a successful career in
industries associated with Computer Science and Engineering, or as entrepreneurs.
2. To ensure that graduates will have the ability and attitude to adapt to emerging technological
changes.
2. Problem analysis: Identify, formulate, review research literature, and analyze complex engineering
problems reaching substantiated conclusions using first principles of mathematics, natural sciences,
and engineering sciences.
3. Design/development of solutions: Design solutions for complex engineering problems and design
system components or processes that meet the specified needs with appropriate consideration for the
public health and safety, and the cultural, societal, and environmental considerations.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities with an
understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to the
professional engineering practice.
7. Environment and sustainability: Understand the impact of the professional engineering solutions
in societal and environmental contexts, and demonstrate the knowledge of, and need for sustainable
development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of
the engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader in
diverse teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the engineering
community and with society at large, such as, being able to comprehend and write effective reports and
design documentation, make effective presentations, and give and receive clear instructions.
11. Project management and finance: Demonstrate knowledge and understanding of the engineering
and management principles and apply these to one’s own work, as a member and leader in a team, to
manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.
SYLLABUS
CS8711 CLOUD COMPUTING LABORATORY LTPC0042
OBJECTIVES:
LIST OF EXPERIMENTS
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.
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.
TOTAL: 60 PERIODS
OUTCOMES:
(Autonomous Institution)
DEPARTMENT OF CSE
SUBJECT/SUB.CODE : CS8711 / CLOUD COMPUTING LABORATORY
CS8711.1 :ConfigurevariousvirtualizationtoolssuchasVirtualBox,VMwareworkstation.
CS8711.2 :DesignanddeployawebapplicationinaPaaSenvironment.
CS8711.3 :Learnhowtosimulateacloudenvironmenttoimplementnewschedulers.
CS8711.4 :Installanduseagenericcloudenvironmentthatcanbeusedasaprivatecloud.
CS8711.5 :Manipulatelargedatasetsinaparallelenvironment.
CS8711.6 : Install Hadoop single node cluster and run simple applications
CS8711.1 1 3 2 3
CS8711.2 1 3 2 2 2
CS8711.3 2 1 1 1 1
CS8711.4 1 1 2 2 1
CS8711.5 2 1 2 1 1
CS8711.6 2 1 2 2
1 20/07/2020 VMwareWorkstationwithdifferentflavoursoflinuxor 09 20
windowsOSontopofwindows
InstallaCcompilerinthevirtualmachinecreat
2 03/08/2020 edusingvirtualboxandexecuteSimpleProgra 19 20
ms
InstallGoogleAppEngine.Createhelloworldappa
3 10/08/2020 21 20
ndothersimplewebapplicationsusingpython/java.
4 17/08/2020 UseGAElaunchertolaunchthewebapplications. 25 20
SimulateacloudscenariousingCloudSimandrunasc
5 07/09/2020 34 20
hedulingalgorithmthatisnotpresentinCloudSim.
Findaproceduretotransferthefilesfromonevirtualmac
6 14/09/2020 43 20
hinetoanothervirtualmachine.
Findaproceduretolaunchvirtualmachineusingtrystac
7 05/10/2020 47 20
k
InstallHadoopsinglenodeclusterandrunsimpleapplica
8 12/10/2020 tionslikewordcount. 62 20
EX.NO:01InstallVirtualbox/VMwareWorkstationwith different
DATE:20/07/2020 flavoursoflinuxorwindowsOSontopofwindows
AIM:
PROCEDURE:
8
CS8711- Cloud Computing Laboratory REG NO:111917104059
9
CS8711- Cloud Computing Laboratory REG NO:111917104059
10
CS8711- Cloud Computing Laboratory REG NO:111917104059
11
CS8711- Cloud Computing Laboratory REG NO:111917104059
12
CS8711- Cloud Computing Laboratory REG NO:111917104059
13
CS8711- Cloud Computing Laboratory REG NO:111917104059
14
CS8711- Cloud Computing Laboratory REG NO:111917104059
15
CS8711- Cloud Computing Laboratory REG NO:111917104059
16
CS8711- Cloud Computing Laboratory REG NO:111917104059
RESULT:
17
CS8711- Cloud Computing Laboratory REG NO:111917104059
EX.NO:02InstallaCcompilerinthevirtualmachinecreated
DATE:03/08/20 usingvirtualboxandexecuteSimplePrograms
AIM:
To install a C Compiler in the virtual machine using Virtual Box and then to execute simple program
PROCEDURE:
****If gccand / or g++ and it’s related Development Tools are not installed in your system by default, you
can install the latest available from the repositories as follow****
PROGRAM :
#include<stdio.h>
int main()
{
int a, b, c;
printf("Enter two numbers to add, separated by a space: ");
scanf("%d%d",&a,&b);
c = a + b;
printf("The sum of 2 numbers is: %d\n",c);
return 0;
}
OUTPUT:
18
CS8711- Cloud Computing Laboratory REG NO:111917104059
RESULT:
Thus C Compiler in the virtual machine using Virtual Box was installed and then simple program was
executed successfully.
19
CS8711- Cloud Computing Laboratory REG NO:111917104059
EX.NO:03InstallGoogleAppEngine.Createhelloworldappand
DATE:10/08/20 othersimplewebapplicationsusingpython/java
AIM:
To install Google App engine to create helloworld App web application using python
PROCEDURE:
This procedure describes the installation of the Google App Engine Software Development Kit (SDK) on
a Microsoft Windows and running a simple “hello world” application.
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.
Pre-Requisites: Python 2.5.4
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/
Download and Install
You can download the Google App Engine SDK by going to:
http://code.google.com/appengine/downloads.html
and download the appropriate installpackage.
Download the Windows installer – the simplest thing is to download it to your Desktop or another
folder that youremember.
20
CS8711- Cloud Computing Laboratory REG NO:111917104059
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
21
CS8711- Cloud Computing Laboratory REG NO:111917104059
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 goingon.
Make a folder for your Google App Engine applications. I am going to make the Folder on my Desktop
called “apps” – the path to this folder is:
C:\Documents and Settings\csev\Desktop\apps
And then make a sub-‐folder in within apps called “ae-01-trivial” – the path to this folder would be:
C:\ Documents and Settings \csev\Desktop\apps\ae-01-trivial
Using a text editor such as JEdit (www.jedit.org), create a file called app.yamlin the
ae-01-trivial folder with the following contents:
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.pywith three lines in it:
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/
22
CS8711- Cloud Computing Laboratory REG NO:111917104059
Paste http://localhost:8080 into your browser and you should see your application as follows:
Just for fun, edit the index.pyto change the name “Chuck” to your own name and press Refresh in the
browser to verify your updates.
RESULT:
Thus Google App engine was installed to create helloworld App web application using python
23
CS8711- Cloud Computing Laboratory REG NO:111917104059
EX.NO:4UseGAElaunchertolaunchthewebapplications.
DATE: 17/08/20
AIM:
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.
24
CS8711- Cloud Computing Laboratory REG NO:111917104059
handlers:
- url:/
static_files: www/index.html
upload: www/index.html
- url:/(.*)
static_files: www/\1
upload: www/(.*)
</p>
</body>
</html>
Optional flags:
Include the --project flag to specify an alternate Cloud Console project ID to what you initialized as
the default in the gcloud tool. 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 https://PROJECT_ID.REGION_ID.r.appspot.com, run the
following command:
gcloud app browse
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:
26
CS8711- Cloud Computing Laboratory REG NO:111917104059
Each time you press Refresh in your browser – you can see it retrieving the output with a GET request.
Dealing With Errors
With two files to edit, there are two general categories of errors that you may encounter. If you make a
mistake
on the app.yamlfile, the App Engine will not start and your launcher will show a yellow icon near
your application:
27
CS8711- Cloud Computing Laboratory REG NO:111917104059
To get more detail on what is going wrong, take a look at the log for the application:
If you make a syntax error in the index.pyfile, 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
28
CS8711- Cloud Computing Laboratory REG NO:111917104059
When you make a mistake in the app.yamlfile – 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.
OUTPUT:
29
CS8711- Cloud Computing Laboratory REG NO:111917104059
30
CS8711- Cloud Computing Laboratory REG NO:111917104059
31
CS8711- Cloud Computing Laboratory REG NO:111917104059
RESULT:
Thus GAE launcher was initiated and web application was launched successfully.
32
CS8711- Cloud Computing Laboratory REG NO:111917104059
EX.NO:5SimulateacloudscenariousingCloudSimandruna
DATE:07/09/20 schedulingalgorithmthatisnotpresentinCloudSim
AIM:
PROCEDURE:
CloudSim is a simulation toolkit that supports the modeling and simulation of the core functionality of cloud,
like job/task queue, processing of events, creation of cloud entities(datacenter, datacenter brokers, etc),
communication between different entities, implementation of broker policies, etc. This toolkit allows to:
Test application services in a repeatable and controllable environment.
Tune the system bottlenecks before deploying apps in an actual cloud.
Experiment with different workload mix and resource performance scenarios on simulated infrastructure
for developing and testing adaptive application provisioning techniques
Core features of CloudSim are:
The Support of modeling and simulation of large scale computing environment as federated cloud data
centers, virtualized server hosts, with customizable policies for provisioning host resources to virtual
machines and energy-aware computational resources
It is a self-contained platform for modeling cloud’s service brokers, provisioning, and allocation policies.
It supports the simulation of network connections among simulated system elements.
Support for simulation of federated cloud environment, that inter-networks resources from both private
and public domains.
Availability of a virtualization engine that aids in the creation and management of multiple independent
and co-hosted virtual services on a data center node.
Flexibility to switch between space shared and time shared allocation of processing cores to virtualized
services.
How to download Cloudsim?
Cloudsim project source code, as well as compiled jars files, are published through the GitHub project
page: https://github.com/Cloudslab/cloudsim. By default, the project page displays the source code(based
on maven build tool) of the current release
33
CS8711- Cloud Computing Laboratory REG NO:111917104059
Every version except 5.0(still under development) contains 4 asset files example description for each asset file
is as follows:
cloudsim-4.0.tar.gz: This file contains the compiled JAR file that can be directly used into the custom
simulation implementation where there is no need to change in the source code of cloudsim simulation
engine. This version is Linux specific.
cloudsim-4.0.zip: This is the same as above the only difference is that it is windows specific.
Source code(zip): This file contains the complete source code of the cloudsim simulation framework
project. As the cloudsim uses the maven build tool for its DevOps. Therefore to set up this project you
require to
use an IDE that supports maven project imports. How do you identify that its a maven based project?
you will find a “pom.xml” file in the project root folder. This zip is windows operating system specific
file.
Source code(tar.gz): This file contains a similar structure as mentioned above, but it is specific to
Linux
How to install?
Cloudsim setup is very easy, for this you may follow the following link: cloudsim-setup-using-eclipse/. This
link describes in detail all the steps that are required to successfully configure the Cloudsim 3.0.3 version.
The cloudsim 3.0.3 version is best to start with that once you understand the basic working and architecture
then you can move to any latest version.
How cloudsim work?
As it is already mentioned that the cloudsim allows to model and simulate the cloud system components,
therefore to support its function different set of classes has been developed by its developers like:
To simulating the regions and datacenters the class named “Datacenter.java” is available in
org.cloudbus.cloudsim package.
To simulate the workloads for cloud, the class named as “Cloudlet.java” is available in
org.cloudbus.cloudsim package.
To simulate the load balancing and policy-related implementation the classes named
“DatacenterBroker.java”, “CloudletScheduler.java”, “VmAllocationPolicy.java”, etc are available under
org.cloudbus.cloudsim package.
Now because all the different simulated hardware models are required to communicate with each other
to share the simulation work updates for this cloudsim has implemented a discrete event simulation
34
CS8711- Cloud Computing Laboratory REG NO:111917104059
engine that keeps track of all the task assignments among the different simulated cloud components.
How to run my first cloudsim simulation scenario?
Once you have completed your installation/setup and understand the basic working of the cloudsim, the next
step is to implement your own custom scenario. Any simulation will go through the following steps:
Initialize the CloudSim with the current clock time and this will also initialize the core
CloudInformationService entity.
Create Datacenter(s) as Datacenters are the resource providers in CloudSim. We need at list one of
them to run a CloudSim simulation.
Create Broker to simulate the user workload scheduling as well as virtual machine allocation and
placements.
Create one/more virtual machine and submit to the broker for further submitting it to the respective
DataCenters for its placement and execution management during the simulation run.
Create one/more Cloudlet and submit the cloudlet list to the broker for further task scheduling on the
active virtual machines for its processing during the simulation run.
Starts the simulation, this will initiate all the entities and components created above and put them into
execution for supporting various simulation operations.
Stop the simulation, concludes simulation and flush all the entities & components before the exit of a
simulation run.
Print results when the simulation is over, where you will be able to display which cloudlet executed on
which virtual machine along with how much time it spent in execution, its start time as well as its finish
time.
The main() method is the pointer from where the execution of this example starts
public static void main(String[] args)
There are eleven steps that are followed in each example with some variation in them, specified as follows:
Set the Number of users for the current simulation. This user count is directly proportional to a number
brokers in the current simulation.
intnum_user = 1; // number of cloud users
Calendar calendar = Calendar.getInstance();
booleantrace_flag = false;
Initialize the simulation, provided with the current time, number of users and trace flag.
CloudSim.init(num_user, calendar, trace_flag);
35
CS8711- Cloud Computing Laboratory REG NO:111917104059
Create a Datacenter.
vmlist.add(vm);
Submit Virtual Machine to Datacenter broker.
broker.submitVmList(vmlist);
Create Cloudlet(s) by specifying their characteristics.
cloudletList = new ArrayList<Cloudlet>();
int id = 0;
long length = 400000;
long fileSize = 300;
long outputSize = 300;
UtilizationModelutilizationModel = new UtilizationModelFull();
Cloudlet cloudlet = new Cloudlet(id, length, pesNumber, fileSize,
outputSize, utilizationModel, utilizationModel,
utilizationModel);
cloudlet.setUserId(brokerId);
cloudlet.setVmId(vmid);
cloudletList.add(cloudlet);
38
CS8711- Cloud Computing Laboratory REG NO:111917104059
Submit Cloudlets to Datacenter broker.
broker.submitCloudletList(cloudletList);
Send call to Start Simulation.
CloudSim.startSimulation();
Once no more event to execute, send the call to Stop Simulation.
CloudSim.stopSimulation();
Finally, print the final status of the Simulation.
List<Cloudlet>newList = broker.getCloudletReceivedList();
printCloudletList(newList);
Where printCloudletList() method formats the output to correctly display it on the console.
private static void printCloudletList(List<Cloudlet> list)
{
int size = list.size();
Cloudlet cloudlet;
String indent = "";
Log.printLine();
Log.printLine("========== OUTPUT ==========");
Log.printLine("Cloudlet ID" + indent + "STATUS" + indent
+ "Data center ID" + indent + "VM ID" +
indent + "Time" + indent
+ "Start Time" + indent + "Finish Time");
39
CS8711- Cloud Computing Laboratory REG NO:111917104059
Log.print("SUCCESS");
Log.printLine(indent + indent +
cloudlet.getResourceId()
+ indent + indent + indent +
cloudlet.getVmId()
+ indent + indent +
dft.format(cloudlet.getActualCPUTime())
+ indent + indent +
dft.format(cloudlet.getExecStartTime())
+ indent + indent +
dft.format(cloudlet.getFinishTime()));
}
}
}
OUTPUT:
Once you Run the example the output for cloudsimExample1.java will be displayed like:
40
CS8711- Cloud Computing Laboratory REG NO:111917104059
RESULT:
41
CS8711- Cloud Computing Laboratory REG NO:111917104059
EX.NO:6Findaproceduretotransferthefilesfromonevirtual
DATE:14/09/20 machinetoanothervirtualmachine.
AIM:
To execute the procedure for transfer the file from one virtual machine to another virtual
machine.
42
CS8711- Cloud Computing Laboratory REG NO:111917104059
43
CS8711- Cloud Computing Laboratory REG NO:111917104059
44
CS8711- Cloud Computing Laboratory REG NO:111917104059
Goto Terminal,
[oneadmin@frontend ~]$onevm list
OUTPUT:
ID USER GROUP NAME STATU CPU UMEM HOST TIME
3 oneadminoneadmin kvm1 runn 2 512M kvm2.saec.com 0d 00h01
2 oneadminoneadmin kvm2 runn 2 512M kvm1.saec.com 0d 00h02
45
CS8711- Cloud Computing Laboratory REG NO:111917104059
Goto Browser , Virtual Resources-> Virtual Machine ->
RESULT:
Thus procedure for transferring the files from one virtual machine to another machine was executed
successfully
46
CS8711- Cloud Computing Laboratory REG NO:111917104059
EX.NO:7Findaproceduretolaunchvirtualmachineusingtrystack
DATE:05/10/20
AIM:
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, TryStackis the
easiest and free way to do it.
In order to try OpenStack in TryStack, you must register yourself by joining TryStackFacebookGroup. 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.
TryStack.org Homepage
I assume that you already join to the Facebook Group and login to the dashboard. After youlog in to the
TryStack, you will see the Compute Dashboard like:
47
CS8711- Cloud Computing Laboratory REG NO:111917104059
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 be like
48
CS8711- Cloud Computing Laboratory REG NO: 111917104059
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.
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.
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.
49
CS8711- Cloud Computing Laboratory REG NO: 111917104059
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.
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 FloatingIP.
3. In IP Address, click Plus[+].
4. Select Pool to external and then click AllocateIP.
5. ClickAssociate.
6. Now you will get a public IP, e.g. 8.21.28.120, for yourinstance.
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 Groupstab.
2. In default row, click ManageRules.
3. Click Add Rule, choose ALL ICMP rule to enable ping into your instance, and then clickAdd.
4. Click Add Rule, choose HTTP rule to open HTTP port (port 80), and then clickAdd.
5. Click Add Rule, choose SSH rule to open SSH port (port 22), and then clickAdd.
6. You can open other ports by creating newrules.
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.
Output:
50
CS8711- Cloud Computing Laboratory REG NO: 111917104059
51
CS8711- Cloud Computing Laboratory REG NO: 111917104059
52
CS8711- Cloud Computing Laboratory REG NO: 111917104059
1.8 Check nfs SE Boolean settings only in kvm1 and kvm2 servers
# systemctl status firewalld|grep -i active
****Active: inactive (dead)****
# getsebool -a | grepuse_nfs_home_dirs
53
CS8711- Cloud Computing Laboratory REG NO: 111917104059
# serviceopennebula-sunstone start
Check to see service is enabled for different runlevels to start on reboot;
# chkconfig --list 2>/dev/null|grep -i open
opennebula 0:off 1:off 2:on 3:on 4:on 5:on 6:off
opennebula-sunstone 0:off 1:off 2:on 3:on 4:on 5:on 6:off
54
CS8711- Cloud Computing Laboratory REG NO: 111917104059
55
CS8711- Cloud Computing Laboratory REG NO: 111917104059
# mount -a -t nfs
# df -h /var/lib/one (check to see if it is mounted)
Reboot kvm1 and kvm2 to see if homedirs are mounted on reboot
# df -h /var/lib/one (check to see if it is mounted)
1.18.On frontend1 server configure ssh public key
OpenNebula will need to SSH passwordlessly from any node (including the frontend) to any other
node.
Add the following snippet to ~/.ssh/config as oneadmin so it doesn’t prompt to add the keys to the
known_hosts file:
# su - oneadmin
$ cat<< EOT > ~/.ssh/config
Host *
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
EOT
56
CS8711- Cloud Computing Laboratory REG NO: 111917104059
You will need to have your main interface connected to a bridge. We will do the following example
with ens3 but the name of the interface may vary. An OpenNebularequirements is that the name of the
bridge should be the same in all nodes.
#vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
DEVICE=eno16777736
BOOTPROTO=none
NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
****BRIDGE=br0****
#vi /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
TYPE=Bridge
ONBOOT=yes
BOOTPROTO=dhcp
NM_CONTROLLED=no
****Password is here****
****On frontend1****
57
CS8711- Cloud Computing Laboratory REG NO: 111917104059
#su - oneadmin
#cat ~/.one/one_auth
[frontend@frontend Desktop]$su
Password:redhat
OUTPUT:
OUTPUT:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
GotoFrontEnd,
58
CS8711- Cloud Computing Laboratory REG NO: 111917104059
NAME = "private"
BRIDGE = br0
AR = [
TYPE = IP4,
IP = 192.168.35.150,
SIZE = 10
]
OUTPUT:
Name : TTYLinux_1.0
Type: Select “DATABLOCK “
Image Location : Select “Empty Datablock”
Size: 512
FS: qcow2
CLICK “CREATE”
Goto Terminal,
[oneadmin@frontend ~]$oneimage list
ID USER GROUP NAME DATASTORE SIZE TYPE PER STAT RVMS
2 oneadminoneadmin TTYLinux_1.0 default 512M DB No rdy 0
59
CS8711- Cloud Computing Laboratory REG NO: 111917104059
Name : TTYLinux_1.0
VCPU: 1
CLICK “CREATE”
Goto Terminal,
[oneadmin@frontend ~]$onetemplate list
OUTPUT:
ID USER GROUP NAME REGTIME
2 oneadminoneadmin TTYLinux_1.o 08/21 12:38:42
Goto Terminal,
[oneadmin@frontend ~]$onevm list
OUTPUT:
ID USER GROUP NAME STATU CPU UMEM HOST TIME
3 oneadminoneadmin kvm1 runn 2 512M kvm2.saec.com 0d 00h01
2 oneadminoneadmin kvm2 runn 2 512M kvm1.saec.com 0d 00h02
60
CS8711- Cloud Computing Laboratory REG NO: 111917104059
RESULT:
Thus procedure to launch virtual machine using trystack was done successfully
61
CS8711- Cloud Computing Laboratory REG NO: 111917104059
EX.NO:8InstallHadoopsinglenodeclusterandrunsimple
DATE:12/10/20 applicationslikewordcount.
AIM:
To install Hadoop single node cluster and run simple applications like wordcount
PROCEDURE:
Step 1:Log on to your Cent OS machine by root
User name->root
Password->redhat
Step2:Disable your firewall & set the selinuxmodePermissive
#systemctl disable firewalld
# systemctl stop firewalld
# systemctl status firewalld
#setenforce 0
#getenforce
#hadooppasswd
Enter your password here:___________________
Retype your pass word:______________________
Switch to hadoop user:
#su – hadoop
Key generation:
#key-gen **(on root)**
#ssh-copy-id hadoop@hadoop12
$key-gen (on hadoop)
$ ssh-copy-id root@hadoop12
export HADOOP_INSTALL=$HADOOP_HOME
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin
64
CS8711- Cloud Computing Laboratory REG NO: 111917104059
Edit hdfs-site.xml
65
CS8711- Cloud Computing Laboratory REG NO: 111917104059
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.name.dir</name>
<value>file:///home/hadoop/hadoopdata/hdfs/namenode</value>
</property>
<property>
<name>dfs.data.dir</name>
<value>file:///home/hadoop/hadoopdata/hdfs/datanode</value>
</property>
</configuration>
Edit mapred-site.xml
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
66
CS8711- Cloud Computing Laboratory REG NO: 111917104059
</configuration>
Edit yarn-site.xml
<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>
Format Namenode
Now format the namenode using following command, make sure that Storage directory is
$ hdfsnamenode –format
67
CS8711- Cloud Computing Laboratory REG NO: 111917104059
68
CS8711- Cloud Computing Laboratory REG NO: 111917104059
open hadoop
[desktop@hadoop]$ su
Password: redhat
[root@hadoop]$ ifconfig
[root@hadoop]$ vi /etc/hosts
system ip hadoop.saec.com hadoop
Esc Shift + : wq
[root@hadoop]$ java -version
[root@hadoop]$ su - hadoop
[hadoop@hadoop]$ hadoop version
69
CS8711- Cloud Computing Laboratory REG NO: 111917104059
[hadoop@hadoop]$ cd $HADOOP_HOME/etc/hadoop
[hadoop@hadoop]$ vi core-site.xml
[hadoop@hadoop]$ vi hdfs-site.xml
[hadoop@hadoop]$ vi mapred-site.xml
[hadoop@hadoop]$ vi yarn-site.xml
[hadoop@hadoop]$ hdfsnamenode -format
[hadoop@hadoop]$ cd $HADOOP_HOME/sbin/
[hadoop@hadoop]$ start-all.sh
[hadoop@hadoop]$ jps
in browser localhost:50070
green page configured capacity-17.5GB
in browser localhost:50075->datanode
in browser localhost:50090->secondary name node
in browser localhost:8088->cluster
70
CS8711- Cloud Computing Laboratory REG NO: 111917104059
[root@hadoop]$ vi wrdcnt.java
}
return c;
}
public static void main (String args[])
{ String str1="The hadoop is a opensource frame work here we use hadoop 2.6.0 ";
res=wrdcnt.wordcount(str1);
System.out.println("The number of words in the String are : "+res);
System.out.println("the word is:"+str1);
}
}
save it by esc shift:wq
[root@hadoop]$javacwrdcnt.java
$java wrdcnt
OUTPUT:
72
CS8711- Cloud Computing Laboratory REG NO: 111917104059
RESULT:
Thus installation of Hadoop single node cluster and running of simple applications like wordcount was
executed successfully.
73
CS8711- Cloud Computing Laboratory REG NO: 111917104059
Aim:
Procedure:
***** Add following entry in /etc/hosts file on kvm1 kvm2 frontend *****
#vi /etc/hosts
192.168.35.135 frontend1.cnl.com frontend1
192.168.35.136 kvm2.cnl.com kvm2
192.168.35.137 kvm1.cnl.com kvm1
74
CS8711- Cloud Computing Laboratory REG NO: 111917104059
#vi /etc/selinux/configSELINUX=permissive
#vi /etc/sysconfig/selinuxSELINUX=permissive
#getsebool -a | grepuse_nfs_home_dirs
#setsebool -P use_nfs_home_dirs 1
75
CS8711- Cloud Computing Laboratory REG NO: 111917104059
1.8 Check nfs SE Boolean settings only in kvm1 and kvm2 servers
# systemctl status firewalld|grep -i active
****Active: inactive (dead)****
# getsebool -a | grepuse_nfs_home_dirs
# serviceopennebula-sunstone start
Check to see service is enabled for different runlevels to start on reboot;
# chkconfig --list 2>/dev/null|grep -i open
opennebula 0:off 1:off 2:on 3:on 4:on 5:on 6:off
opennebula-sunstone 0:off 1:off 2:on 3:on 4:on 5:on 6:off
77
CS8711- Cloud Computing Laboratory REG NO: 111917104059
# mount -a -t nfs
# df -h /var/lib/one (check to see if it is mounted)
DEVICE=eno16777736
BOOTPROTO=none
78
CS8711- Cloud Computing Laboratory REG NO: 111917104059
NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
****BRIDGE=br0****
#vi /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
TYPE=Bridge
ONBOOT=yes
BOOTPROTO=dhcp
NM_CONTROLLED=no
****Password is here****
****On frontend1****
#su - oneadmin
#cat ~/.one/one_auth
79
CS8711- Cloud Computing Laboratory REG NO: 111917104059
Output:
Result:
Thus installation of OPEN NEBULA Cloud setup is executed successfully.
80