Spark机器学习-Spark工程搭建

x33g5p2x  于2020-11-03 转载在 Spark  
字(18.6k)|赞(0)|评价(0)|浏览(725)

概述

最近自己在加强AI这块,以前做Java、大数据分析比较多,所以对CDH那套东西都比较熟悉,例如Hadoop、Spark。但Spark这块中的ML用得不是很多,以前项目中,涉及到算法部分,我们往往都会让python系的同事负责。在AI这方面,python语言确实会有比较大的优势。当然,如果你的数据环境是基于Hadoop这些大数据框架来搭建的,我们也会用上spark去做算法这块处理,主要就是用到Pyspark里的Spark ML做数据处理。用Scala写都会相对比较少,我们都知道Spark的源码是用Scala来写的,而且官网都推荐我们用Scala来做开发。自己在早几年就买了《Spark机器学习》这本书,当时只是简单看了一下,由于在项目中很少用到,就没怎么花时间去深入研究。最近在做一些AI的基础整理,所以又重新看回这本书,自己也写写笔记,和大家分享一下。

环境准备

做过Spark开发的朋友都会有这样的感受,需要花很多时间在环境上,各种版本冲突报错,而且还不好找问题。确实,在大数据这些框架,他们经常要整合在一起,不像一些框架,可以把所有组件一起封装起来打包。拿Spark来说,能让Spark跑起来,我们需要安装Jdk、Scala环境,构建工程还需要安装maven工具。如果还需要整合一些存储框架,如hdfs、hive、hbase那些,到时会更麻烦。所以我们在实际项目开发中,都会好好整理组件之间的版本信息。

我们先从简单到复杂,慢慢地搭建起来,先把jdk、scala、maven环境搞好。这里就不是详细介绍这几个环境的安装过程了,这些网上都很多类似的教程。我这里列一下我的环境版本信息:

JDK:java version "1.8.0_151"

Scala:version 2.11.12

maven:Apache Maven 3.6.3

搭建Spark项目的代码工程

创建maven项目工程

新建一个maven project。

选择相应版本的JDK,以及Scala环境。

填写相应信息:

然后下一步,配置maven环境。

最后就可以创建工程了。

稍微等一会,就可以创建好。

创建好后,但发现pom有报错,报错信息如下:

Cannot resolve plugin org.scala-tools:maven-scala-plugin:<unknown>
Cannot resolve plugin org.apache.maven.plugins:maven-eclipse-plugin:<unknown>

我们打开pom.xml文件看看。

好像没有看到标红的地方,那我们先忽略它,到时用得时候,出问题再看看。

创建scala测试类

建好工程后,我们尝试创建一下scala类,看能不能正常使用。

我们会发现,IDEA会默认帮我们创建好一个名为“App.scala"文件。我们直接运行一下,看看是什么效果。

执行运行后,但直接报错了,编译那里就没有通过。看来上面的pom那里报错,还是有影响的。那我们只好深入研究一下,把这个bug先解决了。

println方法标红报错提示。

报错信息:

Error:scalac: Scala compiler JARs not found (module 'SparkMLDemo'): D:\maven_repository_3.63\org\scala-lang\scala-reflect\2.7.0\scala-reflect-2.7.0.jar

详细看了一下,这里说找不到scala-reflect-2.7.0.jar包,这个scala的版本和我们本机装的版本好像不一样。那我们看回pom.xml文件。

看来IDEA没有用我们本地scala环境来生成工程,那我们手动改一下,把版本改回我们自己本机的scala版本,我这里装的是2.11.12,所以pom.xml文件里改成这样。

<properties>
<scala.version>2.11.12</scala.version>
</properties>

然后重新更新maven,根据以下步骤来操作。

pom.xml--》右键--》Mave--》Reimport

重新看回“App.scala”文件,println方法不报错了,但Application那里还是红色报错。

如果对scala比较熟的朋友,可能会了解这种“extends Application”写法,这是scala的Main方法第二种实现方式。但我们一般都不建议这样使用,如果采用这种方法,我们无法向主函数(Main方法)传入参数。所以我们把代码改一下,改成以下方式。

