· 7 years ago · Oct 23, 2018, 11:28 AM
1
2Ex. No: 1
3STUDY OF ALL COMPUTING TECHNOLOGY
4Date:
5
6
7Aim:
8 To study the different computing technologies like Distributed Computing, Ubiquitous computing, Cluster computing and Mobile computing.
9Client server computing:
10 Client/Server computing is a computing model in which client and server computers communicate with each other over a network. In client/server computing, a server takes requests from client computers and shares its resources, applications and/or data with one or more client computers on the network, and a client is a computing device that initiates contact with a server in order to make use of a shareable resource.
11
12Peer to Peer Computing:
13 Peer-to-peer (P2P) is a decentralized communications model in which each party has the same capabilities and either party can initiate a communication session. Unlike the client/server model, in which the client makes a service request and the server fulfills the request, the P2P network model allows each node to function as both a client and server.
14
15
16Centralized Computing:
17 Centralized computing is computing done at a central location, using terminals that are attached to a central computer. The computer itself may control all the peripherals directly (if they are physically connected to the central computer), or they may be attached via a terminalHYPERLINK "https://en.wikipedia.org/wiki/Terminal_server" HYPERLINK "https://en.wikipedia.org/wiki/Terminal_server"server. Alternatively, if the terminals have the capability, they may be able to connect to the central computer over the network. The terminals may be textHYPERLINK "https://en.wikipedia.org/wiki/Text_terminal" HYPERLINK "https://en.wikipedia.org/wiki/Text_terminal"terminals or thinHYPERLINK "https://en.wikipedia.org/wiki/Thin_client" HYPERLINK "https://en.wikipedia.org/wiki/Thin_client"clients.Â
18
19Parallel Computing:
20 Parallel computing is a type of computing architecture in which several processors execute or process an application or computation simultaneously. Parallel computing helps in performing large computations by dividing the workload between more than one processor, all of which work through the computation at the same time. Most supercomputers employ parallel computing principles to operate.Parallel computing is also known as parallel processing.
21
22
23Distributed Computing:
24 Distributed computing is a computing concept that, in its most general sense, refers to multiple computer systems working on a single problem. In distributed computing, a single problem is divided into many parts, and each part is solved by different computers. As long as the computers are networked, they can communicate with each other to solve the problem. If done properly, the computers perform like a single entity.
25
26Grid Computing:
27 Grid computing is a processor architecture that combines computer resources from various domains to reach a main objective. In grid computing, the computers on the network can work on a task together, thus functioning as a supercomputer.
28
29Utility Computing:
30 Utility computing is the process of providing computing service through an on-demand, pay-per-use billing method. Utility computing is a computing business model in which the provider owns, operates and manages the computing infrastructure and resources, and the subscriber’s accesses it as and when required on a rental or metered basis.
31Pervasive Computing (or) ubiquitous computing:
32 Pervasive computing is an emerging trend associated with embedding microprocessors in day-to-day objects, allowing them to communicate information. It is also known as ubiquitous computing. The terms ubiquitous and pervasive signify "existing everywhere." Pervasive computing systems are totally connected and consistently available. It is also known as ubiquitous computing.
33Cluster Computing:
34 Cluster Computing addresses the latest results in these fields that support High Performance Distributed Computing (HPDC). In HPDC environments, parallel and/or distributed computing techniques are applied to the solution of computationally intensive applications across networks of computers. The journal represents an important source of information for the growing number of researchers, developers and users of HPDC environments.
35Fog Computing:
36 Fog computing or fog networking, also known as fogging, it is an architecture that uses edgeHYPERLINK "https://en.wikipedia.org/wiki/Edge_device" HYPERLINK "https://en.wikipedia.org/wiki/Edge_device"devices to carry out a substantial amount of computation, storage, communication locally and routed over the internetHYPERLINK "https://en.wikipedia.org/wiki/Internet_backbone" HYPERLINK "https://en.wikipedia.org/wiki/Internet_backbone"backbone, and most definitively has input and output from the physical world known as transduction. Fog computing consists of Edge nodes directly performing physical input and output often to achieve sensor input, display output, or full closed loop process control, and may also use smaller Edge Clouds often called as Cloudlets at the Edge or nearer to the Edge than centralized Clouds residing in very large data centres. The processing power in advanced Edge Clouds like those that control autonomous vehicles can be considerable compared to more traditional Edge personal devices such as mobile phones and personal computers.
37Edge Computing:
38 "Edge computing" is used as a kind of catch-all for various networking technologies including peer-to-peer networking or ad hoc networking, as well as various types of cloud setups and other distributed systems. One other predominant type of edge networking is mobile edge networking or computing, an architecture that utilizes the edge of the cellular network for operations.
39Cloud Computing:
40 Cloud computing is a general term for the delivery of hosted services over the internet. Cloud computing enables companies to consume a compute resource, such as a virtual machine , storage or an application, as a utility -- just like electricity -- rather than having to build and maintain computing infrastructures in house.
41
42
43
44
45Ambient Computing:
46 Ambient computing is the backdrop of sensors, devices, intelligence, and agents that can put the Internet of Things to work. The Internet of Things (IoT) is maturing from its awkward adolescent phase.
47Internet Of Things (IOT):
48 The Internet of Things (IoT) is the network of physical devices, vehicles, home appliances, and other items embedded with electronics, software, sensors, actuators, and connectivity which enables these things to connect and exchange data, creating opportunities for more direct integration of the physical world into computer-based systems, resulting in efficiency improvements, economic benefits, and reduced human exertions. The number of IoT devices increased 31% year-over-year to 8.4 billion in 2017 and it is estimated that there will be 30 billion devices by 2020. The global market value of IoT is projected to reach $7.1 trillion by 2020.
49 IoT involves extending internet connectivity beyond standard devices, such as desktops, laptops, smart phones and tablets, to any range of traditionally dumb or non-internet-enabled physical devices and everyday objects. Embedded with technology, these devices can communicate and interact over the internet, and they can be remotely monitored and controlled.
50Data Analytics:
51 Data analysis is a process of inspecting, cleansing, transforming, and modeling data with the goal of discovering useful information, informing conclusions, and supporting decision-making. Data analysis has multiple facets and approaches, encompassing diverse techniques under a variety of names, while being used in different business, science, and social science domains.
52Data Mining:
53 Data mining is the process of discovering patterns in large data sets involving methods at the intersection of machine learning, statistics, and database systems
54Data Warehouse:
55 In computing, a data warehouse (DW or DWH), also known as an enterprise data warehouse (EDW), is a system used for reporting and dataHYPERLINK "https://en.wikipedia.org/wiki/Data_analysis" HYPERLINK "https://en.wikipedia.org/wiki/Data_analysis"analysis, and is considered a core component of businessHYPERLINK "https://en.wikipedia.org/wiki/Business_intelligence" HYPERLINK "https://en.wikipedia.org/wiki/Business_intelligence"intelligence. DWs are central repositories of integrated data from one or more disparate sources. They store current and historical data in one single place that are used for creating analytical reports for workers throughout the enterprise.
56Web Services and Service Architecture:
57 A service-oriented architecture is essentially a collection of services. These services communicate with each other. The communication can involve either simple data passing or it could involve two or more services coordinating some activity. Some means of connecting services to each other is needed.
58
59
60
61
62 Service-oriented architectures are not a new thing. The first service-oriented architecture for many people in the past was with the use DCOM or Object Request Brokers (ORBs) based on the CORBA specification. For more on DCOM and CORBA, see PriorHYPERLINK "https://www.service-architecture.com/articles/web-services/prior_service-oriented_architecture_specifications.html" HYPERLINK "https://www.service-architecture.com/articles/web-services/prior_service-oriented_architecture_specifications.html"ServiceHYPERLINK "https://www.service-architecture.com/articles/web-services/prior_service-oriented_architecture_specifications.html"-HYPERLINK "https://www.service-architecture.com/articles/web-services/prior_service-oriented_architecture_specifications.html"OrientedHYPERLINK "https://www.service-architecture.com/articles/web-services/prior_service-oriented_architecture_specifications.html" HYPERLINK "https://www.service-architecture.com/articles/web-services/prior_service-oriented_architecture_specifications.html"ArchitecturesHYPERLINK "https://www.service-architecture.com/articles/web-services/prior_service-oriented_architecture_specifications.html"
63
64
65
66
67
68
69
70
71
72
73
74
75
76Result:
77 Thus the study experiment for different computing technologies was learned successfully.
78
79
80Ex. No: 2
81STUDY OF GRID & CLOUD COMPUTING
82Date:
83
84
85Aim:
86 To study about grid and cloud computing.
87.Grid Computing:
88 Grid computing is the collection of computer resources from multiple places to reach a common goal. The grid can be thought of as a distributedHYPERLINK "https://en.wikipedia.org/wiki/Distributed_system" HYPERLINK "https://en.wikipedia.org/wiki/Distributed_system"system with non-interactive workloads that involve a large number of files. Grid computing is distinguished from conventional high-performance computing systems such as cluster computing in that grid computers have each node set to perform a different task/application.
89 Grid computers also tend to be more heterogeneous and geographically dispersed (thus not physically coupled) than cluster computers. Although a single grid can be dedicated to a particular application, commonly a grid is used for a variety of purposes. Grids are often constructed with general-purpose grid middleware software libraries.Â
90
91Grid Architecture Layer:
92Grid computing is a distributed architecture of large numbers of computers connected to solve a complex problem. In the grid computing model, servers or personal computers run independent tasks and are loosely linked by the Internet or low-speed networks. Computers may connect directly or via scheduling systems.
93
94
95
96
97OGSA&OGSI Architecture:
98
99Cloud Computing:
100 Cloud computing is an informationHYPERLINK "https://en.wikipedia.org/wiki/Information_technology" HYPERLINK "https://en.wikipedia.org/wiki/Information_technology"technology (IT) paradigm that enables ubiquitous access to shared pools of configurable systemHYPERLINK "https://en.wikipedia.org/wiki/System_resource" HYPERLINK "https://en.wikipedia.org/wiki/System_resource"resources and higher-level services that can be rapidly provisioned with minimal management effort, often over the Internet. Cloud computing relies on sharing of resources to achieve coherence and economiesHYPERLINK "https://en.wikipedia.org/wiki/Economies_of_scale" HYPERLINK "https://en.wikipedia.org/wiki/Economies_of_scale"ofHYPERLINK "https://en.wikipedia.org/wiki/Economies_of_scale" HYPERLINK "https://en.wikipedia.org/wiki/Economies_of_scale"scale, similar to a publicHYPERLINK "https://en.wikipedia.org/wiki/Public_utility" HYPERLINK "https://en.wikipedia.org/wiki/Public_utility"utility.
101
102Types of Cloud Computing:
103Based on a cloud location, we can classify cloud as:
104 • public,
105 • private,
106 • hybrid
107 • community cloud
108Public cloud:
109The public cloud is defined as computing services offered by third-party providers over the public Internet, making them available to anyone who wants to use or purchase them. They may be free or sold on-demand, allowing customers to pay only per usage for the CPU cycles, storage or bandwidth they consume.
110
111PRIVATE CLOUD:
112A private cloud is a cloud computing hardware and software platform that is dedicated to your organization. Private clouds hosted at Cybercon data center provides you the freedom to choose: network routers and switches, firewalls, server hardware, storage systems, and cloud computing software. Our solutions are designed and built to give you the power to construct and manage clouds across your internal data centers and Cybercon data centre on terms that you control. This means that you can keep a handle on compliance, security, and costs. And you can let your business needs drive your IT strategy, instead of having IT limit your options.
113
114HYBRID CLOUD:
115 Hybrid cloud is a cloud computing environment that uses a mix of on-premises, private cloud and third-party, public cloud services with orchestration between the two platforms. By allowing workloads to move between private and public clouds as computing needs and costs change, hybrid cloud gives businesses greater flexibility and more data deployment options.
116
117
118COMMUNITY CLOUD:
119 A community cloud is a cloud service model that provides a cloud computing solution to a limited number of individuals or organizations that is governed, managed and secured commonly by all the participating organizations or a third party managed service provider.
120
121Based on a service that the cloud is offering,
122 • IaaS (Infrastructure-as-a-Service)
123 • PaaS (Platform-as-a-Service)
124 • SaaS (Software-as-a-Service)
125 • or, Storage, Database, Information, Process, Application, Integration, Security, Management, Testing-as-a-service
126Infrastructure as a service:
127 Infrastructure as a service (IaaS) refers to online services that provide high-level APIs used to dereference various low-level details of underlying network infrastructure like physical computing resources, location, data partitioning, scaling, security, backup etc. A hypervisor, such as Xen, Oracle VirtualBox, Oracle VM, KVM, VMware ESX/ESXi, or Hyper-V, LXD, runs the virtual machines as guests..
128
129
130Platform-as-a-Service:
131Platform as a Service (PaaS) or application platform as a Service (aPaaS) or platform base service is a category of cloud computing services that provides a platform allowing customers to develop, run, and manage applications without the complexity of building and maintaining the infrastructure typically associated with developing and launching an app. PaaS can be delivered in three ways:
132 • As a public cloud service from a provider, where the consumer controls software deployment with minimal configuration options, and the provider provides the networks, servers, storage, operating_system (OS), middleware (e.g. Java runtime, .NET runtime, integration, etc.), database and other services to host the consumer's application.
133 • As a private service (software or appliance) behind a firewall.
134 • As software deployed on a public infrastructure as a service.
135
136Software-as-a-Service:
137Software as a service (SaaS /sæs/) is a software licensing and delivery model in which software is licensed on a subscription basis and is centrally hosted. It is sometimes referred to as "on-demand software", and was formerly referred to as "software plus services" by Microsoft. SaaS is typically accessed by users using a thin client via a web browser. SaaS has become a common delivery model for many business applications, including office software, messaging software, payroll processing software, DBMS software, management software, CAD_software,_development_software, gamification, virtualization, accounting, collaboration, customer_relationship_management (CRM).Â
138
139
140
141Merits:
142 • Flexibility
143 • Efficiency
144 • Strategic value
145 • Cost savings
146 • Manageability
147Demerits:
148 • Downtime
149 • Security
150 • Vendor Lock-In
151 • Limited Control
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172Result:
173 Thus the study experiment for grid and cloud computing was learned successfully.
174Ex. No: 3
175EXECUTION OF LINUX COMMANDS IN UBUNTU
176Date:
177
178
179AIM:
180 To study the linux commands and execute the linux commands in Ubuntu.
181LINUX COMMANDS:
182 Linux is one of popular version of UNIX operating System. It is open source as its source code is freely available. It is free to use. Linux was designed considering UNIX compatibility. Its functionality list is quite similar to that of UNIX.
183 Components of Linux System:
184Linux Operating System has primarily three components
185 • Kernel − Kernel is the core part of Linux. It is responsible for all major activities of this operating system. It consists of various modules and it interacts directly with the underlying hardware. Kernel provides the required abstraction to hide low level hardware details to system or application programs.
186 • System Library − System libraries are special functions or programs using which application programs or system utilities accesses Kernel's features. These libraries implement most of the functionalities of the operating system and do not requires kernel module's code access rights.
187 • System Utility − System Utility programs are responsible to do specialized, individual level tasks.
188 Kernel Mode vs User Mode:
189 Kernel component code executes in a special privileged mode called kernel mode with full access to all resources of the computer. This code represents a single process, executes in single address space and do not require any context switch and hence is very efficient and fast. Kernel runs each processes and provides system services to processes, provides protected access to hardware to processes.
190Basic Commands:
1911. Date Command:
192 This command is used to display the current data and time.
193 Syntax:
194 $date
1952. Calender Command:
196 This command is used to display the calendar of the year or the particular month of calendar year.
197Syntax:
198 a. $cal <year>
199 b. $cal <month> <year>
200 Here the first syntax gives the entire calendar for given year & the second Syntax gives the calendar of reserved month of that year.
2013. Echo Command:
202 This command is used to print the arguments on the screen.
203 Syntax:
204 $echo <text>
2054. Banner Command:
206 It is used to display the text in ‘#’ symbol .It displays the text in the form of a banner.
207Syntax :
208 $banner <arguments>
2095.’who’ Command:
210 It is used to display who are the users connected to our computer currently.
211 Syntax:
212 $who
2136.’who am i’ Command:
214 Display the details of the current working directory.
215 Syntax:
216 $who am i
2177.’tty’ Command:
218 It will display the terminal name.
219 Syntax:
220 $tty
2218.’CLEAR’ Command:
222It is used to clear the screen.
223 Syntax:
224 $clear
2259.’MAN’ Command:
226It helps us to know about the particular command and its options & working. It is like ‘help’ command in windows.
227 Syntax:
228 $man <command name>
22910. LIST Command:
230 It is used to list all the contents in the current working directory.
231 Syntax:
232 $ ls – options <arguments>
233If the command does not contain any argument means it is working in the Current directory.
234 Options:
235 a– used to list all the files including the hidden files.
236 c– list all the files columnwise.
237 d- list all the directories.
238 m- list the files separated by commas.
239 p- list files include ‘/’ to all the directories.
240 r- list the files in reverse alphabetical order.
241 f- list the files based on the list modification date.
242 x-list in column wise sorted order.
243DIRECTORY RELATED COMMANDS:
2441. Present Working Directory Command:
245 To print the complete path of the current working directory.
246 Syntax:
247 $pwd
2482. MKDIR Command:
249 To create or make a new directory in a current directory.
250 Syntax:
251 $mkdir <directory name>
2523. CD Command:
253 To change or move the directory to the mentioned directory .
254 Syntax: $cd <directory name>.
2554. RMDIR Command:
256 To remove a directory in the current directory & not the current directory itself.
257 Syntax:
258 $rmdir <directory name>
259
260FILE RELATED COMMANDS:
2611. CREATE A FILE:
262 To create a new file in the current directory we use CAT command.
263Syntax:
264 $cat > filename.
2652. DISPLAY A FILE:
266 To display the content of file mentioned we use CAT command without ‘>’ operator.
267 Syntax:
268 $cat filename.
2693. COPYING CONTENTS:
270 To copy the content of one file with another. If file doesnot exist, a new file is created and if the file exists with some data then it is overwritten.
271 Syntax :
272 $ cat <source filename> >> <destination filename>
2734. SORTING A FILE:
274 To sort the contents in alphabetical order in reverse order.
275 Syntax:
276 $sort <filename >
277 Option: $ sort –r <filename>
2785. COPYING CONTENTS FROM ONE FILE TO ANOTHER:
279 To copy the contents from source to destination file so that both contents are same.
280 Syntax: $cp <source filename> <destination filename>
281 $cp <source filename path > <destination filename path>
2826. MOVE Command:
283 To completely move the contents from source file to destination file and to remove the source file.
284 Syntax:
285 $ mv <source filename> <destination filename>
2867. REMOVE Command:
287 To permanently remove the file we use this command.
288 Syntax:
289 $rm <filename>
2908. WORD Command:
291 To list the content count of no of lines, words, characters.
292 Syntax:
293 $wc<filename>
294 Options:
295 -c – to display no of characters.
296 -l – to display only the lines.
297 -w – to display the no of words.
298
2999. LINE PRINTER:
300 To print the line through the printer, we use lp command.
301 Syntax: $lp <filename>
30210. PAGE Command:
303 This command is used to display the contents of the file page wise & next page can be viewed by pressing the enter key.
304 Syntax:
305 $pg <filename>
306
30711. FILTERS AND PIPES
308HEAD: It is used to display the top ten lines of file.
309 Syntax: $head<filename>
310
311TAIL: This command is used to display the last ten lines of file.
312 Syntax: $tail<filename>
313PAGE: This command shows the page by page a screenfull of information is displayed after which the page command displays a prompt and passes for the user to strike the enter key to continue scrolling.
314 Syntax: $ls –a\p
315MORE: It also displays the file page by page .To continue scrolling with more command, press the space bar key.
316 Syntax: $more<filename>
317GREP: This command is used to search and print the specified patterns from the file. Syntax: $grep [option] pattern <filename>
318SORT: This command is used to sort the datas in some order.
319 Syntax: $sort<filename>
320PIPE: It is a mechanism by which the output of one command can be channeled into the input of another command.
321 Syntax: $who | wc-l
322TR: The tr filter is used to translate one set of characters from the standard inputs to another.
323 Syntax: $tr “[a-z]†“[A-Z]â€
324COMMUNICATION THROUGH UNIX COMMANDS
325Command: MESG
326 Description: The message command is used to give permission to other users to send message to your terminal.
327 Syntax: $mesg y
328Command: WRITE
329Description: This command is used to communicate with other users, who are logged in at the same time.
330Syntax: $write <user name>
331Command: WALL
332Description: This command sends message to all users those who are logged in using the unix server.
333Syntax: $wall <message>
334Command: MAIL
335Description: It refers to textual information, that can be transferred from one user to another
336Syntax: $mail <user name>
337 Command: REPLY
338 Description: It is used to send reply to specified user.
339 Syntax: $reply<user name>
340
341
342vi EDITOR COMMANDS
343The vi editor is a visual editor used to create and edit text, files, documents and programs. It displays the content of files on the screen and allows a user to add, delete or change part of text. There are three modes available in the vi editor, they are
344 1. Command mode
345 2. Input (or) insert mode.
346The vi editor is invoked by giving the following commands in UNIX prompt.
347 Syntax: $vi <filename> (or)$vi
348 Options :
349 1.vi +n <filename> - this would point at the nth line (cursor pos).
350 2.vi –n <filename> - This command is to make the file to read only to change from one mode to another press escape key.
351INSERTING AND REPLACING COMMANDS:
352To move editor from command node to edit mode, you have to press the <ESC> key. For inserting and replacing the following commands are used.
3531. ESC a Command:
354This command is used to move the edit mode and start to append after the current character.
355 Syntax : <ESC> a
3562. ESC A COMMAND :
357This command is also used to append the file , but this command append at the end of current line.
358 Syntax: <ESC> A
3593. ESC i Command:
360 This command is used to insert the text before the current cursor position.
361 Syntax: <ESC> i
3624. ESC I Command:
363 This command is used to insert at the beginning of the current line.
364 Syntax: <ESC> I
3655. ESC o Command:
366This command is insert a blank line below the current line & allow insertion of contents.
367 Syntax: <ESC> o
3686. ESC O Command:
369This command is used to insert a blank line above & allow insertion of contents.
370 Syntax : <ESC> O
3717. ESC r Command :
372 This command is to replace the particular character with the given
373 characters.
374 Syntax: <ESC> rx Where x is the new character.
3758. ESC R Command:
376 This command is used to replace the particular text with a given text.
377Syntax: <ESC> R text
3789. <ESC> s Command:
379 This command replaces a single character with a group of character.
380 Syntax: <ESC> s
38110.<ESC> S Command :
382 This command is used to replace a current line with group of characters. Syntax : <ESC> S
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431RESULT:
432 Thus the execution of linux commands in ubuntu environment was executed successfully.
433
434
435
436
437
438
439
440Ex. No: 4
441Installation of C compiler in the virtual machine
442Date:
443
444Aim:
445To install a C compiler in the virtual machine and execute some sample program in cloud environment.
446PROCEDURE:
447STEP 1: Click oracle VM Virtual Box (opened)
448STEP 2: Click File [Oracle Virtual Box Manager]
449STEP 3: Click Import Appliance
450Appliance to Import
451
452Click browser (go to D: or E :)
453STEP 4: In D: or E:, Click Hadoop & open nebula folder
454STEP 5: In that, click ubuntu-grid (open)
455STEP 6: Click next
456STEP 7: Click import
457STEP 8:
458Import virtual disk image
459(It will take time to import)
460STEP 9: Click ubuntu *(click start)
461STEP 10: Click ok
462STEP 11:
463File machine view input devices help
464User name:
465Dinesh
466Password:
46799425
468
469STEP 12:
470
471
472Click here and type terminal
473Or
474Directly click terminal
475
476STEP 13: To open a new file..Syntax: $vi filename.c
477STEP 14:
478~
479~
480Go to insert mode
481Click esc+i
482STEP 15: After typing C program press esc+:wq(to save & quit)
483STEP 16: cc Filename.c (to compile)
484STEP 17:./a.out(to run)
485
486Program 1: Switch case
487#include<stdio.h>
488void main()
489{
490int a,b,ch;
491int c;
492printf("Enter two numbers\n");
493scanf("%d%d",&a,&b);
494do
495{
496printf("\nEnter your choice\n");
497scanf("%d",&ch);
498switch(ch)
499{
500case 1:
501printf("Addition is %d",a+b);
502break;
503case 2:
504printf("Subtraction is %d",a-b);
505break;
506case 3:
507printf("Multiplication is %d",a*b);
508break;
509case 4:
510printf ("Division is %d", a/b);
511break;
512default:
513printf ("Enter valid choice");
514break;
515}
516printf("Do you want to continue y/n");
517scanf("%d",&c);
518}while(c==0);
519}
520output:
521Enter two numbers
5223
5232
524Enter your choice
5251
526Addition is 5
527Do you want to continue 0/1
5280
529Enter your choice
5305
531Enter valid choice
532Do you want to continue 0/1
5331
534
535
536program2 : Armstrong Number
537#include<stdio.h>
538void main()
539{
540int n,a=0,r=0,rf=0;
541printf("Enter the number\n");
542scanf("%d",&n);
543a=n;
544while(n!=0)
545{
546r=n%10;
547rf+=r*r*r;
548n=n/10;
549}
550if(rf==a)
551printf("entered number is armstrong number");
552else
553printf("entered number is not an armstrong number");
554}
555Output:
556Enter the number
557153
558entered number is armstrong number
559
560
561program 3: Factorial
562#include<stdio.h>
563void main()
564{
565int n,f=1,i;
566printf("Enter the number\n");
567scanf("%d",&n);
568for(i=1;i<=n;i++)
569f=f*i;
570printf("factorial of %d is %d",n,f);}
571output:
572Enter the number:4
573factorial of 4 is 24
574
575
576
577
578
579Program 4: Addition of two numbers
580include<stdio.h>
581void main()
582{
583int a,b,c;
584printf("enter two numbers");
585scanf("%d%d",&a,&b);
586c=a+b;
587printf("Sum of a and b is %d",c);
588}
589
590Output:
591Enter two numbers
59223
59327
594Sum of a and b is 50
595
596
597Program 5: Palindrome
598#include<stdio.h>
599void main()
600{
601printf("Enter the number");
602
603int n,a=0,r=0,rf=0;
604scanf("%d",&n);
605a=n;
606while(n!=0)
607{
608r=n%10;
609rf=rf*10+r;
610n=n/10;
611}
612if(rf==a)
613printf("Entered number is palindrome");
614else
615printf("Entred number is not palindrome");
616}
617
618Output:
619Enter the number
62033
621Entered number is palindrome
622
623
624Program 6: Multiplication Table
625#include<stdio.h>
626void main()
627{
628int m,n,i;
629printf("Enter which table you want");
630scanf("%d",&m);
631printf("Enter the range of the table");
632scanf("%d",&n);
633for(i=1;i<=n;i++)
634printf("%d x %d = %d \n",i,m,i*m);
635}
636Output:
637Enter which table you want
6382
639Enter the range of the table
6403
6411 x 2 = 2
6422 x 2 = 4
6433 x 2 = 6
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661Result:
662 Thus C compiler is installed in virtual machine and some sample programs are executed and verified in cloud environment.
663
664Ex. No: 5
665RUNNING VM’S OF DIFFERENT CONFIGURATION
666 IN OPEN NEBULA
667Date:
668
669AIM:
670To find procedure to run the virtual machine of different configuration and to check how
671 many virtual machines can be utilized at particular time.
672PROCEDURE:
673Install Open nebula sandbox:
674 1. Open Virtual box
675 2. File ïƒ import Appliance
676 3. Browse OpenNebula-Sandbox-5.0.ova file
677 4. Then go to setting, select Usb and choose USB 1.1
678 5. Then Start the Open Nebula
679 6. Login using username: root, password:opennebula
680
681
682
683Procedure to run the virtual machine of different configuration and to check how many
684virtual machines can be utilized at particular time:
685 1. Open Browser, type localhost:9869
686 2. Login using username: oneadmin, password: opennebula
687 3. Click on instances, select VMs then follow the steps to create Virtaul machine
688 a. Expand the + symbol
689 b. Select user oneadmin
690 c. Then enter the VM name,no.of instance, cpu.
691 d. Then click on create button.
692 e. Repeat the steps the C,D for creating more than one VMs.
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720RESULT:
721Thus to find procedure to run the virtual machine of different configuration and to check how many virtual machines can be utilized at particular time using open nebula is done and verified.
722
723
724
725
726Ex. No: 6
727PROCEDURE TO ATTACH VIRTUAL BLOCK TO THE VM
728Date:
729
730AIM:
731 To find procedure to attach virtual block to the virtual machine and to check whether it holds the data even after the release of the virtual machine.
732PROCEDURE:
733 Method 1:
734 1. Open the virtual box
735 2. Power off the VM which you want to add virtual box
736 3. Then right click on that VM,select setting
737 4. Then click on storage,find controller IDE .
738 5. In the top right find add hard disk icon, the pop up window display
739 6. On that window select create new disk, and then click next and next then finish.
740 7. Then find attributes icon ,hard disk as IDE secondary slave.
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761Method 2:
762 1. Open Browser, type localhost:9869
763 2. Login using username: oneadmin, password: opennebula
764 3. Click on instances, select VMs then follow the steps to add virtual block
765 a. Select any one VM from the list and power off the VM
766 b. Then click on that VM ,find the storage tab then click on that
767 c. Then find the attach disk button
768 d. Click on that button ,the new pop window display
769 e. On that window select either image or volatile disk
770 f. Click on attach button.
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790RESULT:
791 Thus to find procedure to attach virtual block to the virtual machine and to check whether it holds the data even after the release of the virtual machine is executed and verified.
792
793Ex. No: 7
794The Virtual Machine Migration
795Date:
796
797
798AIM:
799Learning the procedure to migrate the virtual machine from one host to another, perform the virtual machine migration and show the virtual machine migration based on certain condition from one node to the other.
800PROCEDURE:
801 1. Open Browser, type localhost:9869
802 2. Login using username: oneadmin, password: opennebula
803 3. Then follow the steps to migrate VMs
804 a. Click on infrastructure
805 b. Select clusters and enter the cluster name
806 c. Then select host tab, and select all host
807 d. Then select Vnets tab, and select all vnet
808 e. Then select data stores tab, and select all data stores
809 f. And then choose host under infrastructure tab
810 g. Click on + symbol to add new host, name the host then click on create.
811 4. on instances, select VMs to migrate then follow the steps
812 a. Click on 8th icon ,the drop down list display
813 b. Select migrate on that ,the popup window display
814 c. On that select the target host to migrate then click on migrates.
815Before migration
816 Host: naveenkumar
817
818
819
820
821
822
823Host:one-sandbox
824
825
826
827
828
829After Migration:
830
831
832
833
834
835Host:one-sandbox
836
837Host:naveenkumar
838
839
840
841
842
843
844
845RESULT:
846 The procedure of creating the host with an existing image file and migrating the virtual machine is practiced and recorded through this experiment.
847
848Ex.No: 8 Develop a new Web Service for Calculator
849Date:
850Aim:
851To develop a web service program for a calculator.
852Procedure:
853Step1. Open netbeans and go to New
854
855
856
857
858
859
860
861
862
863
864
865
866
867Step 2. Choose Java Web and select Web Application and give next.
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884Step 3. Enter the project name and give next and Select the Server either tomcat or glas
885
886
887
888
889
890
891
892
893
894Step 4. Give next and select finish
895Step 5. Right click the WebApplication (Projec Name) and Select New, and choose Java Class
896
897
898
899
900
901
902
903
904
905Step 6. Type the following code
906import javax.jws.WebMethod;
907import javax.jws.WebParam;
908import javax.jws.WebService;
909
910@WebService(serviceName="MathService", targetNamespace = "http://my.org/ns/") public class MathService {
911@WebMethod(operationName = "hello"
912public String hello(@WebParam(name="name")String txt){ return "Hello"+txt+"!";
913}
914@WebMethod(operationName = "addSer"
915public String addSer(@WebParam(name="value1")int v1, @WebParam(name = "value2")int v2){
916return "Answer:" +(v1+v2)+"!";
917}
918@WebMethod(operationName = "subSer")
919public String subSer(@WebParam(name="value1")int v1, @WebParam(name = "value2")int v2){
920return "Answer:" +(v1-v2)+"!";
921}
922@WebMethod(operationName = "mulSer")
923public String mulSer(@WebParam(name="value1")int v1, @WebParam(name = "value2")int v2){
924return "Answer:" +(v1*v2)+"!";
925}
926@WebMethod(operationName = "divSer")
927public String divSer(@WebParam(name="value1")int v1, @WebParam(name = "value2")int v2){float res= 0; try
928{res = ((float)v1)/((float) v2); return "Answer:" +res+"!";
929}
930catch(ArithmeticException e){ System.out.println("Can't be divided by Zero"+e); return "Answer:" +e.getMessage().toString()+"!!!";
931}
932}
933}
934Step 7. Run Project by pressing F6 key or Run button.
935Step 8. Check Web browser
936for the following name is available else give it http://localhost:8080/Web pplication2/Math ervice?Tester
937MathService?Tester ---> represents the java class name
938
939
940
941
942
943
944
945
946
947
948 Output Screen:
949Give some value in the fields and check the out put by pressing enter key.
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973Finally select the WSDL link
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999PREPARATION
100030
1001
1002PERFORMANCE
100330
1004
1005RECORD
100640
1007
1008TOTAL
1009100
1010
1011
1012Result:
1013 Thus the program on calculator for web services is executed successfully.
1014Ex.No: 9 Implementation Of OGSA using windows
1015Date:
1016
1017
1018Aim:
1019 To develop a new OGSA- Compliant web service using windows.
1020
1021Procedure:
1022I . Setup the Development Environment
1023
10241.1. First you need to set up the development environment. Following things are needed if you want to create Web Services using Axis2 and Eclipse IDE.Â
1025
1026Some Eclipse versions have compatibility issues with Axis2. This tutorial is tested with Apache Axis2 1.5.2, Eclipse Helios and Apache Tomcat 6.
1027
10281) Apache Axis2 Binary Distribution -Â DownloadÂ
10292) Apache Axis2 WAR Distribution -Â DownloadÂ
10303) Apache Tomcat -Â DownloadÂ
10314) Eclipse IDE – DownloadÂ
10325) Java installed in your Computer – DownloadÂ
1033
10341.2. Then you have to set the environment variables for Java and Tomcat. There following variables should be added.
10351
10362
10373
1038JAVA_HOME :- Set the value to jdk directory (e.g. C:\Program Files\Java\jdk1.6.0_21)
1039TOMCAT_HOME :- Set the value to top level directory of your Tomcat install (e.g. D:\programs\apache-tomcat-6.0.29)
1040PATH :- Set the value to bin directory of your jdk (e.g. C:\Program Files\Java\jdk1.6.0_21\bin)
10411.3. Now you have to add runtime environment to eclipse. There go to Windows –-> Preferences and Select the Server --> Runtime Environments.
1042
1043
1044
1045There select Apache Tomcat v6.0 and in the next window browse your Apache installation directory and click finish.
1046
1047
1048
10491.4. Then click on the Web Service –-> Axis2 Preferences and browse the top level directory of Apache Axis2 Binary Distribution.
1050
1051
1052
1053II. Creating the Web Service Using Bottom-Up Approach
1054
10552.1 First create a new Dynamic Web Project (File --> New –-> Other…) and choose Web --> Dynamic Web Project.
1056
1057
1058
10592.2 Set Apache Tomcat as the Target Runtime and click Modify to install Axis2 Web Services project facet.
1060
1061
1062
10632.3 Select Axis2 Web Services
1064
1065
1066
10672.4 Click OK and then Next. There you can choose folders and click Finish when you are done.
1068
1069III. Create Web Service Class
1070
1071Now you can create a Java class that you would want to expose as a Web Service. I’m going to create new class called FirstWebService and create public method called addTwoNumbers which takes two integers as input and return the addition of them.
1072
10733.1 Right Click on MyFirstWebService in Project Explorer and select New –-> Class and give suitable package name and class name. I have given com.sencide as package name and FirstWebService as class name.
1074
1075
1076package com.sencide;
1077public class FirstWebService {
1078 public int addTwoNumbers(int firstNumber, int secondNumber){
1079 return firstNumber + secondNumber;
1080 }
1081}
10823.2 Then, select File --> New –-> Other and choose Web Service.
1083
1084
1085
10863.3 Select the FirstWebService class as service implementation and to make sure that the Configuration is setup correctly click on Server runtime.
1087
1088
1089
10903.4 There set the Web Service runtime as Axis2 (Default one is Axis) and click Ok.
1091
1092
1093
10943.5 Click Next and make sure Generate a default service.xml file is selected.Â
1095
1096
1097
10983.6 Click Next and Start the Server and after server is started you can Finish if you do not want to publish the Web service to a test UDDI repository.
1099
1100
1101
1102You can go to http://localhost:8888/MyFirstWebService/services/listServices to see your running service which is deployed by Axis2. You can see the WSDL by clicking the link FirstWebService.
1103
1104
1105
1106
1107
1108
1109
1110
1111Result:
1112 Thus a new OGSA- Compliant web service is developed and verified using windows .
1113Ex.No:10 To develop a new OGSA complaint Webservice.(Ubuntu-grid)
1114Date:
1115Aim:
1116 To develop a new OGSA complaint Webservice
1117Procedure:
1118Step 1: Choose New Project from the main menu
1119
1120
1121
1122
1123
1124
1125
1126
1127Step 2: Select POM project from the maven category
1128
1129
1130
1131
1132
1133
1134
1135Step 3: Type MavenOSGiCDIProject as the project name and click finish. When you click finish, the IDE creates the POM project and opens the project in the project window.
1136
1137
1138
1139
1140
1141
1142
1143Step 4: Expand the project files node in the project window and double – click pom.xml to open the file in editor and do the modification in the file and save.
1144In pom.xml file
1145<?xml version="1.0" encoding="UTF-8"?>
1146<project xmlns="http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XML chema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.mycompany</groupId>
1147<artifactId>MavenO GiCDIProject</artifactId> <version>1.0-SN PSHOT</version> <packaging>pom</packaging><properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencyManagement><dependencies><dependency> <groupId>org.osgi</groupId>
1148<artifactId>org.osgi.core</artifactId>
1149<version>4.2.0</version>
1150<scope>provided</scope>
1151</dependency></dependencies></dependencyManagement>
1152</project>
1153Step 5:Creating OGSi Bundle Projects
1154Choose File -> New Project to open the New Project Wizzard
1155Step 6 : Choose OGSI Bundle from Maven category. Click Next
1156
1157
1158
1159
1160
1161
1162
1163
1164Step 7: Creating MavenHelloService pi as the Project Name for OGSi Bundle
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174The IDE creates the bundle project and opens the project in the Project Window. And check thebuilding pugins at pom.xml under project files.
1175
1176
1177
1178
1179
1180
1181
1182As well as it will create org.osgi.core artifact as default and it can be view at under Dependencies.
1183Step 7: Buid the MavenHello ervice pi Project by
1184
11851. Right Click the MavenHello ervice pi project node in the project window and choose properties.
1186
1187
1188
1189
1190
1191
1192 2. Select the source category in the project project dialog box
1193 3. Set the Source/Binary Format to 1.6 and confirm that the Encoding is UTF-8 and click ok
1194
1195
1196
1197
1198
1199
1200 4. Right click the source package node in the project window and choose New -> JavaInterface
1201 5. Type Hello for the Class Name
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211 6. Select com.mycompany.mavenhelloserviceapi as the Package. Click finish.
1212 7. Add the following sayHello method to the interface and save the changes.
1213package com.mycompany.mavenhelloserviceapi;
1214public interface Hello {
1215 String sayHello(String name);
1216}
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231 8. Right click the project node in the project window and choose build.
1232
1233 9. After building the project, open files window and expand the project node such that you can see MavenHelloServiceApi-1.0-SN PSHOT.jar is created in the target folder.
1234
1235
1236
1237
1238
1239
1240
1241Step 8: Creating the MavenHelloServiceImpl Implementation Bundle
1242Here you will create the MavenHelloServiceImpl in the POM Project.
1243 1. Choose File -> New Project to open the New Project Wizard
1244 2. Choose OSGi Bundle from the Maven category. Click Next.
1245 3. Type MavenHelloServiceImpl for the Project Name
1246 4. Click Browse and select the MavenOSGiCDIProject POM project as the Location. Click Finish.(As earlier step).
1247 5. Right click the project node in the Projects window and choose Properties.
1248 6. Select the Sources category in the Project Properties dialog box.
1249 7. Set the Source/Binary Format to 1.6 and confirm that the Encoding is UTF-8. Click OK.
1250 8. Right click Source Packages node in the Projects window and choose New -> Java Class.
1251 9. Type HelloImpl for the Class Name.
1252 10. Select com.mycompany.mavenhelloserviceimpl as the Package. Click Finish.
1253 11. Type the following and save your changes
1254package com.mycompany.mavenhelloserviceimpl;
1255public class HelloImpl implements Hello { public String sayHello(String name){
1256return "Hello" +name;
1257}}
1258 When you implement Hello, the IDE will display an error that you need to resolve by adding the MavenHelloServiceApi project as a dependency.
125912. Right click the Dependencies folder of MavenHelloServiceImpl in the Projects window and choose Add Dependency.
126013. Click the Open Projects tab in the dd Library dialog. 14. Select MavenHello ervice pi O Gi Bundle. Click dd
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272 14. Expand the com.mycompany.mavenhelloserviceimpl package and double click Activator.java and open the file in editor.
1273
1274The IDE automatically creates the Activator.java bundle and its manage the lifecycle of bundle. By default it includes start() and stop().Modify the start() and Stop() methods in the bundle activator class by adding thefollowing lines.
1275package com.mycompany.mavenhelloserviceimpl;
1276import org.osgi.framework.BundleActivator;
1277import org.osgi.framework.BundleContext;
1278public class Activator implements BundleActivator {
1279public void start(BundleContext context) throws Exception { // TODO add activation code here
1280System.out.println("HelloActivator::start"); context.registerService(Hello.class.getName(),new HelloImpl(),null); System.out.println("HelloActivator::registration of Hello Service Successfull");
1281}
1282public void stop(BundleContext context) throws Exception { // TODO add deactivation code here
1283context.ungetService(context.getServiceReference(Hello.class.get ame())); System.out.println("HelloActivator stopped");
1284}
1285}
1286
1287
1288
1289
1290
1291
1292
1293
1294Step 9: Bulding and Deploying the OSGi Bundles
1295Here you will build the OSGi bundles and deploy the bundles to GlassFish
12961. Right click the MavenOSGiCDIProject folder in the Projects window and choose Clean and Build.
1297## When you build the project the IDE will create the JAR files in the target folder and aslo install the snapshot JAR in the local repository.
1298## In file window, by expanding the target folder of each of the two bundle projects it will show two JAR archieves(MavenHelloServiceApi-1.0-SNAPSHOT.jar and MavenHElloServiceImpl-1.0-SNAPSHOT.jar.)
1299
1300
1301
1302
1303
1304
1305
1306 2. Start the GlassFish server (if not already started)
1307 3. Copy the MavenHelloService pi-1.0-SN PSHOT.jar to the /home/linux/glassfish-4.1.1/glassfish/domains/domain1/autodeploy/bundles ( GlassFish installed Directory)
1308 4. You can see output similar to the following in the GlassFish Server log in the output window.
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318Info: Installed /home/linux/glassfish-4.1.1/glassfish/domains/domain1/autodeploy/bundles/MavenHelloServiceApi-1.0-SNAPSHOT.jar
1319Info: Started bundle: file:/home/linux/glassfish-
13204.1.1/glassfish/domains/domain1/autodeploy/bundles/MavenHelloServiceApi-1.0-SNAPSHOT.jar
1321Info: Started bundle: file:/home/linux/glassfish-4.1.1/glassfish/domains/domain1/autodeploy/bundles/MavenHelloServiceApi-1.0-SNAPSHOT.jar
13225. Repeat the step of copying the MavenHelloServiceImpl-1.0-SNAPSHOT.jar to the/home/linux/glassfish-4.1.1/glassfish/domains/domain1/autodeploy/bundles
1323( GlassFish installed Directory)
13246. You can see the output athe glassfish server log
1325
1326
1327
1328
1329
1330
1331
1332Info: Installed /home/linux/glassfish 4.1.1/glassfish/domains/domain1/autodeploy/bundles/MavenHelloServiceImpl-1.0-SNAPSHOT.jarInfo: Hello ctivator::start
1333Info: Hello ctivator::registration of Hello ervice uccessfull Info: Started bundle: file:/home/linux/glassfish-4.1.1/glassfish/domains/domain1/autodeploy/bundles/MavenHelloServiceImpl-1.0-SN PSHOT.jar
1334Info: Started bundle: file:/home/linux/glassfish-4.1.1/glassfish/domains/domain1/autodeploy/bundles/MavenHelloServiceImpl-1.0-SN PSHOT.jar
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353Result:
1354Thus a new OGSA- complaint web service has been executed successfully.
1355
1356Ex.No:11 To develop a Grid Service using Apache Axis
1357Date:
1358
1359Aim:
1360 To develop a Grid Service using Apache Axis
1361Procedure:
1362Using Apache Axis develop a Grid Service.
1363 1. Open the terminal
1364 2. Type cd /opt/axis2/axis2-1.7.3/bin then press enter
1365 3. Type chmod 500 axis2server.sh
1366 4. Type ./axis2server.sh
1367 5. Then open browser on ubuntu type the URL as localhost:8080/axis2/services
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400Result:
1401Thus Grid Service using Apache Axis has been executed successfully.
1402
1403Ex.No:12 Develop applications using Java or C/C++ Grid APIs
1404Date:
1405Aim:
1406 To Develop applications using Java or C/C++ Grid APIs
1407Procedure:
1408Develop applications using Java or C/C++ Grid APIs
1409
1410 a. Open the terminal
1411 b. Type cd /opt/axis2/axis2-1.7.3/bin then press enter
1412 c. gedit hello.c
1413 d. gcc hello.c
1414 e. ./a.out
1415Program 1: Switch case
1416#include<stdio.h>
1417void main()
1418{
1419int a,b,ch;
1420int c;
1421printf("Enter two numbers\n");
1422scanf("%d%d",&a,&b);
1423do
1424{
1425printf("\nEnter your choice\n");
1426scanf("%d",&ch);
1427switch(ch)
1428{
1429case 1:
1430printf("Addition is %d",a+b);
1431break;
1432case 2:
1433printf("Subtraction is %d",a-b);
1434break;
1435case 3:
1436printf("Multiplication is %d",a*b);
1437break;
1438case 4:
1439printf("Division is %d",a/b);
1440break;
1441default:
1442printf("Enter valid choice");
1443break;
1444}
1445printf("Do you want to continue y/n");
1446scanf("%d",&c);
1447}while(c==0);
1448}
1449
1450output:
1451Enter two numbers
14523
14532
1454Enter your choice
14551
1456Addition is 5
1457Do you want to continue 0/1
14580
1459Enter your choice
14605
1461Enter valid choice
1462Do you want to continue 0/1
14631
1464
1465
1466
1467
1468program2 : Armstrong Number
1469
1470#include<stdio.h>
1471void main()
1472{
1473int n,a=0,r=0,rf=0;
1474printf("Enter the number\n");
1475
1476scanf("%d",&n);
1477a=n;
1478while(n!=0)
1479{
1480r=n%10;
1481rf+=r*r*r;
1482n=n/10;
1483}
1484if(rf==a)
1485printf("entered number is armstrong number");
1486else
1487printf("entered number is not an armstrong number");
1488}
1489output:
1490Enter the number
1491153
1492entered number is armstrong number
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502Result:
1503Thus applications using Java or C/C++ Grid APIs has been executed successfully.
1504Ex.No:13 Develop secured applications using basic security mechanisms
1505Date:
1506
1507Aim:
1508 To develop secured applications using basic security mechanisms available in Globus Toolkit
1509Procedure:
1510 Develop secured applications using basic security mechanisms available in Globus
1511Toolkit.
1512 1. Follow these command to install basic security
1513Installing GRID Essential
1514wget http://www.globus.org/ftppub/gt6/installers/repo/globus-toolkit-repo_latest_all.deb
1515sudo dpkg -i globus-toolkit-repo_latest_all.deb
1516 sudo apt-get update
1517 sudo apt-get install globus-data-management-client
1518 sudo apt-get install globus-gridftp
1519 sudo apt-get install globus-gram5
1520 sudo apt-get install globus-gsi
1521 sudo apt-get install globus-data-management-server
1522 sudo apt-get install globus-data-management-client
1523 sudo apt-get install globus-data-management-sdk
1524 sudo apt-get install globus-resource-management-server
1525 sudo apt-get install globus-resource-management-client
1526 sudo apt-get install globus-resource-management-sdk
1527 sudo apt-get install myproxy
1528 sudo apt-get install gsi-openssh
1529 sudo apt-get install globus-gridftp globus-gram5 globus-gsi myproxy myproxy-server myproxy-admin
1530 2. After installing like myproxy,gsi-openssh and Globus GRAM file
1531 a. Click the fileïƒ computer
1532 b. Then Search Grid security folder
1533 c. Then see the gsi.conf, sshftp.( This indicate the basic security mechanisms are configured)
1534
1535Result:
1536Thus secured applications using basic security mechanisms available in Globus Toolkit
1537 has been executed successfully.
1538Ex. No: 14 Find procedure to set up the one node Hadoop cluster.
1539Date:
1540
1541AIM:
1542To Set up the one node Hadoop cluster.
1543
1544PRE-REQUISITE:
15451. Java v1.8 installation
15462. Configuring SSH access. sudo apt-get install vim
1547This exercise has been created for following environment:
1548• Ubuntu Linux 64-bit
1549• JDK 1.8.0_05
1550• Hadoop 2.7.x stable release
1551Note: This exercise depicts about only compatible versions of Hadoop ecosystem tools and software downloaded from the official Apache hadoop website. Preferably use a stable release of the particular tool.
1552
1553PROCEDURE:
15541) Installing Java
1555Hadoop is a framework written in Java for running applications on large clusters of commodity hardware. Hadoop needs Java 6 or above to work.
1556Step 1: Download tar and extract
1557Download Jdk tar.gz file for linux-62 bit, extract it into “/usr/localâ€
1558# cd /opt
1559# sudo tar zxvf /home/user/Downloads/jdk-8u5-linux-x64.tar.g
1560# cd /home/user/Downloads/jdk1.8.0_05
1561Step 2: Set Environments
1562• Open the “/etc/profile†file and Add the following line as per the version
1563• Set a environment for Java
1564• Use the root user to save the /etc/proflie or use gedit instead of vi .
1565• The 'profile' file contains commands that ought to be run for login shells
1566# sudo nano /etc/profile
1567#--insert JAVA_HOME JAVA_HOME=/home/user/Downloads/jdk1.8.0_05
1568#--in PATH variable just append at the end of the line
1569PATH=$PATH:$JAVA_HOME/bin
1570#--Append JAVA_HOME at end of the export statement export PATH JAVA_HOME
1571save the file using by pressing “Esc†key followed by :wq!
1572Step 3: Source the /etc/profile
1573# source /etc/profile
1574Step 4: Update the java alternatives
15751. By default OS will have a open jdk. Check by “java -versionâ€. You will be prompt
1576 “openJDKâ€
15772. If you also have openjdk installed then you'll need to update the java alternatives:
15783. If your system has more than one version of Java, configure which one your system causes by entering the following command in a terminal window
15794. By default OS will have a open jdk. Check by “java -versionâ€. You will be prompt
1580 “JavaHotSpot(TM) 64-Bit Serverâ€
1581# update-alternatives --install "/usr/bin/java" java /home/user/Downloads/jdk1.8.0_05/bin/java"
15821)# update-alternatives --config java
1583--type selection number:
1584# java -version
15852) configure ssh
1586• Hadoop requires SSH access to manage its nodes, i.e. remote machines plus your local machine if you want to use Hadoop on it (which is what we want to do in this exercise). For our single-node setup of Hadoop, we therefore need to configure SSH access to localhost
1587• The need to create a Password-less SSH Key generation based authentication is so that the master node can then login to slave nodes (and the secondary node) to start/stop them easily without any delays for authentication
1588• If you skip this step, then have to provide password
1589Generate an SSH key for the user. Then Enable password-less SSH access to yo sudo apt-get install openssh-server
1590--You will be asked to enter password, root@ubuntu # ssh localhost root@ubuntu# ssh-keygen root@ubuntu# ssh-copy-id -i localhost
1591--After above 2 steps, You will be connected without password, root@ubuntu# ssh localhost
1592root@ubuntu# exit
15933) Hadoop installation
1594• Now Download Hadoop from the official Apache, preferably a stable release version of
1595Hadoop 2.7.x and extract the contents of the Hadoop package to a location of your choice.
1596
1597• For example, choose location as “/opt/â€
1598Step 1: Download the tar.gz file of latest version Hadoop ( hadoop-2.7.x) from the official site .
1599Step 2: Extract (untar) the downloaded file from this commands to /opt/bigdata
1600 root@ubuntu# cd /opt
1601root@ubuntu# sudo tar zxvf /home/user/Downloads/hadoop-2.7.0.tar.g
1602root@ubuntucd hadoop-2.7.0/
1603Like java, update Hadop environment variable in /etc/profile
1604# sudo nano /etc/profile
1605#--insert HADOOP_PREFIX HADOOP_PREFIX=/home/user/Downloads/hadoop-2.7.0
1606#--in PATH variable just append at the end of the line
1607PATH=$PATH:$HADOOP_PREFIX/bin
1608#--Append HADOOP_PREFIX at end of the export statement export PATH JAVA_HOME HADOOP_PREFIX
1609save the file using by pressing “Esc†key followed by :wq!
1610Step 3: Source the /etc/profile
1611# source /etc/profile
1612Verify Hadoop installation
1613# cd $HADOOP_PREFIX
1614# bin/hadoop version
16153.1) Modify the Hadoop Configuration Files
1616• In this section, we will configure the directory where Hadoop will store its configuration files, the network ports it listens to, etc. Our setup will use Hadoop Distributed File System,(HDFS), even though we are using only a single local machine.
1617• Add the following properties in the various hadoop configuration files which is available under $HADOOP_PREFIX/etc/hadoop/
1618• core-site.xml, hdfs-site.xml, mapred-site.xml & yarn-site.xml
1619Update Java, hadoop path to the Hadoop environment file
1620# cd $HADOOP_PREFIX/etc/hadoop
1621# nano hadoop-env.sh
1622Paste following line at beginning of the fill
1623export JAVA_HOME=/usr/local/jdk1.8.0_05 export HADOOP_PREFIX=/opt/hadoop-2.7.0
1624Modify the core-site.xml
1625# cd $HADOOP_PREFIX/etc/hadoop
1626# nano core-site.xml
1627Paste following between <configuration> tags
1628<configuration>
1629<property>
1630<name>fs.defaultFS</name>
1631<value>hdfs://localhost:9000</value>
1632</property>
1633</configuration>
1634Modify the hdfs-site.xml
1635# nano hdfs-site.xml
1636Paste following between <configuration> tags
1637<configuration>
1638<property>
1639<name>dfs.replication</name>
1640<value>1</value>
1641</property>
1642</configuration>
1643YARN configuration - Single Node modify the mapred-site.xml
1644# cp mapred-site.xml.template mapred-site.xml
1645# nano mapred-site.xml
1646Paste following between <configuration> tags
1647<configuration>
1648<property>
1649<name>mapreduce.framework.name</name>
1650<value>yarn</value>
1651</property>
1652</configuration> Modiy yarn-site.xml
1653# nano yarn-site.xml
1654Paste following between <configuration> tags
1655<configuration>
1656<property>
1657<name>yarn.nodemanager.aux-services</name>
1658<value>mapreduce_shuffle</value>
1659</property>
1660</configuration>
1661Formatting the HDFS file-system via the NameNode
1662• The first step to starting up your Hadoop installation is formatting the Hadoop files system which is implemented on top of the local file system of our “cluster†which includes only our local machine. We need to do this the first time you set up a Hadoop cluster.
1663• Do not format a running Hadoop file system as you will lose all the data currently in the cluster (in HDFS)
1664root@ubuntu# cd $HADOOP_PREFIX
1665root@ubuntu# bin/hadoop namenode -format
1666
1667
1668Start NameNode daemon and DataNode daemon: (port 50070)
1669root@ubuntu# sbin/start-dfs.sh
1670To know the running daemons jut type jps or /home/user/Downloads/jdk1.8.0_05/bin/jps
1671
1672Start ResourceManager daemon and NodeManager daemon: (port 8088)
1673root@ubuntu# sbin/start-yarn.sh To stop the running process root@ubuntu# sbin/stop-dfs.sh
1674To know the running daemons jut type jps or /home/user/Downloads/jdk1.8.0_05/bin/jps
1675
1676Start ResourceManager daemon and NodeManager daemon: (port 8088)
1677root@ubuntu# sbin/stop-yarn.sh
1678Make the HDFS directories required to execute MapReduce jobs:
1679$ bin/hdfs dfs -mkdir /user
1680$ bin/hdfs dfs -mkdir /user/mit
1681• Copy the input files into the distributed filesystem:
1682$ bin/hdfs dfs -put <input-path>/* /input
1683• Run some of the examples provided:
1684$ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.5.1.jar grep /input
1685/output '(CSE)'
1686• Examine the output files:
1687Copy the output files from the distributed filesystem to the local filesystem and examine them:
1688$ bin/hdfs dfs -get output output
1689$ cat output/* or
1690• View the output files on the distributed filesystem:
1691$ bin/hdfs dfs -cat /output/*
1692
1693Output:
1694Hadoop installation:
1695
1696
1697
1698Create the HDFS directories:
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712Result:
1713Thus the one node Hadoop cluster is installed successfully.
1714
1715EX. NO.: 15 Mount the one node Hadoop cluster using FUSE
1716Date:
1717
1718Aim:
1719To mount the one node Hadoop cluster using FUSE.
1720
1721Procedure:
1722Download the cdh3 repository from the internet.
1723$ wget http://archive.cloudera.com/one-click-install/maverick/cdh3-repository_1.0_all.deb
1724Add the cdh3 repository to default system repository.
1725$ sudo dpkg -i cdh3-repository_1.0_all.deb
1726Update the package information using the following command.
1727$ sudo apt-get update
1728Install the hadoop-fuse.
1729$ sudo apt-get install hadoop-0.20-fuse
1730Once fuse-dfs is installed, go ahead and mount HDFS using FUSE as follows:
1731$ sudo hadoop-fuse-dfs dfs://<name_node_hostname>:<namenode_port> <mount_point>
1732
1733Once HDFS has been mounted at <mount_point>, you can use most of the traditional filesystem operations (e.g., cp, rm, cat, mv, mkdir, rmdir, more, scp). However, random write operations such as rsync, and permission related operations such as chmod, chown are not supported in FUSE-mounted HDFS.
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777Result:
1778Thus the one node Hadoop cluster is mounted using FUSE successfully.
1779EX. NO: 16 Write a word count program to demonstrate the use of Map and
1780Date: Reduce task
1781
1782AIM:
1783Word count program to demonstrate the use of Map and Reduce tasks
1784
1785PRE-REQUISITE:
1786â— Java version > 1.6 is installed and configured properly
1787â— Hadoop version 2.x is installed with proper configuration and hadoop daemons are running
1788PROCEDURE:
17891. Analyze the input file content
17902. Develop the code
1791a. Writing a map function
1792b. Writing a reduce function c. Writing the Driver class
17933. Compiling the source
17944. Building the JAR file
17955. Starting the DFS
17966. Creating Input path in HDFS and moving the data into Input path
17977. Executing the program
1798Sample Program:
1799import java.io.IOException;
1800import java.util.StringTokenizer;
1801import org.apache.hadoop.conf.Configuration;
1802import org.apache.hadoop.fs.Path;
1803import org.apache.hadoop.io.IntWritable;
1804import org.apache.hadoop.io.Text;
1805import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Reducer;
1806import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.util.GenericOptionsParser;
1807public class WordCount{
1808//Step a
1809public static class TokenizerMapper extends Mapper < Object , Text, Text, IntWritable >
1810{
1811//hadoop supported data types
1812private final static IntWritable one = new IntWritable(1);
1813private Text word = new Text();
1814//map method that performs the tokenizer job and framing the initial key value pairs public void map( Object key, Text value, Context context) throws IOException ,
1815InterruptedException
1816{
1817//taking one line at a time and tokenizing the same
1818StringTokenizer itr = new StringTokenizer (value.toString());
1819//iterating through all the words available in that line and forming the key value pair while (itr.hasMoreTokens()){
1820word.set(itr.nextToken());
1821//sending to the context which inturn passes the same to reducer
1822 context.write(word, one);
1823
1824}
1825}
1826}
1827
1828//Step b
1829public static class IntSumReducer extends Reducer < Text, IntWritable, Text, IntWritable >{
1830private IntWritable result = new IntWritable();
1831// Reduce method accepts the Key Value pairs from mappers, do the aggregation based on keys //
1832and produce the final output
1833public void reduce(Text key, Iterable < IntWritable > values, Context context) throws
1834IOException , InterruptedException{
1835int sum = 0;
1836/*iterates through all the values available with a key and
1837add them together and give the final result as the key and sum of its values*/
1838for (IntWritable val: values){
1839sum += val.get();
1840}
1841result.set(sum); context.write(key, result);
1842}
1843}
1844
1845//Step c
1846public static void main( String [] args) throws Exception{
1847//creating conf instance for Job Configuration
1848Configuration conf = new Configuration();
1849//Parsing the command line arguments
1850String [] otherArgs = new GenericOptionsParser(conf,args).getRemainingArgs();
1851if (otherArgs.length < 2){
1852System .err.println( "Usage: wordcount <in> [<in>...]<out>" ); System .exit(2);
1853}
1854//Create a new Job creating a job object and assigning a job name for identification
1855//purposes
1856Job job = new Job(conf, "word count" );
1857job.setJarByClass(WordCount.class);
1858// Specify various job specific parameters job.setMapperClass(TokenizerMapper.class); job.setCombinerClass(IntSumReducer.class); job.setReducerClass(IntSumReducer.class);
1859//Setting job object with the Data Type of output Key
1860job.setOutputKeyClass(Text.class);
1861//Setting job object with the Data Type of output value
1862job.setOutputValueClass(IntWritable.class);
1863//the hdfs input and output directory to be fetched from the command line
1864for ( int i = 0; i < otherArgs.length 1; ++i){
1865FileInputFormat.addInputPath(job, new Path(otherArgs[i]));
1866}
1867
1868
1869
1870FileOutputFormat.setOutputPath(job, new Path(otherArgs[otherArgs.length 1]));
1871System .exit(job.waitForCompletion( true ) ? 0 : 1);
1872}
1873}
1874STEPS:
18751. Start NameNode daemon and DataNode daemon: (port 50070)
1876$ sbin/start-dfs.sh
18772. Start ResourceManager daemon and NodeManager daemon: (port 8088)
1878$ sbin/start-yarn.sh
18793. Make the HDFS directories required to execute MapReduce jobs:
1880$ bin/hdfs dfs -mkdir /user
18814. Copy the input files into the distributed filesystem:
1882$ bin/hdfs dfs -put <input-path>/* /input
1883Run some of the examples provided:
1884$ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce- examples-2.7.0.jar wordcount /Cloud/file1.txt /op1
188516/05/28 14:07:04 INFO client.RMProxy: Connecting to ResourceManager at
1886/0.0.0.0:8032
188716/05/28 14:07:04 INFO input.FileInputFormat: Total input paths to process : 1
188816/05/28 14:07:04 INFO mapreduce.JobSubmitter: number of splits:1
188916/05/28 14:07:05 INFO mapreduce.JobSubmitter: Submitting tokens for job:
1890job_1464422714543_0004
189116/05/28 14:07:05 INFO impl.YarnClientImpl: Submitted application application_1464422714543_0004
189216/05/28 14:07:05 INFO mapreduce.Job: The url to track the job: http://PLLAB-
189349:8088/proxy/application_1464422714543_0004/
189416/05/28 14:07:05 INFO mapreduce.Job: Running job: job_1464422714543_0004
189516/05/28 14:07:10 INFO mapreduce.Job: Job job_1464422714543_0004 running in uber mode : false
189616/05/28 14:07:10 INFO mapreduce.Job: map 0% reduce 0%
189716/05/28 14:07:13 INFO mapreduce.Job: map 100% reduce 0%
189816/05/28 14:07:17 INFO mapreduce.Job: map 100% reduce 100%
189916/05/28 14:07:18 INFO mapreduce.Job: Job job_1464422714543_0004 completed
1900successfully
190116/05/28 14:07:18 INFO mapreduce.Job: Counters: 49
1902File System Counters
1903FILE: Number of bytes read=155
1904FILE: Number of bytes written=229563
1905FILE: Number of read operations=0
1906FILE: Number of large read operations=0
1907FILE: Number of write operations=0
1908HDFS: Number of bytes read=884837
1909HDFS: Number of bytes written=142
1910HDFS: Number of read operations=6
1911
1912
1913HDFS: Number of large read operations=0
1914HDFS: Number of write operations=2
1915Job Counters
1916Launched map tasks=1
1917Launched reduce tasks=1
1918Data-local map tasks=1
1919Total time spent by all maps in occupied slots (ms)=1615
1920Total time spent by all reduces in occupied slots (ms)=1768
1921Total time spent by all map tasks (ms)=1615
1922Total time spent by all reduce tasks (ms)=1768
1923Total vcore-seconds taken by all map tasks=1615
1924Total vcore-seconds taken by all reduce tasks=1768
1925Total megabyte-seconds taken by all map tasks=1653760
1926Total megabyte-seconds taken by all reduce tasks=1810432
1927Map-Reduce Framework
1928Map input records=1
1929Map output records=99348
1930Map output bytes=1282127
1931Map output materialized bytes=155
1932Input split bytes=102
1933Combine input records=99348
1934Combine output records=10
1935Reduce input groups=10
1936Reduce shuffle bytes=155
1937Reduce input records=10
1938Reduce output records=10
1939Spilled Records=20
1940Shuffled Maps =1
1941Failed Shuffles=0
1942Merged Map outputs=1
1943GC time elapsed (ms)=71
1944CPU time spent (ms)=1720
1945Physical memory (bytes) snapshot=454377472
1946Virtual memory (bytes) snapshot=3883495424
1947Total committed heap usage (bytes)=321388544
1948Shuffle Errors
1949BAD_ID=0
1950CONNECTION=0
1951IO_ERROR=0
1952WRONG_LENGTH=0
1953WRONG_MAP=0
1954WRONG_REDUCE=0
1955File Input Format Counters
1956Bytes Read=884735
1957File Output Format Counters
1958Bytes Written=142 user@ubuntu:~/hadoop-2.7.0$
1959
1960In browser type “http://localhost:50070/†Utilities → Browse the file system
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997Result:
1998Thus the Word count program to use Map and reduce tasks is demonstrated successfully.