没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
Cloudera Custom Training:
Hands-On Exercises
General'Notes'............................................................................................................................'3!
Hands-On'Exercise:'Query'Hadoop'Data'with'Apache'Impala'.................................'6!
Hands-On'Exercise:'Access'HDFS'with'the'Command'Line'and'Hue'......................'8!
Hands-On'Exercise:'Run'a'YARN'Job'..............................................................................'14!
Hands-On'Exercise:'Explore'RDDs'Using'the'Spark'Shell'.......................................'20!
Hands-On'Exercise:'Process'Data'Files'with'Apache'Spark'...................................'30!
Hands-On'Exercise:'Use'Pair'RDDs'to'Join'Two'Datasets'.......................................'34!
Hands-On'Exercise:'Write'and'Run'an'Apache'Spark'Application'......................'39!
Hands-On'Exercise:'Configure'an'Apache'Spark'Application'................................'44!
Hands-On'Exercise:'View'Jobs'and'Stages'in'the'Spark'Application'UI'..............'49!
Hands-On'Exercise:'Persist'an'RDD'................................................................................'55!
!
Copyright © 2010-2016 Cloudera, Inc. All rights reserved.
Not to be reproduced or shared without prior written consent from Cloudera.
2
2
Hands-On'Exercise:'Implement'an'Iterative'Algorithm'with'Apache'Spark'....'58!
Hands-On'Exercise:'Use'Apache'Spark'SQL'for'ETL'..................................................'62!
Hands-On'Exercise:'Write'an'Apache'Spark'Streaming'Application'..................'68!
Hands-On'Exercise:'Process'Multiple'Batches'with'Apache'Spark'Streaming' 73!
Hands-On'Exercise:'Process'Apache'Kafka'Messages'with'Apache'Spark'
Streaming'................................................................ ................................................................'78!
Appendix'A:'Enabling'Jupyter'Notebook'for'PySpark'..............................................'82!
Appendix'B:'Managing'Services'on'the'Course'Virtual'Machine'..........................'85!
!
Copyright © 2010-2016 Cloudera, Inc. All rights reserved.
Not to be reproduced or shared without prior written consent from Cloudera.
3
3
General Notes
"#$%&'()*+!,()-.-./!0$%(+'+!%+'!)!1-(,%)#!2)03-.'!(%..-./!,3'!"'.,45!6-.%7!
&-+,(-8%,-$.9!:3-+!12!3)+!";<!-.+,)##'&!-.!=+'%&$>&-+,(-8%,'&!?$&'9!@+'%&$>
&-+,(-8%,'&!?$&'!-+!)!?',3$&!$A!(%..-./!<)&$$=!B3'('8C!)##!<)&$$=!&)'?$.+!(%.!
$.!,3'!+)?'!?)03-.'9!D,!-+E!'++'.,-)##CE!)!0#%+,'(!0$.+-+,-./!$A!)!+-./#'!?)03-.'9!D,!
B$(F+!G%+,!#-F'!)!#)(/'(!<)&$$=!0#%+,'(H!,3'!$.#C!F'C!&-AA'('.0'!-+!,3),!,3'!<;I5!
8#$0F!('=#-0),-$.!A)0,$(!-+!+',!,$!JE!+-.0'!,3'('!-+!$.#C!)!+-./#'!;),)K$&'!)L)-#)8#'9!
Points to Note while Working in the Virtual Machine
• :3'!1-(,%)#!2)03-.'!M12N!-+!+',!,$!#$/!-.!)+!,3'!%+'(!training!)%,$?),-0)##C9!DA!
C$%!#$/!$%,E!C$%!0).!#$/!8)0F!-.!)+!,3'!%+'(!training!B-,3!,3'!=)++B$(&!
training9!
• DA!C$%!.''&!-,E!,3'!($$,!=)++B$(&!-+!training9!O$%!?)C!8'!=($?=,'&!A$(!,3-+!-AE!
A$(!'7)?=#'E!C$%!B).,!,$!03)./'!,3'!F'C8$)(&!#)C$%,9!D.!/'.'()#E!C$%!+3$%#&!.$,!
.''&!,3-+!=)++B$(&!+-.0'!,3'!training!%+'(!3)+!%.#-?-,'&!+%&$!=(-L-#'/'+9!
• D.!+$?'!0$??).&>#-.'!+,'=+!-.!,3'!'7'(0-+'+E!C$%!B-##!+''!#-.'+!#-F'!,3-+P!
$ hdfs dfs -put united_states_census_data_2010 \
/user/training/example
:3'!&$##)(! +-/.!MQN!),!,3'!8'/-..-./!$A!')03!#-.'!-.&-0),'+!,3'!6-.%7! +3'##!=($?=,9!
:3'!)0,%)#!=($?=,!B-##!-.0#%&'!)&&-,-$.)#!-.A$(?),-$.!MA$(!'7)?=#'E!
[training@localhost training_materials]$N!8%,!,3-+!-+!$?-,,'&!
A($?!,3'+'!-.+,(%0,-$.+!A$(!8('L-,C9!
:3'!8)0F+#)+3!M\N!),!,3'!'.&!$A!,3'!A-(+,!#-.'!+-/.-A-'+!,3),!,3'!0$??).&!-+!.$,!
0$?=#','&E!).&!0$.,-.%'+!$.!,3'!.'7,!#-.'9!O$%!0).!'.,'(!,3'!0$&'!'7)0,#C!)+!
+3$B.!M$.!,B$!#-.'+NE!$(!C$%!0).!'.,'(!-,!$.!)!+-./#'!#-.'9!DA!C$%!&$!,3'!#),, '(E!
C$%!+3$%#&!not!,C='!-.!,3'!8)0F+#)+39!
• R#,3$%/3!?$+,!+,%&'.,+!)('!0$?A$(,)8#'!%+-./!SKDT!,'7,!'&-,$(+!#-F'!L-!$(!'?)0+E!
+$?'!?-/3,!=('A'(!)!/()=3-0)#!,'7,!'&-,$(9!:$!-.L$F'!,3'!/()=3-0)#!'&-,$(!A($?!
,3'!0$??).&!#-.'E!,C='!gedit!A$##$B'&!8C!,3'!=),3!$A!,3'!A-#'!C$%!B-+3! ,$!'&-,9!
!
Copyright © 2010-2016 Cloudera, Inc. All rights reserved.
Not to be reproduced or shared without prior written consent from Cloudera.
4
4
R=='.&-./!&!,$!,3'!0$??).&!)##$B+!C$%!,$!,C='!)&&-,-$.)#!0$??).&+!B3-#'!,3'!
'&-,$(!-+!+,-##!$='.9!<'('!-+!).!'7)?=#'!$A!3$B!,$!'&-,!)!A-#'!.)?'&!myfile.txtP!
$ gedit myfile.txt &
Points to Note during the Exercises
Directories
• :3'!?)-.!&-('0,$(C!A$(!,3'!'7'(0-+'+!-+!
~/training_materials/devsh/exercises9!U)03!&-('0,$(C!%.&'(!,3),!
$.'!0$(('+=$.&+!,$!).!'7'(0-+'!$(!+',!$A!'7'(0-+'+V,3-+!-+!('A'(('&!,$!-.!,3'!
-.+,(%0,-$.+!)+!W,3'!'7'(0-+'!&-('0,$(C9X!R.C!+0(-=,+!$(!A-#'+!('Y%-('&!A$(!,3'!
'7'(0-+'!M$,3'(!,3).!&),)N!)('!-.!,3'!'7'(0-+'!&-('0,$(C9!
• Z-,3-.!')03!'7'(0-+'!&-('0,$(C!C$%!?)C!A-.&!,3'!A$##$B-./!+%8&-('0,$(-'+P!
• solutionV:3-+!0$.,)-.+!+$#%,-$.!0$&'!A$(!')03!'7'(0-+'9!
• stubsVR!A'B!$A!,3'!'7'(0-+'+!&'='.&!$.!=($L-&'&!+,)(,'(!A-#'+!
0$.,)-.-./!+F'#',$.!0$&'9!!
• 2)L'.!=($G'0,!&-('0,$(-'+VI$(!'7'(0-+'+!A$(!B3-03!C$%!?%+,!B(-,'!50)#)!
0#)++'+E!C$%!3)L'!8''.!=($L-&'&!B-,3!=('0$.A-/%('&!2)L'.!=($G'0,!
&-('0,$(-'+9!Z-,3-.!,3'+'!=($G'0,+!)('!,B$!=)0F)/'+P!stubsE!B3'('!C$%!
B-##!&$!C$%(!B$(F!%+-./!+,)(,'(!+F'#',$.!0#)++'+H!).&!solutionE!
0$.,)-.-./!,3'!+$#%,-$.!0#)++9!
• ;),)!A-#'+!%+'&!-.!,3'!'7'(0-+'+!)('!-.!~/training_materials/data9!
S+%)##C!C$%!B-##!%=#$)&!,3'!A-#'+!,$!<;I5!8'A$('!B$(F-./!B-,3!,3'?9!
• :3'!12!&'A-.'+!)!A'B!'.L-($.?'.,!L)(-)8#'+!,3),!)('!%+'&!-.!=#)0'!$A!#$./'(!
=),3+!-.!,3'!-.+,(%0,-$.+9!5-.0'!')03!L)(-)8#'!-+!)%,$?),-0)##C!('=#)0'&!B-,3!-,+!
0$(('+=$.&-./!L)#%'+!B3'.!C$%!(%.!0$??).&+!-.!,3'!,'(?-.)#E!,3-+!?)F'+!-,!
')+-'(!).&!A)+,'(!A$(!C$%!,$!'.,'(!)!0$??).&9!!
• :3'!,B$!'.L-($.?'.,!L)(-)8#'+!A$(!,3-+!0$%(+'!)('!$DEVSH!).&!$DEVDATA9!
S.&'(!$DEVSH!C$%!0).!A-.&!exercisesE!examplesE!).&!scripts9!
• O$%!0).!)#B)C+!%+'!,3'!echo!0$??).&!-A!C$%!B$%#&!#-F'!,$!+''!,3'!L)#%'!$A!
).!'.L-($.?'.,!L)(-)8#'P!
!
Copyright © 2010-2016 Cloudera, Inc. All rights reserved.
Not to be reproduced or shared without prior written consent from Cloudera.
5
5
$ echo $DEVSH
!
Step-by-Step Instructions
R+!,3'!'7'(0-+'+!=($/('++E!).&!C$%!/)-.!?$('!A)?-#-)(-,C!B-,3!,3'!,$$#+!).&!
'.L-($.?'.,E!B'!=($L-&'!A'B'(!+,'=>8C>+,'=!-.+,(%0,-$.+H!)+!-.!,3'!(')#!B$(#&E!B'!
?'('#C!/-L'!C$%!)!('Y%-('?'.,!).&!-,*+!%=!,$!C$%!,$!+$#L'!,3'!=($8#'?[!O$%!+3$%#&!
A''#!A(''!,$!('A'(!,$!,3'!3-.,+!$(!+$#%,-$.+!=($L-&'&E!)+F!C$%(!-.+,(%0,$(!A$(!
)++-+,).0'E!$(!0$.+%#,!B-,3!C$%(!A'##$B!+,%&'.,+9!
Bonus Exercises
:3'('!)('!)&&-,-$.)#!03)##'./'+!A$(!+$?'!$A!,3'!3).&+>$.!'7'(0-+'+9!DA!C$%!A-.-+3!,3'!
?)-.!'7'(0-+'E!=#')+'!),,'?=,!,3'!)&&-,-$.)#!+,'=+9!
Catch-Up Script
DA!C$%!)('!%.)8#'!,$!0$?=#','!).!'7'(0-+'E!B'!3)L'!=($L-&'&!)!+0(-=,!,$!0),03!C$%!%=!
)%,$?),-0)##C9!U)03!'7'(0-+'!3)+!-.+,(%0,-$.+!A$(!(%..-./!,3'!0),03>%=!+0(-=,E!B3'('!
)==#-0)8#'9!
$ $DEVSH/scripts/catchup.sh
:3'!+0(-=,!B-##!=($?=,!A$(!B3-03!'7'(0-+'!C$%!)('!+,)(,-./H!-,!B-##!+',!%=!)##!,3'!
('Y%-('&!&),)!)+!-A!C$%!3)&!0$?=#','&!)##!,3'!=('L-$%+!'7'(0-+'+9!
Z)(.-./P!DA!C$%!(%.!,3'!0),03!%=!+0(-=,E!C$%!?)C!#$+'!C$%(!B$(F9!MI$(!'7)?=#'E!)##!
&),)!B-##!8'!&'#','&!A($?!<;I59N!
!
剩余86页未读,继续阅读
资源评论
VinLSJ2020
- 粉丝: 4
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功