package com.ispeasant
//*/*
/* Hello world!
/*
/*/
object App {
def main(args: Array[String]): Unit = {
println("Hello World!")
}
}

同时我们把“test”里的东西清掉,免得有其它乱七八糟的问题。

删除后,然后运行看看效果。

Hello World!

所以从目前的来看,Scala环境应该是搞好的。

整合spark环境

弄好scala环境后,我们就可以接着弄spark环境,我们现在pom.xml文件里,添加spark相关的jar包。

<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>${spark.version}</version>
</dependency>

spark版本用的是2.4.0版本,所以需要在pom.xml文件前面添加spark版本变量。

<properties>
<scala.version>2.11.12</scala.version>
<spark.version>2.4.0</spark.version>
</properties>

添加好后,手动更新一下maven。

没问题后,我创建一个新scala文件来测试一下spark环境。

先实现最简单的代码逻辑,创建一个SparkContext,如果创建成功就打印出来。代码如下:

package com.ispeasant
import org.apache.spark.SparkContext
object SparkTest {
def main(args: Array[String]): Unit = {
val sc = new SparkContext("local[2]", "Spark Test")
if (sc != null)
println(sc.toString)
sc.stop()
}
}

然后,我们运行一下,看看结果。

E:\Java\jdk1.8.0_151\bin\java.exe "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2020.1\lib\idea_rt.jar=62938:C:\Program Files\JetBrains\IntelliJ IDEA 2020.1\bin" -Dfile.encoding=UTF-8 -classpath E:\Java\jdk1.8.0_151\jre\lib\charsets.jar;E:\Java\jdk1.8.0_151\jre\lib\deploy.jar;E:\Java\jdk1.8.0_151\jre\lib\ext\access-bridge-64.jar;E:\Java\jdk1.8.0_151\jre\lib\ext\cldrdata.jar;E:\Java\jdk1.8.0_151\jre\lib\ext\dnsns.jar;E:\Java\jdk1.8.0_151\jre\lib\ext\jaccess.jar;E:\Java\jdk1.8.0_151\jre\lib\ext\jfxrt.jar;E:\Java\jdk1.8.0_151\jre\lib\ext\localedata.jar;E:\Java\jdk1.8.0_151\jre\lib\ext\nashorn.jar;E:\Java\jdk1.8.0_151\jre\lib\ext\sunec.jar;E:\Java\jdk1.8.0_151\jre\lib\ext\sunjce_provider.jar;E:\Java\jdk1.8.0_151\jre\lib\ext\sunmscapi.jar;E:\Java\jdk1.8.0_151\jre\lib\ext\sunpkcs11.jar;E:\Java\jdk1.8.0_151\jre\lib\ext\zipfs.jar;E:\Java\jdk1.8.0_151\jre\lib\javaws.jar;E:\Java\jdk1.8.0_151\jre\lib\jce.jar;E:\Java\jdk1.8.0_151\jre\lib\jfr.jar;E:\Java\jdk1.8.0_151\jre\lib\jfxswt.jar;E:\Java\jdk1.8.0_151\jre\lib\jsse.jar;E:\Java\jdk1.8.0_151\jre\lib\management-agent.jar;E:\Java\jdk1.8.0_151\jre\lib\plugin.jar;E:\Java\jdk1.8.0_151\jre\lib\resources.jar;E:\Java\jdk1.8.0_151\jre\lib\rt.jar;E:\ispeasant\github\bwzydy4learn\Scala\SparkMLDemo\target\classes;D:\maven_repository_3.63\org\scala-lang\scala-library\2.11.12\scala-library-2.11.12.jar;D:\maven_repository_3.63\org\apache\spark\spark-core_2.11\2.4.0\spark-core_2.11-2.4.0.jar;D:\maven_repository_3.63\org\apache\avro\avro\1.8.2\avro-1.8.2.jar;D:\maven_repository_3.63\org\codehaus\jackson\jackson-core-asl\1.9.13\jackson-core-asl-1.9.13.jar;D:\maven_repository_3.63\org\codehaus\jackson\jackson-mapper-asl\1.9.13\jackson-mapper-asl-1.9.13.jar;D:\maven_repository_3.63\com\thoughtworks\paranamer\paranamer\2.7\paranamer-2.7.jar;D:\maven_repository_3.63\org\apache\commons\commons-compress\1.8.1\commons-compress-1.8.1.jar;D:\maven_repository_3.63\org\tukaani\xz\1.5\xz-1.5.jar;D:\maven_repository_3.63\org\apache\avro\avro-mapred\1.8.2\avro-mapred-1.8.2-hadoop2.jar;D:\maven_repository_3.63\org\apache\avro\avro-ipc\1.8.2\avro-ipc-1.8.2.jar;D:\maven_repository_3.63\commons-codec\commons-codec\1.9\commons-codec-1.9.jar;D:\maven_repository_3.63\com\twitter\chill_2.11\0.9.3\chill_2.11-0.9.3.jar;D:\maven_repository_3.63\com\esotericsoftware\kryo-shaded\4.0.2\kryo-shaded-4.0.2.jar;D:\maven_repository_3.63\com\esotericsoftware\minlog\1.3.0\minlog-1.3.0.jar;D:\maven_repository_3.63\org\objenesis\objenesis\2.5.1\objenesis-2.5.1.jar;D:\maven_repository_3.63\com\twitter\chill-java\0.9.3\chill-java-0.9.3.jar;D:\maven_repository_3.63\org\apache\xbean\xbean-asm6-shaded\4.8\xbean-asm6-shaded-4.8.jar;D:\maven_repository_3.63\org\apache\hadoop\hadoop-client\2.6.5\hadoop-client-2.6.5.jar;D:\maven_repository_3.63\org\apache\hadoop\hadoop-common\2.6.5\hadoop-common-2.6.5.jar;D:\maven_repository_3.63\commons-cli\commons-cli\1.2\commons-cli-1.2.jar;D:\maven_repository_3.63\xmlenc\xmlenc\0.52\xmlenc-0.52.jar;D:\maven_repository_3.63\commons-httpclient\commons-httpclient\3.1\commons-httpclient-3.1.jar;D:\maven_repository_3.63\commons-io\commons-io\2.4\commons-io-2.4.jar;D:\maven_repository_3.63\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;D:\maven_repository_3.63\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;D:\maven_repository_3.63\commons-configuration\commons-configuration\1.6\commons-configuration-1.6.jar;D:\maven_repository_3.63\commons-digester\commons-digester\1.8\commons-digester-1.8.jar;D:\maven_repository_3.63\commons-beanutils\commons-beanutils\1.7.0\commons-beanutils-1.7.0.jar;D:\maven_repository_3.63\commons-beanutils\commons-beanutils-core\1.8.0\commons-beanutils-core-1.8.0.jar;D:\maven_repository_3.63\com\google\protobuf\protobuf-java\2.5.0\protobuf-java-2.5.0.jar;D:\maven_repository_3.63\com\google\code\gson\gson\2.2.4\gson-2.2.4.jar;D:\maven_repository_3.63\org\apache\hadoop\hadoop-auth\2.6.5\hadoop-auth-2.6.5.jar;D:\maven_repository_3.63\org\apache\httpcomponents\httpclient\4.2.5\httpclient-4.2.5.jar;D:\maven_repository_3.63\org\apache\httpcomponents\httpcore\4.2.4\httpcore-4.2.4.jar;D:\maven_repository_3.63\org\apache\directory\server\apacheds-kerberos-codec\2.0.0-M15\apacheds-kerberos-codec-2.0.0-M15.jar;D:\maven_repository_3.63\org\apache\directory\server\apacheds-i18n\2.0.0-M15\apacheds-i18n-2.0.0-M15.jar;D:\maven_repository_3.63\org\apache\directory\api\api-asn1-api\1.0.0-M20\api-asn1-api-1.0.0-M20.jar;D:\maven_repository_3.63\org\apache\directory\api\api-util\1.0.0-M20\api-util-1.0.0-M20.jar;D:\maven_repository_3.63\org\apache\curator\curator-client\2.6.0\curator-client-2.6.0.jar;D:\maven_repository_3.63\org\htrace\htrace-core\3.0.4\htrace-core-3.0.4.jar;D:\maven_repository_3.63\org\apache\hadoop\hadoop-hdfs\2.6.5\hadoop-hdfs-2.6.5.jar;D:\maven_repository_3.63\org\mortbay\jetty\jetty-util\6.1.26\jetty-util-6.1.26.jar;D:\maven_repository_3.63\xerces\xercesImpl\2.9.1\xercesImpl-2.9.1.jar;D:\maven_repository_3.63\xml-apis\xml-apis\1.3.04\xml-apis-1.3.04.jar;D:\maven_repository_3.63\org\apache\hadoop\hadoop-mapreduce-client-app\2.6.5\hadoop-mapreduce-client-app-2.6.5.jar;D:\maven_repository_3.63\org\apache\hadoop\hadoop-mapreduce-client-common\2.6.5\hadoop-mapreduce-client-common-2.6.5.jar;D:\maven_repository_3.63\org\apache\hadoop\hadoop-yarn-client\2.6.5\hadoop-yarn-client-2.6.5.jar;D:\maven_repository_3.63\org\apache\hadoop\hadoop-yarn-server-common\2.6.5\hadoop-yarn-server-common-2.6.5.jar;D:\maven_repository_3.63\org\apache\hadoop\hadoop-mapreduce-client-shuffle\2.6.5\hadoop-mapreduce-client-shuffle-2.6.5.jar;D:\maven_repository_3.63\org\apache\hadoop\hadoop-yarn-api\2.6.5\hadoop-yarn-api-2.6.5.jar;D:\maven_repository_3.63\org\apache\hadoop\hadoop-mapreduce-client-core\2.6.5\hadoop-mapreduce-client-core-2.6.5.jar;D:\maven_repository_3.63\org\apache\hadoop\hadoop-yarn-common\2.6.5\hadoop-yarn-common-2.6.5.jar;D:\maven_repository_3.63\javax\xml\bind\jaxb-api\2.2.2\jaxb-api-2.2.2.jar;D:\maven_repository_3.63\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;D:\maven_repository_3.63\org\codehaus\jackson\jackson-jaxrs\1.9.13\jackson-jaxrs-1.9.13.jar;D:\maven_repository_3.63\org\codehaus\jackson\jackson-xc\1.9.13\jackson-xc-1.9.13.jar;D:\maven_repository_3.63\org\apache\hadoop\hadoop-mapreduce-client-jobclient\2.6.5\hadoop-mapreduce-client-jobclient-2.6.5.jar;D:\maven_repository_3.63\org\apache\hadoop\hadoop-annotations\2.6.5\hadoop-annotations-2.6.5.jar;D:\maven_repository_3.63\org\apache\spark\spark-launcher_2.11\2.4.0\spark-launcher_2.11-2.4.0.jar;D:\maven_repository_3.63\org\apache\spark\spark-kvstore_2.11\2.4.0\spark-kvstore_2.11-2.4.0.jar;D:\maven_repository_3.63\org\fusesource\leveldbjni\leveldbjni-all\1.8\leveldbjni-all-1.8.jar;D:\maven_repository_3.63\com\fasterxml\jackson\core\jackson-core\2.6.7\jackson-core-2.6.7.jar;D:\maven_repository_3.63\com\fasterxml\jackson\core\jackson-annotations\2.6.7\jackson-annotations-2.6.7.jar;D:\maven_repository_3.63\org\apache\spark\spark-network-common_2.11\2.4.0\spark-network-common_2.11-2.4.0.jar;D:\maven_repository_3.63\org\apache\spark\spark-network-shuffle_2.11\2.4.0\spark-network-shuffle_2.11-2.4.0.jar;D:\maven_repository_3.63\org\apache\spark\spark-unsafe_2.11\2.4.0\spark-unsafe_2.11-2.4.0.jar;D:\maven_repository_3.63\javax\activation\activation\1.1.1\activation-1.1.1.jar;D:\maven_repository_3.63\org\apache\curator\curator-recipes\2.6.0\curator-recipes-2.6.0.jar;D:\maven_repository_3.63\org\apache\curator\curator-framework\2.6.0\curator-framework-2.6.0.jar;D:\maven_repository_3.63\com\google\guava\guava\16.0.1\guava-16.0.1.jar;D:\maven_repository_3.63\org\apache\zookeeper\zookeeper\3.4.6\zookeeper-3.4.6.jar;D:\maven_repository_3.63\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar;D:\maven_repository_3.63\org\apache\commons\commons-lang3\3.5\commons-lang3-3.5.jar;D:\maven_repository_3.63\org\apache\commons\commons-math3\3.4.1\commons-math3-3.4.1.jar;D:\maven_repository_3.63\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar;D:\maven_repository_3.63\org\slf4j\slf4j-api\1.7.16\slf4j-api-1.7.16.jar;D:\maven_repository_3.63\org\slf4j\jul-to-slf4j\1.7.16\jul-to-slf4j-1.7.16.jar;D:\maven_repository_3.63\org\slf4j\jcl-over-slf4j\1.7.16\jcl-over-slf4j-1.7.16.jar;D:\maven_repository_3.63\log4j\log4j\1.2.17\log4j-1.2.17.jar;D:\maven_repository_3.63\org\slf4j\slf4j-log4j12\1.7.16\slf4j-log4j12-1.7.16.jar;D:\maven_repository_3.63\com\ning\compress-lzf\1.0.3\compress-lzf-1.0.3.jar;D:\maven_repository_3.63\org\xerial\snappy\snappy-java\1.1.7.1\snappy-java-1.1.7.1.jar;D:\maven_repository_3.63\org\lz4\lz4-java\1.4.0\lz4-java-1.4.0.jar;D:\maven_repository_3.63\com\github\luben\zstd-jni\1.3.2-2\zstd-jni-1.3.2-2.jar;D:\maven_repository_3.63\org\roaringbitmap\RoaringBitmap\0.5.11\RoaringBitmap-0.5.11.jar;D:\maven_repository_3.63\commons-net\commons-net\3.1\commons-net-3.1.jar;D:\maven_repository_3.63\org\json4s\json4s-jackson_2.11\3.5.3\json4s-jackson_2.11-3.5.3.jar;D:\maven_repository_3.63\org\json4s\json4s-core_2.11\3.5.3\json4s-core_2.11-3.5.3.jar;D:\maven_repository_3.63\org\json4s\json4s-ast_2.11\3.5.3\json4s-ast_2.11-3.5.3.jar;D:\maven_repository_3.63\org\json4s\json4s-scalap_2.11\3.5.3\json4s-scalap_2.11-3.5.3.jar;D:\maven_repository_3.63\org\scala-lang\modules\scala-xml_2.11\1.0.6\scala-xml_2.11-1.0.6.jar;D:\maven_repository_3.63\org\glassfish\jersey\core\jersey-client\2.22.2\jersey-client-2.22.2.jar;D:\maven_repository_3.63\javax\ws\rs\javax.ws.rs-api\2.0.1\javax.ws.rs-api-2.0.1.jar;D:\maven_repository_3.63\org\glassfish\hk2\hk2-api\2.4.0-b34\hk2-api-2.4.0-b34.jar;D:\maven_repository_3.63\org\glassfish\hk2\hk2-utils\2.4.0-b34\hk2-utils-2.4.0-b34.jar;D:\maven_repository_3.63\org\glassfish\hk2\external\aopalliance-repackaged\2.4.0-b34\aopalliance-repackaged-2.4.0-b34.jar;D:\maven_repository_3.63\org\glassfish\hk2\external\javax.inject\2.4.0-b34\javax.inject-2.4.0-b34.jar;D:\maven_repository_3.63\org\glassfish\hk2\hk2-locator\2.4.0-b34\hk2-locator-2.4.0-b34.jar;D:\maven_repository_3.63\org\javassist\javassist\3.18.1-GA\javassist-3.18.1-GA.jar;D:\maven_repository_3.63\org\glassfish\jersey\core\jersey-common\2.22.2\jersey-common-2.22.2.jar;D:\maven_repository_3.63\javax\annotation\javax.annotation-api\1.2\javax.annotation-api-1.2.jar;D:\maven_repository_3.63\org\glassfish\jersey\bundles\repackaged\jersey-guava\2.22.2\jersey-guava-2.22.2.jar;D:\maven_repository_3.63\org\glassfish\hk2\osgi-resource-locator\1.0.1\osgi-resource-locator-1.0.1.jar;D:\maven_repository_3.63\org\glassfish\jersey\core\jersey-server\2.22.2\jersey-server-2.22.2.jar;D:\maven_repository_3.63\org\glassfish\jersey\media\jersey-media-jaxb\2.22.2\jersey-media-jaxb-2.22.2.jar;D:\maven_repository_3.63\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;D:\maven_repository_3.63\org\glassfish\jersey\containers\jersey-container-servlet\2.22.2\jersey-container-servlet-2.22.2.jar;D:\maven_repository_3.63\org\glassfish\jersey\containers\jersey-container-servlet-core\2.22.2\jersey-container-servlet-core-2.22.2.jar;D:\maven_repository_3.63\io\netty\netty-all\4.1.17.Final\netty-all-4.1.17.Final.jar;D:\maven_repository_3.63\io\netty\netty\3.9.9.Final\netty-3.9.9.Final.jar;D:\maven_repository_3.63\com\clearspring\analytics\stream\2.7.0\stream-2.7.0.jar;D:\maven_repository_3.63\io\dropwizard\metrics\metrics-core\3.1.5\metrics-core-3.1.5.jar;D:\maven_repository_3.63\io\dropwizard\metrics\metrics-jvm\3.1.5\metrics-jvm-3.1.5.jar;D:\maven_repository_3.63\io\dropwizard\metrics\metrics-json\3.1.5\metrics-json-3.1.5.jar;D:\maven_repository_3.63\io\dropwizard\metrics\metrics-graphite\3.1.5\metrics-graphite-3.1.5.jar;D:\maven_repository_3.63\com\fasterxml\jackson\core\jackson-databind\2.6.7.1\jackson-databind-2.6.7.1.jar;D:\maven_repository_3.63\com\fasterxml\jackson\module\jackson-module-scala_2.11\2.6.7.1\jackson-module-scala_2.11-2.6.7.1.jar;D:\maven_repository_3.63\org\scala-lang\scala-reflect\2.11.8\scala-reflect-2.11.8.jar;D:\maven_repository_3.63\com\fasterxml\jackson\module\jackson-module-paranamer\2.7.9\jackson-module-paranamer-2.7.9.jar;D:\maven_repository_3.63\org\apache\ivy\ivy\2.4.0\ivy-2.4.0.jar;D:\maven_repository_3.63\oro\oro\2.0.8\oro-2.0.8.jar;D:\maven_repository_3.63\net\razorvine\pyrolite\4.13\pyrolite-4.13.jar;D:\maven_repository_3.63\net\sf\py4j\py4j\0.10.7\py4j-0.10.7.jar;D:\maven_repository_3.63\org\apache\spark\spark-tags_2.11\2.4.0\spark-tags_2.11-2.4.0.jar;D:\maven_repository_3.63\org\apache\commons\commons-crypto\1.0.0\commons-crypto-1.0.0.jar;D:\maven_repository_3.63\org\spark-project\spark\unused\1.0.0\unused-1.0.0.jar com.ispeasant.SparkTest
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
20/11/03 16:29:25 INFO SparkContext: Running Spark version 2.4.0
20/11/03 16:29:25 INFO SparkContext: Submitted application: Spark Test
20/11/03 16:29:25 INFO SecurityManager: Changing view acls to: ispea
20/11/03 16:29:25 INFO SecurityManager: Changing modify acls to: ispea
20/11/03 16:29:25 INFO SecurityManager: Changing view acls groups to:
20/11/03 16:29:25 INFO SecurityManager: Changing modify acls groups to:
20/11/03 16:29:25 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(ispea); groups with view permissions: Set(); users with modify permissions: Set(ispea); groups with modify permissions: Set()
20/11/03 16:29:27 INFO Utils: Successfully started service 'sparkDriver' on port 62954.
20/11/03 16:29:27 INFO SparkEnv: Registering MapOutputTracker
20/11/03 16:29:27 INFO SparkEnv: Registering BlockManagerMaster
20/11/03 16:29:27 INFO BlockManagerMasterEndpoint: Using org.apache.spark.storage.DefaultTopologyMapper for getting topology information
20/11/03 16:29:27 INFO BlockManagerMasterEndpoint: BlockManagerMasterEndpoint up
20/11/03 16:29:27 INFO DiskBlockManager: Created local directory at C:\Users\ispea\AppData\Local\Temp\blockmgr-504280ad-fdce-4c5f-a5bd-ff7efb4a08cc
20/11/03 16:29:27 INFO MemoryStore: MemoryStore started with capacity 1984.5 MB
20/11/03 16:29:27 INFO SparkEnv: Registering OutputCommitCoordinator
20/11/03 16:29:27 INFO Utils: Successfully started service 'SparkUI' on port 4040.
20/11/03 16:29:27 INFO SparkUI: Bound SparkUI to 0.0.0.0, and started at http://DESKTOP-7KO4HHD:4040
20/11/03 16:29:27 INFO Executor: Starting executor ID driver on host localhost
20/11/03 16:29:27 INFO Utils: Successfully started service 'org.apache.spark.network.netty.NettyBlockTransferService' on port 62971.
20/11/03 16:29:27 INFO NettyBlockTransferService: Server created on DESKTOP-7KO4HHD:62971
20/11/03 16:29:27 INFO BlockManager: Using org.apache.spark.storage.RandomBlockReplicationPolicy for block replication policy
20/11/03 16:29:28 INFO BlockManagerMaster: Registering BlockManager BlockManagerId(driver, DESKTOP-7KO4HHD, 62971, None)
20/11/03 16:29:28 INFO BlockManagerMasterEndpoint: Registering block manager DESKTOP-7KO4HHD:62971 with 1984.5 MB RAM, BlockManagerId(driver, DESKTOP-7KO4HHD, 62971, None)
20/11/03 16:29:28 INFO BlockManagerMaster: Registered BlockManager BlockManagerId(driver, DESKTOP-7KO4HHD, 62971, None)
20/11/03 16:29:28 INFO BlockManager: Initialized BlockManager: BlockManagerId(driver, DESKTOP-7KO4HHD, 62971, None)
org.apache.spark.SparkContext@377c68c6
20/11/03 16:29:28 INFO SparkUI: Stopped Spark web UI at http://DESKTOP-7KO4HHD:4040
20/11/03 16:29:28 INFO MapOutputTrackerMasterEndpoint: MapOutputTrackerMasterEndpoint stopped!
20/11/03 16:29:28 INFO MemoryStore: MemoryStore cleared
20/11/03 16:29:28 INFO BlockManager: BlockManager stopped
20/11/03 16:29:28 INFO BlockManagerMaster: BlockManagerMaster stopped
20/11/03 16:29:28 INFO OutputCommitCoordinator$OutputCommitCoordinatorEndpoint: OutputCommitCoordinator stopped!
20/11/03 16:29:28 INFO SparkContext: Successfully stopped SparkContext
20/11/03 16:29:28 INFO ShutdownHookManager: Shutdown hook called
20/11/03 16:29:28 INFO ShutdownHookManager: Deleting directory C:\Users\ispea\AppData\Local\Temp\spark-937abb61-e9d8-4d12-a93f-e5ad27478f70
Process finished with exit code 0

所以我们的Spark环境也没问题了。

代码获取方式:

关注本人公众号,回复“2020110301”获取下载链接。

相关文章

热门文章

更多