{"id":1201,"date":"2022-02-03T18:02:28","date_gmt":"2022-02-03T10:02:28","guid":{"rendered":"http:\/\/www.eait.co\/?p=1201"},"modified":"2022-02-03T18:10:34","modified_gmt":"2022-02-03T10:10:34","slug":"spark-jobhistoryserver-%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/notes.coremix.net\/?p=1201","title":{"rendered":"spark JobHistoryServer \u914d\u7f6e"},"content":{"rendered":"<p><span style=\"color: black; font-size: 14pt;\"><strong><span style=\"font-family: \u5b8b\u4f53;\">\u4fee\u6539 <\/span><span style=\"font-family: Times New Roman;\">spark-default.conf.template <\/span><\/strong><span style=\"font-family: \u5b8b\u4f53;\"><strong>\u540d\u79f0<\/strong><br \/>\n<\/span><span style=\"font-family: Times New Roman;\">mv spark-defaults.conf.template<\/span><\/span><span style=\"font-family: \u5b8b\u4f53; font-size: 16pt;\"><br \/>\n<\/span><span style=\"color: black; font-family: Times New Roman; font-size: 14pt;\">spark-defaults.conf<br \/>\n<\/span><\/p>\n<p><span style=\"color: black; font-size: 14pt;\"><strong><span style=\"font-family: \u5b8b\u4f53;\">\u4fee\u6539 <\/span><span style=\"font-family: Times New Roman;\">spark-default.conf <\/span><span style=\"font-family: \u5b8b\u4f53;\">\u6587\u4ef6\uff0c \u5f00\u542f <\/span><span style=\"font-family: Times New Roman;\">Log<\/span><\/strong><span style=\"font-family: \u5b8b\u4f53;\"><strong>\uff1a<\/strong><br \/>\n<\/span><span style=\"font-family: Times New Roman;\">vi spark-defaults.conf<br \/>\n<\/span><\/span><\/p>\n<p><span style=\"color: #0070c0; font-family: \u5b8b\u4f53; font-size: 12pt;\">spark.eventLog.enabled true<br \/>\n<\/span><\/p>\n<p><span style=\"color: #0070c0; font-family: \u5b8b\u4f53; font-size: 12pt;\">spark.eventLog.dir hdfs:\/\/bigdata166:9000\/directory<br \/>\n<\/span><\/p>\n<p><span style=\"color: red; font-size: 14pt;\"><span style=\"font-family: \u5b8b\u4f53;\">\u6ce8\u610f\uff1a <\/span><span style=\"font-family: Times New Roman;\">HDFS <\/span><span style=\"font-family: \u5b8b\u4f53;\">\u4e0a\u7684\u76ee\u5f55\u9700\u8981\u63d0\u524d\u5b58\u5728\u3002<\/span><span style=\"color: black; font-family: Times New Roman;\"><br \/>\n<\/span><\/span><\/p>\n<p><span style=\"color: black;\"><span style=\"font-size: 14pt;\"><strong><span style=\"font-family: \u5b8b\u4f53;\">\u4fee\u6539 <\/span><span style=\"font-family: Times New Roman;\">spark-env.sh <\/span><\/strong><span style=\"font-family: \u5b8b\u4f53;\"><strong>\u6587\u4ef6\uff0c \u6dfb\u52a0\u5982\u4e0b\u914d\u7f6e\uff1a<\/strong><br \/>\n<\/span><\/span><span style=\"font-family: Times New Roman;\"><span style=\"font-size: 14pt;\"> vim spark-env.sh<\/span><br \/>\n<span style=\"color: #0070c0;\">export SPARK_HISTORY_OPTS=&#8221;-Dspark.history.ui.port=18080<br \/>\n<\/span><\/span><\/span><\/p>\n<p><span style=\"color: #0070c0; font-family: Times New Roman;\">-Dspark.history.retainedApplications=30<br \/>\n<\/span><\/p>\n<p><span style=\"color: #0070c0;\"><span style=\"font-family: Times New Roman;\">-Dspark.history.fs.logDirectory=hdfs:\/\/bigdata166:9000\/directory&#8221;<span style=\"color: black;\"><br \/>\n<\/span><\/span><span style=\"color: red; font-size: 14pt;\"><span style=\"font-family: \u5b8b\u4f53;\">\u53c2\u6570\u63cf\u8ff0\uff1a<br \/>\n<\/span><span style=\"color: black;\"><span style=\"font-family: Times New Roman;\">spark.eventLog.dir<\/span><span style=\"font-family: \u5b8b\u4f53;\">\uff1a <\/span><span style=\"font-family: Times New Roman;\">Application <\/span><span style=\"font-family: \u5b8b\u4f53;\">\u5728\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u6240\u6709\u7684\u4fe1\u606f\u5747\u8bb0\u5f55\u5728\u8be5\u5c5e\u6027\u6307\u5b9a\u7684\u8def\u5f84\u4e0b<br \/>\n<\/span><span style=\"font-family: Times New Roman;\">spark.history.ui.port=18080 WEBUI <\/span><span style=\"font-family: \u5b8b\u4f53;\">\u8bbf\u95ee\u7684\u7aef\u53e3\u53f7\u4e3a <\/span><span style=\"font-family: Times New Roman;\">18080<br \/>\nspark.history.fs.logDirectory=hdfs:\/\/bigdata166:9000\/directory <\/span><span style=\"font-family: \u5b8b\u4f53;\">\u914d\u7f6e\u4e86\u8be5\u5c5e\u6027\u540e\uff0c \u5728<br \/>\n<\/span><span style=\"font-family: Times New Roman;\">start-history-server.sh <\/span><span style=\"font-family: \u5b8b\u4f53;\">\u65f6\u5c31\u65e0\u9700\u518d\u663e\u5f0f\u7684\u6307\u5b9a\u8def\u5f84\uff0c <\/span><span style=\"font-family: Times New Roman;\">Spark History Server <\/span><span style=\"font-family: \u5b8b\u4f53;\">\u9875\u9762\u53ea\u5c55\u793a\u8be5\u6307\u5b9a\u8def<br \/>\n\u5f84\u4e0b\u7684\u4fe1\u606f<br \/>\n<\/span><span style=\"font-family: Times New Roman;\">spark.history.retainedApplications=30 <\/span><span style=\"font-family: \u5b8b\u4f53;\">\u6307\u5b9a\u4fdd\u5b58 <\/span><span style=\"font-family: Times New Roman;\">Application <\/span><span style=\"font-family: \u5b8b\u4f53;\">\u5386\u53f2\u8bb0\u5f55\u7684\u4e2a\u6570\uff0c \u5982\u679c\u8d85\u8fc7\u8fd9<br \/>\n\u4e2a\u503c\uff0c \u65e7\u7684\u5e94\u7528\u7a0b\u5e8f\u4fe1\u606f\u5c06\u88ab\u5220\u9664\uff0c \u8fd9\u4e2a\u662f\u5185\u5b58\u4e2d\u7684\u5e94\u7528\u6570\uff0c \u800c\u4e0d\u662f\u9875\u9762\u4e0a\u663e\u793a\u7684\u5e94\u7528\u6570\u3002<br \/>\n<\/span><\/span><\/span><\/span><\/p>\n<p><span style=\"color: black; font-size: 14pt;\"><span style=\"font-family: \u5b8b\u4f53;\"><strong>\u5206\u53d1\u914d\u7f6e\u6587\u4ef6<\/strong><br \/>\n<\/span><span style=\"color: #0070c0;\"><span style=\"font-family: Times New Roman;\">xsync spark-defaults.conf<br \/>\nxsync spark-env.sh<span style=\"color: black;\"><br \/>\n<\/span><\/span><span style=\"font-family: \u5b8b\u4f53;\"><strong>\u542f\u52a8\u5386\u53f2\u670d\u52a1<\/strong><span style=\"color: black;\"><br \/>\n<\/span><\/span><span style=\"font-family: Times New Roman;\">sbin\/start-history-server.sh<span style=\"color: black;\"><br \/>\n<\/span><\/span><\/span><\/span><\/p>\n<p><span style=\"color: black; font-size: 14pt;\"><span style=\"font-family: \u5b8b\u4f53;\"><strong>\u518d\u6b21\u6267\u884c\u4efb\u52a1<\/strong><br \/>\n<\/span><span style=\"font-family: Times New Roman;\">bin\/spark-submit \\<br \/>\n&#8211;class org.apache.spark.examples.SparkPi \\<br \/>\n&#8211;master spark:\/\/bigdata166:7077 \\<br \/>\n&#8211;executor-memory 1G \\<br \/>\n&#8211;total-executor-cores 2 \\<br \/>\n.\/examples\/jars\/spark-examples_2.11-2.1.1.jar \\<\/span><\/span><\/p>\n<p><span style=\"color: black; font-size: 14pt;\"><span style=\"font-family: \u5b8b\u4f53;\"><strong>\u67e5\u770b\u5386\u53f2\u670d\u52a1<\/strong><br \/>\n<\/span><span style=\"color: red; font-family: Times New Roman;\">bigdata166:18080<\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4fee\u6539 spark-default.conf.template \u540d\u79f0 mv spark-defaults.con [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,29],"tags":[],"class_list":["post-1201","post","type-post","status-publish","format-standard","hentry","category-bigdata","category-29"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts\/1201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1201"}],"version-history":[{"count":3,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts\/1201\/revisions"}],"predecessor-version":[{"id":1205,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts\/1201\/revisions\/1205"}],"wp:attachment":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}