IT6713- GRID AND CLOUD COMPUTING LAB IV YEAR/ VII SEMESTER 2013-Regul!"#$ De%&!'e$! #( I$(#&'!"#$ Te)*$#l#g+
,ERUSALEM COLLEGE O ENGINEERING Vel)*e&+ M"$ R#. Pll"&$" C*e$$" 600 100 P&e%&e. $. C#'%"le. B+ M& Ge#&ge e&$$.eI BEMTe)*4P*D5 A! P( De%! #( IT
[email protected] M& PS PS T'"*& T'"*&$ $ BEMTe)*4P*D BEMTe)*4P*D55 A! P( De%! #( IT
[email protected]
2
LIST O EPERIMENTS Exp. No.
Date
Page No.
Name of The Experiments
ign.
GRID COMPUTING LAB
1
De!elop a ne" #e$ #e$ er!ice for %alculator.
2
De!elop ne" &'()compliant #e$ #e$ er!ice.
3
*sing (pache (xis (xis de!elop a 'rid er!ice.
4
De!elop applications using +a!a or %,%-- 'rid (Ps
5
6
De!elop secured applications using $asic securit/ mechanisms a!aila$le in 'lo$us Toolit. Toolit. De!elop a 'rid portal1 "here user can su$mit a jo$ and get the result. mplement it "ith and "ithout '(3 concept. CLOUD COMPUTING LAB8
1
2
3 4 5
4ind procedure to run the !irtual machine of different configuration 4ind procedure to attach !irtual $loc to the !irtual machine and chec "hether it holds the data e!en after the release of the !irtual machine. nstall a % compiler in the !irtual machine and execute a sample program. ho" the !irtual machine migration $ased on the certain condition from one node to the other. 4ind procedure to install storage controller and interact "ith it.
6
4ind procedure to set up the one node adoop cluster.
7
3ount the one node adoop cluster using 4*E.
8 9
Department of IT
#rite #rite a program to use the (P6s of adoop to interact "ith it. #rite a "ord count program to demonstrate the use of 3ap and educe tass.
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
7
E=N#8 1 D!e8
IMPLEMENTATION O CALCULATOR AIM8 De9el#% $e: ;e< Se&9")e (#& Cl)ul!#&
PROCEDURE8 S!e% 18 &pen Net9eans DE :.;
S!e% 28 'o to file menu and elect a ne" project.
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
<
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
5
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
= S!e% 38 Delete the index.html file in #e$ pages. %reate the ne" file "ith .>T3?
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
index.xhtml of "e$page "e$page and t/pe the the follo"ing code. S!e% >8 Delete the default content in index.xhtml I$.e==*!'l
ABxml !ersionC;.0 encodingC*T4): B AFD&%TGPE html P*9?% H),,#7%,,DTD >T3? ;.0 Transitional,,ENH Hhttp8,,"""."7.org,T,xhtml;,DTD,xhtml Hhttp8,,"""."7.org,T,xhtml;,DTD,xhtml;)transitional.dtdH ;)transitional.dtdH Ahtml xmlnsCHhttp8,,"""."7.org, xmlnsCHhttp8,,"""."7.org,;III,xhtmlH ;III,xhtmlH xmlns8hCHhttp8,,xmlns.jcp.org,jsf,htmlH Ah8head Atitle4acelet TitleA,title TitleA,title A,h8head Ah8$od/ Aform actionCH.,cal.jspH Acenter Ah(ddition ProgramA,hA$r,A$r, nput Text; Text; 8 Ainput t/peCHtextH nameCHt;H ,A$r,A$r, nput Text2 Text2 8 Ainput t/peCHtextH nameCHt2H ,A$r,A$r, Ainput t/peCHsu$mitH !alueCH-H nameCHaddH , Ainput t/peCHsu$mitH !alueCH)H nameCHsu$H, Ainput t/peCHsu$mitH !alueCHJH nameCHmulH , A,center A,form A,h8$od/ A,html
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
:
file and name it cal.jsp and t/pe the follo"ing code in it. S!e% ?8 %reate a ne" jsp file )l@% Ahtml Ahead AtitleEnter t"o num$ers to add upA,title A,head
A$od/ AKC HAh7 (ddition8 H-Lnteger.parsentLreMuest.getParameterLHt;H H-Lnteger.parsentLreMuest.getParameterLHt;H -nteger.parsentLreMuest.getParameterLHt2H-HA,h;HK AKC HAh7 u$traction8 H-Lnteger.parsentLreMuest.getParameterLHt;H) H-Lnteger.parsentLreMuest.getParameterLHt;H) nteger.parsentLreMuest.getParameterLHt2H-HA,h;HK AKC HAh7 3ultiplication8 HLnteger.parsentLreMuest.getParameterLHt;H Lnteger.parsentLreMuest.getParameterLHt;HJnteger.parse Jnteger.parsentLreMuest.getParameterLHt2H ntLreMuest.getParameterLHt2H -HA,h;HK A,$od/ A,html
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
I
#E9)N4 and t/pe the the follo"ing code. S!e% 68 Delete the default content in "e$.xml of #E9)N4 :e<='l ABxml !ersionCH;.0H encodingCH*T4):HB A"e$)app !ersionCH7.;H xmlnsCHhttp8,,xmlns.jcp.org xmlnsCHhttp8,,xmlns.jcp.org,xml,ns,ja!aeeH ,xml,ns,ja!aeeH xmlns8xsiCHhttp8,,"""."7.org,200;,>3?chema)instanceH xsi8schema?ocationCHhttp8,,xmlns.jcp.org,xml,ns,ja!aee xsi8schema?ocationCHhttp8,,xmlns.jcp.org ,xml,ns,ja!aee http8,,xmlns.jcp.org,xm http8,,xmlns.jcp.org,xml,ns,ja!aee,"e$) l,ns,ja!aee,"e$) appO7O;.xsdH Acontext)param Aparam)nameja!ax.faces.P&+E%TOT('EA,param)name Aparam)!alueDe!elopmentA,param)!alue A,context)param Aser!let Aser!let)name4aces er!letA,ser!let)name Aser!let)classja!ax.faces."e$app.4aceser!letA,ser!let)class Aload)on)startup;A,load)on)startup A,ser!let Aser!let)mapping Aser!let)name4aces er!letA,ser!let)name Aurl)pattern,faces,JA,url)pattern A,ser!let)mapping Asession)config Asession)timeout 70 A,session)timeout
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
;0 A,session)config A"elcome)file)list A"elcome)filefaces,index.xhtmlA,"elcome)file A,"elcome)file)list A,"e$)app
S!e% 78 Deplo/ and un the Project $/ right clic on the project name .
OUTPUT8 Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
;;
Reul!
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
E=N#8 3 D!e8
;2 IMPLEMENTATION IMPLEMENTATION O GRID SERVICE
AIM8 U"$g A%)*e A%)*e A=" .e9el#% G&". Se&9")e PROCEDURE8 %omputer)E8,) E8,)'rid 'rid)gri )grid d computing computing soft"are) soft"are) S!e% 18 &pen spring tool suite DE from 3/ %omputer) spring tool suite release)spring source)sts )7.7.0 release)sts.exe S!e% 28%reate a ne" D/namic "e$ project from 4ile)ne")D/namic "e$ project. Enter the project name and change d/namic "e$ module !ersion to 2.5
S!e% 38 n the same "indo"1 clic modif/ $utton in the configuration select (xis2 "e$ ser!ice and clic on o and then next and finall/ generate "e$ xml must must $e checed and clic finish.
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
;7
ax is $/ going $/ 8right clic on computer and select S!e% >8%reate a s/stem !aria$le for apache axis properties select ad!anced s/stem settings and clic on en!ironment !aria$le and set the ne" !aria$le to the path8 E8)'rid)grid computing soft"ares)(xis)axis 2);..7 Q$in and select o.
S!e% ?.n spring suite clic "indo"s)preferences)"e$ser!ices)(xis 2 preferences and chec the location of axis 2 .
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
;<
S!e% 68.(gain in "indo"s)preference)"e$ ser!ice)ser!er and runtime change "e$ser!ice runtime to apache axis 2 and clic o
S!e% 78 n E8,)grid)grid computing soft"are)axis)cop/ the include folder and paste it in /our project under "e$ content)#E9)N4.
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
;5 files in the same axis folder and paste it inside l"< S!e% 8cop/ the jstl and xmlschemaOcore jar files folder. S!e% 8.No" go to conf)axis2.xml T/pe the follo"ing code in the document
S!e% 108.under ser!ices)"e$.xml1select the last Aser!letto A,ser!letmapping and comment it $/ clicing on ctrl-shift-% sa!e and close.
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
;=
S!e% 118.No" create ne" pacage and gi!e the name as R)#':e<e&9")e S and clic finish.
S!e% 128.No" create a class under the pacage and t/pe a small code and sa!e it.
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
;
T/pe a small code $/ right clic on (dd&perationer!ice.ja!a and sa!e it. S!e% 138. T/pe A..O%e&!"#$Se&9")e@9 pacage com.cloudnloud.ser!ice pu$lic class (dd&petationer!ice (dd&petationer!ice U pu$lic int sumVal sumValueLint ueLint a1int $ U return a-$ W
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
;:
S!e% 1>8. ight clic on /our class name)"e$ser!ice)create "e$ser!ice)chec pu$lish "e$ ser!ice.
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
;I S!e% 1?8 n the same "indo" clic on "e$ser!ice runtime apache8apache axis 2 and chec apache axis 2 and clic finish.
S!e% 168. No" open chrome)t/pe Rlocalhost8I0I0,Lproject nameS
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
20 S!e% 178%lic on the operation that /ou ha!e created. Ou!%u!8
Reul!8
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
2;
E=N#8 > D!e8
IMPLEMENTATION IMPLEMENTATION O GRID API
AIM8 8 De9el#% %%l")!"#$ u"$g ,9 #& C/C G&". API API PROCEDURE8 S!e% 18 %reate a ne" ja!a application
S!e% 28 %reate a ne" class
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
22
T/pe the con!ertion.ja!a code in the ne"l/ created class S!e% 38 T/pe )#$9e&!"#$@9
import %ava.&til.!canner' p&(lic class )emp*onverter+ p&(lic static voi, main-!tring / args0 + oat c' = c = ' int a' !canner scan = ne !canner -!stem.in0' !stem.o&t.println-"res !stem.o&t.println-"ress s 1 or *$ or 2 or $*"0' a = scan.next:nt-0' i -a == 10 convert*ton,rint-0' else convertto*n,rint-0' ; p&(lic static voi, convertto*n,rint-0 + int c' int = c = ' !canner scan = ne !canner -!stem.in0' !stem.o&t.println-"lease !stem.o&t.println-"lease enter ,egrees "0' = -int0 scan.nextloat-0' !stem.o&t.println-"enter !stem.o&t.println-"e nter ,egrees "0'
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
27
c = -320 5#9' !stem.o&t.println- !stem.o&t.println- " ,egrees ,egrees is " c " ,egrees *."0' ; p&(lic static voi, convert*ton,rint-0 + !canner scan = ne !canner -!stem.in0' !stem.o&t.println-"lease !stem.o&t.println-"lease enter ,egrees *"0' oat c = scan.nextloat-0' oat = -c9#5032' !stem.o&t.print !stem.o& t.println-c ln-c " ,egrees * is " " ,egrees ."0' ; ;
S!e% > 8 un the ja!a application
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
2<
S!e% ?8n the console8
Press ; for %)4 or 2 for 4)%.
Ou!%u!
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
25
Reul!8
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
E=N#8 ? D!e8
2= IMPLEMENTATION O SECURITY MECANISM
AIM8 De9el#% e)u&e. %%l")!"#$ u"$g <") e)u&"!+ 'e)*$"' PROCEDURE8 S!e%1 8 &pen spring tool suite and create a D/namic "e$ project
S!e% 28 %reate a ne" pacage named com.securit/.ser!let
S!e% 38 %reate 7 classes named ?oginer!let?og&uter!let and egisterer!let.
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
2
T/pe the corresponding code for all the classes. (nd add the reMuired jar files in the "e$ S!e% > 8 T/pe content)"e$)inf)li$ folder.
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
2:
S!e% ? 8 similarl/ create the follo"ing pacages and class files as in the gi!en order $elo" 1)#'e)u&"!+e&9le! )?oginer!let.ja!a )?ogouter!let.ja!a )egisterer!let.ja!a ;.a.com.securit/.ser!let.errohandlers )(ppErrorandler.ja!a ;.$.com.securit/.ser!let.filters )(uthentication4ilter.ja!a ;.c.(pp%ontext?istener.ja!a )(pp%ontext?istener.ja!a 2)#'e)u&"!+u!"l )D9%onnection3anager.ja!a )*ser.ja!a L#g"$Se&9le!@9 pacage com.journalde!.ser!let
import ja!a.io.&Exception import ja!a.io.Print#riter ja!a.io.Print#riter import ja!a.sMl.%onnection import ja!a.sMl.Preparedtatement import ja!a.sMl.esultet import ja!a.sMl.X?Exception import ja!ax.ser!let.eMuestDispatcher import ja!ax.ser!let.er!letException import ja!ax.ser!let.annotation.#e ja!ax.ser!let.annotation.#e$er!let $er!let import ja!ax.ser!let.http.ttper!let
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
2I import ja!ax.ser!let.http.ttper!leteMuest import ja!ax.ser!let.http.ttper!letesponse import ja!ax.ser!let.http.ttpession import org.apache.log
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
70 *ser user C ne" *serLrs.gettringLHnameH1 rs.gettringLHemailH1 rs.gettringLHemailH1 rs.gettringLHcountr/H1 rs.getntLHidH logger.infoLH*ser logger.infoLH*ser found "ith detailsCH-user ttpession session C reMuest.getessionL session.set(ttri$uteLH*serH1 session.set(ttri$uteLH*ser H1 user response.sendedirectLHhome.jspH WelseU eMuestDispatcher rd C geter!let%ontextL.geteMuestDispatcherLH,login.htmlH Print#riter Print#riter outC response.get#riterL response.get#riterL logger.errorLH*ser logger.errorLH*ser not found "ith emailCH-email out.printlnLHAfont colorCredNo user found "ith gi!en email id1 please register first.A,fontH rd.includeLreMuest1 response W W catch LX?Exception e U e.printtacTraceL logger.errorLHData$ase logger.errorLHData$ase connection pro$lemH thro" ne" er!letExceptionLHD9 %onnection pro$lem.H Wfinall/U tr/ U ifLrsFCnullrs.closeL ifLpsFCnullps.closeL W catch LX?Exception e U logger.errorLHX?Exception logger.errorLHX?Exception in closing Preparedtatement Prepared tatement or esultetH W W W W W L#g#u!Se&9le!@9 pacage com.journalde!.ser!let import ja!a.io.&Exception import ja!ax.ser!let.er!letException import ja!ax.ser!let.annotation.#e ja!ax.ser!let.annotation.#e$er!let $er!let import ja!ax.ser!let.http.%ooie import ja!ax.ser!let.http.ttper!let import ja!ax.ser!let.http.ttper!leteMuest import ja!ax.ser!let.http.ttper!letesponse import ja!ax.ser!let.http.ttpession
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
7; import org.apache.log
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
72
@#e$er!letLname @#e$er!letLname C HegisterH1 urlPatterns C U H,egisterH W pu$lic class egisterer!let extends ttper!let U pri!ate static final long serialVers serialVersion*D ion*D C ;? static ?ogger logger C ?ogger.get?oggerLegisterer!let.class ?ogger.get?oggerLegisterer!let.class protected !oid doPostLttper!leteMuest reMuest1 ttper!letesponse response thro"s er!letException1 &Exception U tring email C reMuest.getParameterLHemailH tring pass"ord C reMuest.getParameterLHpass"ordH tring name C reMuest.getParameterLHnameH tring countr/ C reMuest.getParameterLHcountr/H tring error3sg C null ifLemail CC null YY email.eMualsLHHU e mail.eMualsLHHU error3sg C HEmail D cant $e null or empt/.H empt/.H W ifLpass"ord CC null YY pass"ord.eMualsLHHU error3sg C HPass"ord cant $e null or empt/.H W ifLname CC null YY name.eMualsLHHU error3sg C HName cant $e null or empt/.H empt/.H W ifLcountr/ CC null nu ll YY countr/.eMualsLHHU error3sg C H%ountr/ cant $e null or empt/.H empt/.H W ifLerror3sg FC nullU eMuestDispatcher rd C geter!let%ontextL.geteMuestDispatcherLH,register.htmlH Print#riter Print#riter outC response.get#riterL response.get#riterL out.printlnLHAfont colorCredH-error3sg-HA,fontH rd.includeLreMuest1 response WelseU %onnection con C L%onnection geter!let%ontextL.get(ttri$uteLHD9%onnectionH Preparedtatement ps C null tr/ U ps C con.preparetatementLHinsert into *sersLname1email1countr/1 *sersLname1email1countr/1 pass"ord !alues LB1B1B1BH ps.settringL;1 name ps.settringL21 email ps.settringL71 countr/ ps.settringL<1 pass"ord ps.executeL
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
77
logger.infoLH*ser logger.infoLH*ser registered "ith emailCH-email ,,for"ard to login page to login eMuestDispatcher rd C geter!let%ontextL.geteMuestDispatcherLH,login.htmlH Print#riter Print#riter outC response.get#riterL response.get#riterL out.printlnLHAfont colorCgreenegistration successful1 please login $elo".A,fontH $elo".A,fontH rd.includeLreMuest1 response W catch LX?Exception e U e.printtacTraceL logger.errorLHData$ase logger.errorLHData$ase connection pro$lemH thro" ne" er!letExceptionLHD9 %onnection pro$lem.H Wfinall/U tr/ U ps.closeL W catch LX?Exception e U logger.errorLHX?Exception logger.errorLHX?Exception in closing PreparedtatementH W W W W W -A%%E&&$.le&@9 pacage com.journalde!.ser!let.errorhandler com.journalde!.ser!let.errorhandler import ja!a.io.&Exception import ja!a.io.Print#riter ja!a.io.Print#riter import ja!ax.ser!let.er!letException import ja!ax.ser!let.annotation.#e ja!ax.ser!let.annotation.#e$er!let $er!let import ja!ax.ser!let.http.ttper!let import ja!ax.ser!let.http.ttper!leteMuest import ja!ax.ser!let.http.ttper!letesponse @#e$er!letLH,(ppErrorandlerH pu$lic class (ppErrorandler (ppErrorandler extends ttper!let U pri!ate static final long serialVers serialVersion*D ion*D C ;? protected !oid do'etLttper!leteMuest reMuest1 ttper!letesponse response thro"s er!letException1 &Exception U processErrorLreMuest1 response W
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
7<
protected !oid doPostLttper!leteMuest reMuest1 ttper!letesponse response thro"s er!letException1 &Exception U processErrorLreMuest1 response W pri!ate !oid processErrorLttper!leteMuest reMuest1 ttper!letesponse response thro"s &Exception U ,, (nal/ze the ser!let exception Thro"a$le thro"a$le C LThro"a$le reMuest .get(ttri$uteLHja!ax.ser!let.error.exceptionH nteger status%ode C Lnteger reMuest .get(ttri$uteLHja!ax.ser!let.error.statusOcodeH tring ser!letName C Ltring reMuest .get(ttri$uteLHja!ax.ser!let.error.ser!letOnameH if Lser!letName CC null U ser!letName C H*nno"nH W tring reMuest*ri C Ltring reMuest .get(ttri$uteLHja!ax.ser!let.error.reMuestOuriH if LreMuest*ri CC null U reMuest*ri C H*nno"nH W
W
,, et response content t/pe response.set%ontentT/peLHtext,htmlH Print#riter Print#riter out C response.get#riterL out."riteLHAhtmlAheadAtitleException,Error out."riteLHAhtmlAheadAtitleException,Er ror DetailsA,titleA,headA$od/H ifLstatus%ode FC 500U out."riteLHAh7Error DetailsA,h7H out."riteLHAstrongtatus %odeA,strong8H-status%ode-HA$rH out."riteLHAstrongeMuested *A,strong8H-reMuest*ri *A,strong8H-reMuest*ri WelseU out."riteLHAh7Exception DetailsA,h7H out."riteLHAulAlier!let Name8H-ser!letName-HA,liH out."riteLHAliException Name8H-thro"a$le.get%lassL.getNameL-HA,l Name8H-thro"a$le.get%lassL.getNameL-HA,liH iH out."riteLHAlieMuested *8H-reMuest*ri-HA,liH *8H-reMuest*ri-HA,liH out."riteLHAliException 3essage8H-thro"a$le.get3essageL-HA,li 3essage8H-thro"a$le.get3essageL-HA,liH H out."riteLHA,ulH W out."riteLHA$rA$rH out."riteLHAa hrefCHlogin.htmlH?ogin PageA,aH out."riteLHA,$od/A,htmlH
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
75 W -Au!*e$!")!"#$"l!e&@9 pacage com.journalde!.ser!let.filters com.journalde!.ser!let.filters import ja!a.io.&Exception import ja!ax.ser!let.4ilter import ja!ax.ser!let.4ilter%hain import ja!ax.ser!let.4ilter%onfig import ja!ax.ser!let.er!letException import ja!ax.ser!let.er!leteMuest import ja!ax.ser!let.er!letesponse import ja!ax.ser!let.annotation.#e ja!ax.ser!let.annotation.#e$4ilter $4ilter import ja!ax.ser!let.http.ttper!leteMuest import ja!ax.ser!let.http.ttper!letesponse import ja!ax.ser!let.http.ttpession import org.apache.log
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
7= W
W pu$lic !oid destro/L U ,,close an/ resources here W W -A%%C#$!e=!L"!e$e&@9 pacage com.journalde!.ser!let.listeners com.journalde!.ser!let.listeners import ja!a.io.4ile import ja!a.sMl.%onnection import ja!a.sMl.X?Exception import ja!ax.ser!let.er!let%ontext import ja!ax.ser!let.er!let%ontextE!ent import ja!ax.ser!let.er!let%ontext?istener import ja!ax.ser!let.annotation.#e ja!ax.ser!let.annotation.#e$?istener $?istener import org.apache.log
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
7 e.printtacTraceL W ,,initialize log
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
7:
pu$lic D9%onnection3anagerLtring d$*?1 tring user1 tring tring p"d thro"s %lassNot4oundException1 X?ExceptionU %lass.forNameLHcom.m/sMl.jd$c.Dri!erH this.connection C Dri!er3anager.get%onnectionLd$*?1 Dri!er3anager.get%onnectionLd$*?1 user1 p"d W pu$lic %onnection get%onnectionLU return this.connection W W -Ue&@9 pacage com.journalde!.util import ja!a.io.erializa$le pu$lic class *ser implements erializa$leU pri!ate static final long serialVers serialVersion*D ion*D C =2I7:57020:2005;;? pri!ate tring name pri!ate tring email pri!ate int id pri!ate tring countr/ pu$lic *serLtring nm1 tring em1 tring countr/1 countr/1 int iU this.nameCnm this.idCi this.countr/Ccountr/ this.emailCem W pu$lic !oid setNameLtring name U this.name C name W
pu$lic !oid setEmailLtring email U this.email C email W
pu$lic !oid setdLint id U this.id C id W
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
7I
pu$lic !oid set%ountr/Ltring countr/ U this.countr/ C countr/ W
pu$lic tring getNameL U return name W pu$lic tring getEmailL U return email W pu$lic int getdL U return id W pu$lic tring get%ountr/L U return countr/ W @&!erride pu$lic tring totringLU return HNameCH-this.name-H1 EmailCH-this.email-H1 %ountr/CH-this.countr/ W W
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
<0 S!e% 68 T/pe the code for home.jsp1 login.html and register.html in #E9)%&NTENT. *#'e@% AK@page importCHcom.journalde!. importCHcom.journalde!.util.*serHK util.*serHK AK@ page languageCHja!aH contentT/peCHtext,html charsetC*)(%H pageEncodingCH*)(%HK AFD&%TGPE html P*9?% H),,#7%,,DTD T3? <.0; Transitional,,ENH Hhttp8,,"""."7.org,T,html<,loose.dtdH Ahtml Ahead Ameta http)eMui!CH%ontent)T/peH contentCHtext,html charsetC*)(%H c harsetC*)(%H Atitleome PageA,title A,head A$od/ AK*ser user C L*ser session.get(ttri$uteLH*serH K Ah7i AKCuser.getNameL KA,h7 AstrongGour AstrongGour EmailA,strong8 AKCuser.getEmailL AKCuser.getEmailL KA$r AstrongGour AstrongGour %ountr/A,strong8 AKCuser.get%ountr/L AKCuser.get%ountr/L KA$r A$r Aform actionCH?ogoutH methodCHpostH Ainput t/peCHsu$mitH !alueCH?ogoutH A,form A,$od/ A,html
l#g"$*!'l AFD&%TGPE html Ahtml Ahead Ameta charsetCH*)(%H Atitle?ogin PageA,title A,head A$od/ Ah7?ogin "ith email and pass"ordA,h7 Aform actionCH?oginH methodCHpostH Astrong*ser EmailA,strong8Ainput t/peCHtextH nameCHemailHA$r AstrongPass"ordA,strong8Ainput AstrongPass"ordA,strong8Ai nput t/peCHpass"ordH nameCHpass"ordHA$r Ainput t/peCHsu$mitH !alueCH?oginH A,form A$r f /ou are a re ne" user1 please Aa hrefCHregister.htmlHregisterA,a. hrefCHregister.htmlHregisterA,a. A,$od/ A,html
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
<; &eg"!e&*!'l
AFD&%TGPE html Ahtml Ahead Ameta charsetCH*)(%H Atitleegister PageA,title A,head A$od/ Ah7Pro!ide all the fields for registration.A,h7 Aform actionCHegisterH methodCHpostH AstrongEmail DA,strong8Ainput t/peCHtextH nameCHemailHA$r AstrongPass"ordA,strong8Ainput AstrongPass"ordA,strong8Ai nput t/peCHpass"ordH nameCHpass"ordHA$r AstrongNameA,strong8Ainput t/peCHtextH nameCHnameHA$r Astrong%ountr/A,strong8Ainput t/peCHtextH nameCHcountr/HA$r Ainput t/peCHsu$mitH !alueCHegisterH A,form A$r f /ou are registered user1 please Aa hrefCHlogin.htmlHloginA,a. A,$od/ A,html
S!e% 78 &pen "e$.xml in "e$ content and modif/ it. :e<='l ABxml !ersionCH;.0H encodingCH*T4):HB A"e$)app idCH#e$(ppODH !ersionCH2.
3?chema)instanceH
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
<2 xsi8schema?ocationCHhttp8,,ja!a.sun.com,xml,ns,j2ee http8,,ja!a.sun.com,xml,ns,j2ee,"e$) xsi8schema?ocationCHhttp8,,ja!a.sun.com,xml,ns,j2ee appO2O<.xsdH Adispla/)name loginpageA,displa/)name
A"elcome)file)list A"elcome)filelogin.htmlA,"elcome)file A,"elcome)file)list Acontext)param Aparam)named$*serA,param)name Aparam)!aluerootA,param)!alue A,context)param Acontext)param Aparam)named$Pass"ordA,param)name Aparam)!alueredhatA,param)!alue A,context)param Acontext)param Aparam)named$*?A,param)name Aparam)!aluejd$c8m/sMl8,,localhost8770=,*serD9A,param)!alue A,context)param Acontext)param Aparam)namelog
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
<7 Aser!let)nameegisterA,ser!let)name Aser!let)classegisterA,ser!let)class A,ser!let Aser!let)mapping Aser!let)nameegisterA,ser!let)name Aurl)pattern,egisterA,url)pattern A,ser!let)mapping Aser!let Aser!let)name?ogoutA,ser!let)name Aser!let)class?ogoutA,ser!let)class A,ser!let Aser!let)mapping Aser!let)name?ogoutA,ser!let)name Aurl)pattern,?ogoutA,url)pattern A,ser!let)mapping Aser!let Aser!let)name?oginA,ser!let)name Aser!let)class?oginA,ser!let)class A,ser!let Aser!let)mapping Aser!let)name?oginA,ser!let)name Aurl)pattern,?oginA,url)pattern A,ser!let)mapping )) A,"e$)app
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
<<
d etails S!e%8%reating a data$ase to store the user details :a.etup m/sMl ser!er $/ gi!ing pass"ord C redhat or if u "ant to gi!e a ne" pass"ord 1 :$ &pen 3/sMl command)line client. :c%reate a ne" data$ase user Xuer/ 8 create data$ase *serD9 elect the ne"l/ created data$ase Xuer/ to create a data$ase8 create data$ase *serD9 Xuer/ to change data$ase 8 use *serD9
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
<5
S!e% 8 &pen 3/Ml "or$ench.
S!e% 108 %reate a ne" connection from the data$ase menu
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
<=
%lic store in !alue
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
<
Enter pass"ord 8 redhat
( ne" data$ase connection is created.
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
<:
S!e% 118 %reate a ne" ta$le named ue& ha!ing the fields 8 id1 name1email1countr/1pass"ord. Xuer/ 8 %E(TE T(9?E ]*sers] L ]id] intL;; unsigned unsigned N&T N*?? (*T&ON%E3ENT1 (*T&ON%E3ENT1 ]name] !archarL20 !arch arL20 N&T N*?? DE4(*?T 1 ]email] !archarL20 !arch arL20 N&T N*?? DE4(*?T 1 ]countr/] ]count r/] !archarL20 !archa rL20 DE4(*?T DE4(*?T *(1 ]pass"ord] ]pass"o rd] !archarL20 !archarL2 0 N&T N*?? DE4(*?T DE4(*?T 1 P3(G ^EG L]id] EN'NECnnoD9 (*T&ON%E3ENTC2 DE4(*?T %(ETCutf:
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
To run the Muer/ clic on the un option
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
50 S!e%128 No" 1'o to sts and run the project as un on ser!er
OUTPUT8
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
5;
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
52
Reul!
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
E=N#8 6 D!e8
57 IMPLEMENTATION O GRID PORTAL
AIM8 De9el#% G&". %#&!l :*e&e ue& )$ u<'"! @#< $. ge! !*e &eul! &eul! PROCEDRE8
#e$ project in spring tool suite. S!e% 1 8%reate a D/namic #e$
S!e% 28 n +a!a resource %reate a ne" pacage.
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
5<
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
55 S!e% 38 %reate a ne" class "ithin the ne"l/ created pacage named Pie%harter!let and t/pe its corresponding code.
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
5= #e$ content %reate a ne" T3? file and name it chart.html and "rite its corresponding S!e% >8 n #e$ code P"eC*&!Se&9le!@9 pacage com.cloudnloud.ser!let
import ja!a.a"t.%olor import ja!a.io.&Exception import ja!a.io.&utputtream import ja!ax.ser!let.er!letException import ja!ax.ser!let.annotation.#e ja!ax.ser!let.annotation.#e$er!let $er!let import ja!ax.ser!let.http.ttper!let import ja!ax.ser!let.http.ttper!leteMuest import ja!ax.ser!let.http.ttper!letesponse import org.jfree.chart.%hart4actor/ import org.jfree.chart.%hart*tili org.jfree.chart.%hart*tilities ties import org.jfree.chart.+4ree%hart import org.jfree.chart.la$els.tandardPieection?a$el'enerator import org.jfree.chart.plot.PiePlot import org.jfree.data.general.DefaultPieDataset ,J %ode for the TTP er!let that "ill return the Pie %hart as a PN' image $ac to the $ro"ser after generating it using +4ree%hart (P J, @#e$er!letLname @#e$er!letLname C HPie%harter!letH1 urlPatterns C U H,Pie%harter!letH W pu$lic class Pie%harter!let extends ttper!let U pu$lic Pie%harter!letL U ,J No code in the constructor for this demonstration J, W pu$lic !oid do'etLttper!leteMuest reMuest1 ttper!letesponse response thro"s er!letException1 &Exception U &utputtream out C response.get&utputtreamL ,J 'et the output stream from the response o$ject J, tr/ U DefaultPieDataset m/er!letPie%hart C ne" DefaultPieDatasetL ,J #e "ill no" get the !alues posted to us from the T3? form1 to generate a d/namic pie chart J, ,J to get the form !alues "e use reMuest.getParameter method. #e ha!e to con!ert this to Dou$le format to pass this as an input to our pie chartJ, ,J The N(3E used in T3? form "ill ser!e as input to getParameter J, m/er!letPie%hart.setValueLHer!ersH1Dou$le.parseDou$leLreMuest.getParameterLHer!ersH m/er!letPie%hart.setVal ueLHer!ersH1Dou$le.parseDou$leLreMuest.getParameterLHer!ersH m/er!letPie%hart.setValueLH3onitorH1 Dou$le.parseDou$leLreMuest.getParameterLH3onitorH
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
5 m/er!letPie%hart.setValueLH%P*H1 Dou$le.parseDou$leLreMuest.getParameterLH%P*H m/er!letPie%hart.setValueLH^e/$oardsH1 Dou$le.parseDou$leLreMuest.getParameterLH^e/$oardsH m/er!letPie%hart.setValueLHProcessorH1Dou$le.parseDou$leLreMuest.getParameterLHProcessorH m/er!letPie%hart.setVal ueLHProcessorH1Dou$le.parseDou$leLreMuest.getParameterLHProcessorH +4ree%hart m/chart C %hart4actor/.createPie%hartLHD/namic Pie %hart ExampleH1m/er!letPie%hart1true1true1false ,J #e use the configurator to define la$els for the chart1 "hich can $e sho"n on image also J, PiePlot %olor%onfigurator C LPiePlot m/chart.getPlotL %olor%onfigurator.set?a$el'eneratorLne" %olor%onfigurator.set?a$el'eneratorLne" tandardPieection?a$el'eneratorLHU0W8 U;WH %olor%onfigurator.set?a$el9acgroundPaintLne" %olor%onfigurator.set?a$el9acgroundPaintLne" %olorL2201 2201 220 response.set%ontentT/peLHimage,pngH response.set%ontentT/peLHimage,pngH ,J et the TTP esponse T/pe J, ,J end a $ig chart $ac to the $ro"ser J, %hart*tilities."rite%hart(sPN'Lout1 %hart*tilities."rite%hart(sPN'Lout1 m/chart1 =<01 <:0,J #rite #rite the data to the output stream J, W catch LException e U e.printtacTraceL /stem.err.printlnLe.totringL /stem.err.printlnLe.totringL ,J Thro" exceptions to log files J, W finall/ U out.closeL,J %lose the output stream J, W W ,J #e "rite a doPost method "hich "ill $e in!oed in!oe d "hen /ou post data to the ser!let J, ,J nside doPost "e in!oe do'et to return a chart $ac to us depending on the input parametersJ, pu$lic !oid doPostLttper!leteMuest reMuest1 ttper!letesponse response thro"s er!letException1 &Exception U
do'etLreMuest1 response W
W
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
5:
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
5I )*&!*!'l . Ahtml Ahead ATitle'enerate D/namic Pie %hart A,Title A,Title A,head A$od/ 9'%&?&CH"hiteH A2Enter /our no. to get a Pie %hart A,2 AF)) #e create a simple form to accept user inputs )) AF)) The action for this form points to the ser!let *? created in earlier posts )) A4&3 (%T&NCHPie%harter!letH 3ET&DCHP&TH er!ers8ANP*T TGPECHTE>TH N(3ECHer!ersHA9 3onitor8ANP*T TGPECHTE>TH N(3ECH3onitorHA9 %P*8ANP*T TGPECHTE>TH N(3ECH%P*HA9 ^e/$oards8ANP*T TGPECHTE>TH N(3ECH^e/$oardsHA9 Processor8ANP*T TGPECHTE>TH N(3ECHProcessorHA9 ANP*T TGPECH*93TH V(?*ECHu$mitH A,4&3 A,$od/ A,html
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
=0 S!e% ?8 &pen "e$.xml in #E9)N4 and t/pe code . :e<='l
ABxml !ersionCH;.0H encodingCH*T4):HB A"e$)app xmlns8xsiCHhttp8,,""" xmlns8xsiCHhttp8,,"""."7.org,200;,>3?chema)inst ."7.org,200;,>3?chema)instanceH anceH xmlnsCHhttp8,,ja!a.sun.com,xml,ns,ja!aeeH xmlns8"e$CHhttp8,,ja!a.sun.com,xml,ns,ja!aee,"e$) appO2O5.xsdH xsi8schema?ocationCHhttp8,,ja!a.sun.com,xml,ns,ja!aee http8,,ja!a.sun.com,xml,ns,ja!aee,"e$)appO7O0.xsdH idCH#e$(ppODH idCH#e$(ppODH !ersionCH7.0H Adispla/)namechartA,displa/)name A"elcome)file)list A"elcome)filechart.htmlA,"elcome)file AF)) A"elcome)fileindex.htmA,"elcome)file A"elcome)fileindex.jspA,"elcome)file A"elcome)filedefault.htmlA,"elcome)file A"elcome)filedefault.htmA,"elcome)file A"elcome)filedefault.jspA,"elcome)file A"elcome)filedefault.jspA,"elcome)fil e )) A,"elcome)file)list AF)) Aser!let add a line for the Pie%harter!let1 Pie%harter!let1 similar to ell#orld ell#orld example Aser!let)namePie%harter!letA,ser!let)name Aser!let)classPie%harter!letA,ser!let)class A,ser!let Aser!let)mapping%reate a *? pattern for the ne" pie chart ser!let Aser!let)namePie%harter!letA,ser!let)name Aurl)pattern,ser!lets,ser!let,Pie%harter!letA,url)pattern A,ser!let)mapping )) A,"e$)app
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
=; #e$%ontent)#E9)N4)li$ S!e% 6 8 (dd the jar files in #e$%ontent)#E9)N4)li$
S!e% 78 un the project on ser!er.
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
=2
Ou!%u!8
Reul!8
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
E=N#8 1 D!e8
CLOUD COMPUTING LAB8 PROCEDURE OR VIRTUAL MACINE O DIERENT CONIGURATION
=7
AIM8 "$. %)e.u&e !# &u$ !*e 9"&!ul ')*"$e #( ."((e&e$! )#$("gu&!"#$ C*e) *#: '$+ 9"&!ul ')*"$e )$
Throughout the installation there are t"o separate roles8 $!e$. and N#.e. The $!e$. Se&9e& "ill execute the &penNe$ula ser!ices1 and the N#.eL^V3;"ill $e used to execute !irtual machines. PROCEDURE8
#orstation. S!e% 18&pen V3"are #orstation.
S!e% 28 Po"er on $! e$. 1open the terminal t/pe ip a and o$tain the P(dress8 4or eg8;I2.;=:.;5I.;7;.Paste the P (ddress in Putt/ %onfiguration and load frontend.
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
=<
S!e%38?ogin as #!1 t/pe pass"ord as &e.*! start the ser!ices of frontend as mentioned $elo" > sstemctl ena(le openne(&la > sstemctl start openne(&la > sstemctl ena(le openne(&las&nstone > sstemctl start openne(&las&nstone
Refresh the NFS exports by doing: # systemctl restart nfs.service
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
=5
S!e% >88Po"er on 9'1 1open the terminal t/pe ip a and o$tain the P ( dress8 4or eg8;I2.;=:.;5I.;72.Paste the P (ddress in Putt/ %onfiguration and load !m;. S!e%?8?ogin as #!1 t/pe pass"ord as &e.*! start the ser!ices of 9'1 as mentioned $elo" Start the required services: # systemctl start messagebus.service messagebus.service # systemctl enable libvirtd.service libvirtd.service # systemctl start libvirtd.service # systemctl start nfs.servic nfs.service e
tep=8&n front end cop/ the e/ into the $ro"ser pass"ord field
The default pass"ord for the oneadmin user can $e found in _,.one,oneOauth "hich is randoml/ generated on e!er/ installation.
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
== To interact "ith &penNe$ula1 /ou ha!e to do it from the oneadmin oneadmin account account in the frontend. #e "ill assume all the fol olllo" o"iing commands are pe perrfor orm med from that acco cou unt nt.. To login as oneadmin oneadmin execute execute su ) oneadmin. To find Password run below command:
$cat ~/.one/one_auth
))J on frontend all the acti!ities to $e performed p erformed as oneadminJ))) S!e%78 A.."$g #! To start running V3s1 /ou should first register a "orer node for &penNe$ula. ssue this command for each one of /our nodes. eplace localhost "ith /our node6s hostname. hostname.
` onehost create !m;.jce.com )i!m )! !m )n dumm/
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
=
S!e% 8 'otoO$e.'"$ Dash$oard
S!e% 8 %hec to see the Datanode is added
Zoneadmin@frontend _[` onehost list
chec for the status #$"ait for fe" minutes if status e&& pro$lem is due to ser!ices are not no t started properl/.
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
=:
S!e% 108%reate the !irtual net"or
Zoneadmin@frontend _[` one!net list
appe ar on mage dash $oard "hich indicates add S!e%118n Dash $oard select mage1 - s/m$ol "ill appear clic on it.
J No" ne" C&e!e I'ge "ill pop out to enter the details for mage1 fill the details for nameTTYL"$u= .) .) %hoos %hoosee image image locat locatio ion8 n8 U%l#. )%hoos )%hoosee file8$ro file8$ro"se "se for the !!+l"$u="'g "hich is stored in particular dri!er. J&nce image is uploaded clic on )&e!e
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
=I
&n Dash$oard chec for the status Re.+
Zoneadmin@frontend _[` oneimage list S!e%128C&e!e !*e !e'%l!e 4$ee. !# &e(e& !*e "'ge )&e!e. "$ %&e9"#u !e%5
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
0 ` onetemplate create ))name HTTG?inuxH ))cpu ; ))!cpu ; ))memor/ 25= ))arch x:=O=< ))dis HTTG?inuxH ))nic Hpri!ateH ))!nc ))ssh ))netOcontext
C*e) !# ee "( !*e !e'%l!e *
I$!$!"!e !*e !e'%l!e Cl") V"&!ul M)*"$e "$ V"&!ul Re#u&)e Me$u $. .# !*e (#ll#:"$g !e%
'oto Virtual Virtual 3achines clic on-to add the !irtual machine
elect the V3Name)TTGlinux1clic on create
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
;
OUTPUT8 %hec the tatus for Virtual Virtual 3achine *NNN'
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
E=N#8 2 D!e8
PROCEDURE OR VIRTUAL MACINE TO OLD AND RELEASE DATA
esult8
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
2
7 AIM8 "$. %)e.u&e !# !!)* 9"&!ul
tep;08elect all the permission
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
<
tep;;8'otoS!#&ge %lic on A!!)* D"
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
5 S!e%12 8elect on option V#l!"le D"-F ize 10 MB4D# $#! Sele)! GB5-F T/pe Default SF#&'!-SD clic on A!!)*
N#!e8 #hen /ou clic refresh the ne"l/ attach hdc disappears. ence "e re$oot and restart the ser!ices. S!e%13 8'oto drop do"n select the Re<##! *&.
Virtual 3achine elect the S!#&ge S!e%1> 8estart the ser!ices of $!e$. and VM1and go to Virtual clic on A!!)* D" and and follo" the S!e%11.
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
=
S!e%1?8 elect the option Re)#9e&
S!e%16 8elect uccess and clic o.
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
E=N#8 3 D!e8
PROCEDURE TO INSTALL C COMPLIER
&*TP*T8
esult8
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
: E=N#8 > D!e8
PROCEDURE TO MIGRATION VIRTUAL MACINE
AIM8 nstall a % compiler in the !irtual machine and execute a sample Program. PROCEDURE8 tep;8?og on Putt/ Putt/ for ^V3;.&nce ^V3; on
Zroot@!m; _[ gccadd.c )o add Zroot@!m; _[ .,add Zroot@!m; _[ enter t"o num$ers Zroot@!m; _[ 2 < OUTPUT8
Zroot@!m; _[um of 2no8=
esult8
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
I
AIM8 ho" the !irtual machine migration $ased on the certain condition from one node to the other PROCEDURE8 S!e%18epeat the tep as sho"n in of ;st ProgramL%loud %omputing ?a$
S!e%28Po"er on ^V3;1^V32 as sho"n $elo"
S!e%38 %reate the 2 hostsL^V3;1^V32 for migration
S!e%>8&nce login gotoV"&!ul M)*"$e select the V3 to M"g&!e-l"9e
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
:0
S!e%?8'oto nfrastructure select #! "hich to 3igrated1clic on M"g&!e
S!e% 68%hec the status MIGRATE of Virtual 3achine
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
:; E=N#8 ? D!e8
PROCEDURE TO INSTALL CONTROLLER
OUTPUT8
%hec the Virtual 3achine "hich had M"g&!e4VM15 tatus is no" in RUNNING4VM25 status
esult8
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
:2
AIM8 4ind procedure to install storage controller and interact "ith it PROCEDURE8 N#!e8 epeat The S!e%1 to S!e% of ;st ProgramL%loud %omputing ?a$ S!e%8'otoI$(&!&u)!u&e elect D!S!#&e
to C&e!e D!!#&egi!e the Name and clic on C&e!e
S!e%108 %lic on
S!e%118TheDatastore is created1clic on efresh
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
:7
&*TP*T8
Reul!8
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
:< E=N#8 6 D!e8
PROCEDURE TO SET UP ONE NODE ADOOP CLUSTER
(im8 To set set up one node adoop %luster. Procedure8 tep ;8 /stem et up and +a!a nstallation ?ogin in P*TTG login as8 #! root@;I2.;=:.52.;2:s pass"ord8&e.*! Zroot@localhost _[ *#!$'e*.% login as8 #! root@;I2.;=:.52.;2:s pass"ord8&e.*! ?ast login8 3on +ul ;; 208;;857 20;= from ;I2.;=:.52.; LTo disa$le fire"all Zroot@hadp _[ +!e')!l ."
tep 28 %reating adoop *ser Zroot@hadp _[ue&..*.##% Zroot@hadp _[ passwdhadoop %hanging pass"ord for user hadoop. Ne" pass"ord8&e.*! 9(D P(#&D8 P(#&D8 The pass"ord is shorter than : characters et/pe ne" pass"ord8&e.*! pass"d8 all authentication toens updated successfull/. successfull/. Zroot@hadp _[ *-e+ge$ 'enerating pu$lic,pri!ate rsa e/ pair. Enter file in "hich to sa!e the e/ L,root,.ssh,idOrsa84%&e e$!e&5 %reated director/ ,root,.ssh. Enter passphrase Lempt/ for no passphrase84%&e e$!e&5 Enter same passphrase again84%&e e$!e&5
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
:5 Gour Gour identification has $een sa!ed in ,root,.ssh,idOrsa. Gour Gour pu$lic e/ has $een sa!ed in ,root,.ssh,idOrsa.pu$. The e/ fingerprint is8 78c8a78Ic8778;<8a:8fe8758:8$82d8<28778f=8f5 [email protected] The e/s randomart image is8 -))Z ( 20<:[))))Y Y Y . Y Y .. Y Y ... Y Y .-o Y Y . CCC .. Y Y . o>-.o . Y Y . ..J- . EY Y . .o . Y -)))))))))))))))))Zroot@hadp _[ *-)#%+-". *.##%H*.% (re /ou sure /ou "ant to continue connecting L/es,noB+e ,usr,$in,ssh)cop/)id8 N4&8 ; e/Ls remain to $e installed )) if /ou are prompted no" it is to install the ne" e/s hadoop@hadpspass"ord8&e.*! Zroot@hadp _[ +u' "$!ll e%el-&elee Zroot@hadp _[ **.##%H*.% Zhadoop@hadp _[` e="! logout %onnection to hadp closed. Zroot@hadp _[ +u' "$!ll @9-10 %&3P?ETEF Zroot@hadp _[ u - *.##% Zhadoop@hadp _[` *-e+ge$ 'enerating pu$lic,pri!ate rsa e/ pair. Enter file in "hich to sa!e the e/ L,home,hadoop,.ssh,idOrsa8Lpress enter Enter passphrase Lempt/ for no passphrase8Lpress enter Enter same passphrase again8Lpress enter Gour Gour identification has $een sa!ed in ,home,hadoop,.ssh,idOrsa. Gour Gour pu$lic e/ has $een sa!ed in ,home,hadoop,.ssh,idOrsa.pu$. The e/ fingerprint is8 5a8ce8=:8I58:8=e8Ia8$08ac8<<80<80080$8<85$85$ [email protected] The e/s randomart image is8 -))Z ( 20<:[))))Y9.o . E Y Y.- o o Y Y. o . Y Y. .. Y Y . . Y
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
:= Y. > Y Y ..-C Y Y..-Y Y ..oo Y -)))))))))))))))))Zhadoop@hadp _[` *-)#%+-".#!H*.% The authenticit/ of host hadp L;I2.;=:.52.;2: cant $e esta$lished. E%D( e/ fingerprint is ;<8228;a8ff80d8dd8ec8<:8fe8=d8f8$8$f8c:80I8df. (re /ou sure /ou "ant to continue connecting L/es,noB /es ,$in,ssh)cop/)id8 N4&8 attempting to log in "ith the ne" e/Ls1 to filter out an/ that are alread/ installed ,$in,ssh)cop/)id8 N4&8 ; e/Ls remain to $e installed )) if /ou are prompted no " it is to install the ne" e/s root@hadpspass"ord8&e.*! Num$er of e/Ls added8 ; No" tr/ logging into the machine1 "ith8 Hssh root@hadpH and chec to mae sure that onl/ the e/Ls /ou "anted "ere added. Zhadoop@hadp _[` *#!H*.% ?ast login8 3on +ul ;; 2087=85< 20;= from ;I2.;=:.52.; Zroot@hadp _[ e="! logout %onnection to hadp closed. tep 78 Do"nloading adoop 2.=.0 LDo"nload hadoop. ip this step1 if the file is in local repositor/ Zhadoop@hadpJK :ge!http8,,apache.claz.org,hadoop,common,hadoop)2.=.0,hadoop)2.=.0.tar.gz Zhadoop@hadp _[` !& =( *.##%-260!&g Zhadoop@hadp _[` '9 *.##%-260 *.##% tep <8 %onfiguring adoop <.;.8etup En!ironment Varia$les Varia$les Zhadoop@hadp _[` $$# /<*&) $In!lude te follo'ing in (basr! file(% $press!trl)* to e*it te nano editor(% export (D&&PO&3EC,home,hadoop,hadoop export (D&&PONT(??C`(D&&PO&3E (D&&PONT(??C`(D&&PO&3E export (D&&PO3(PEDO&3EC`(D&&PO&3E export (D&&PO%&33&NO&3EC`(D&&PO&3E export (D&&POD4O&3EC`(D&&PO&3E export G(NO&3EC`(D&&PO&3E expo export rt (D& (D&&P &PO% O%&3 &33& 3&NO NO? ?9O 9ON( N(T TVEO VEOD DC C `(D `(D&& &&PO PO& &3E 3E,l ,li$ i$,n ,nat ati! i!ee
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
: export P(TC`P(T8`(D&&PO&3E,s$in8`(D&&PO&3E,$in $+o' appl, te !anges in !urrent running en"ironment% Zhadoop@hadp _[` #u&)e /<*&) Zhadoop@hadp _[` 9" KADOOPOME/e!)/*.##%/*.##%-e$9* +(V(O&3EC,opt,jd;.:.0O==, <.2 Edit %onfiguration 4iles Zhadoop@hadp _[` ). KADOOPOME/e!)/*.##% Zhadoop@hadphadoop[` $$# )#&e-"!e='l $In!lude te follo'ing 'itin -!onfiguration.tags %
Apropert/ Anamefs.default.nameA,name A!aluehdfs8,,localhost8I000A,!alue A,propert/ Zhadoop@hadphadoop[` $$# *.(-"!e='l $In!lude te follo'ing 'itin -!onfiguration. tags% Apropert/ Anamedfs.replicationA,name A!alue;A,!alue A,propert/ Apropert/ Anamedfs.name.dirA,name A!aluefile8,,,home,hadoop,hadoopdata,hdfs,namenodeA,!alue A,propert/ Apropert/ Anamedfs.data.dirA,name A!aluefile8,,,home,hadoop,hadoopdata,hdfs,datanodeA,!alue A,propert/ Zhadoop@hadphadoop[` $$#'%&e.-"!e='l!e'%l!e $In!lude te follo'ing 'itin -!onfiguration. tags%
Apropert/ Anamemapreduce.frame"or.nameA,name A!alue/arnA,!alue A,propert/
Zhadoop@hadphadoop[` $$# +&$-"!e='l
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
:: $In!lude te follo'ing 'itin -!onfiguration. tags%
Apropert/ Aname/arn.nodemanager.aux)ser!icesA,name A!aluemapreduceOshuffleA,!alue A,propert/ <.7 4ormat Namenode Zhadoop@hadphadoop[` *.($'e$#.e -(#&'! ;=,0,;; 278;780 N4& namenode.NameNode8 T(T*PO3'8 T(T*PO3'8 ,JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ T(T*PO3'8 tarting NameNode T(T*PO3'8 T(T*PO3'8 host C hadp.cnl.com,;I2.;=:.52.;2: T(T*PO3'8 T(T*PO3'8 args C Z)format[ T(T*PO3'8 T(T*PO3'8 !ersion C 2.=.0 T(T*PO3'8 T(T*PO3'8 classpath classpat h C . . . ;=,0,;; 278;780I N4& common.torage8 torage director/ ,home,hadoop,hadoopdata,hdfs,namenodehas $een successfull/ formatted. ;=,0,;; 278;780I N4& namenode.NNtorageetention3anager8 'oing to retain ; images "ith txidC 0 ;=,0,;; 278;780I N4& util.Exit*til8 Exiting "ith status 0 ;=,0,;; 278;780I N4& namenode.NameNode8 *TDNO3'8 ,JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ *TDNO3'8 hutting do"n NameNode at hadp.cnl.com,;I2.;=:.52.;2: JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ, tep 58tart adoop %luster Zhadoop@hadphadoop[` ). KADOOPOME/<"$/ Zhadoop@hadps$in[` !&!-.(* (re /ou sure /ou "ant to continue connecting L/es,noB +e localhost8 #arning8 #arning8 Permanentl/ added localhost LE%D( to the list of no"n hosts. hadoop@localhostspass"ord8&e.*! Zhadoop@hadps$in[` !&!-+&$*
tep =8 (ccess adooper!ies in 9ro"ser (ccess adoop er!ices on port 5000 "ith the PO(ddress on "e$ $ro"ser. http8,,PO(ddress85000
&utput8
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
:I
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
I0 E=N#8 7 D!e8
PROCEDURE TOMOUNT TE ONE NODE ADOOP CLUSTER USING USE
A"'8
To mount one node adoop cluster using 4*E. P)e.u&e8
tep ;8 %reate an input director/ using the follo"ing command Zhadoop@hadp hadoop[`<"$/*.( .( -'."& /ue&001 Zhadoop@hadp hadoop[`<"$/*.( .( -'."& /ue&001/*.##% tep 28 %op/ the input file in the input director/ using the follo"ing command Zhadoop@hadp hadoop[`<"$/*.( .( %u! /*#'e/*.##%/*.##%/("l /*#'e/*.##%/*.##%/("le1!=! e1!=! /ue&001/*.##%
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
I;
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
I2 E=N#8 D!e8
PROGRAM TO USE TE APIS O ADOOP TO INTERACT ;IT IT
(P6s of adoop to interact "ith it. A"'8 To "rite a program to use the (P6s Program8 *?Expimple.ja!a8 importja!a.io.nputtreameader import ja!a.net.*? importja!a.net.*?%onnection importja!a.util.canner pu$lic class *?Expimple U pu$lic static !oid mainLtringZ[ args args U tr/ U *? m/ite C ne" *?LHhttp8,,;I2.;=:.75.;5085000H *?%onnection/c C m/ite.open%onnectionL canner in C ne" cannerLne" nputtreameaderL/c.getnputtreamL int count C 0 "hile Lin.hasNextL U /stem.out.printlnLin.nextL count-- W /stem.out.printlnLHNum$er of toens8 H - count in.closeL W catch LException e U e.printtacTraceL WWW No" compile and run the program `ja!ac *?Expimple.ja!a8 `ja!a *?Expimple
&utput8
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
I7
esult8
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
I< E=N#8 D!e8
PROGRAM TO DEMONSTRATE TE USE O MAP AND REDUCE TASS
(im8 To demonstrate the use of 3ap and educe tass. Procedure8 tep ;8 %reate an input director/ using the follo"ing command Zhadoop@hadp hadoop[`<"$/*.( .( -'."& /ue&001/*.##% tep 28 %op/ the input file in the input director/ using the follo"ing command Zhadoop@hadp hadoop[`<"$/*.( .( %u! /*#'e/*.##%/*.##%/("l /*#'e/*.##%/*.##%/("le1!=! e1!=! /ue&001/*.##% tep 78 un the application $/ taing the input files from the input director/ using the follo"ing command. Zhadoop@hadphadoop[`<"$/*.##% @& *&e/*.##%/'%&e.u)e/*.##%-'%&e.u)e-e='%le270@& g&e% /ue&001/*.##%/("le1!=! /#u!%u!001 4IT5
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
I5
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
I=
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering
I
esult
Department of IT
IT6713 – Grid & Cloud Computing Computing Lab
Jerusalem College of of Engineering