scala - Difference in running a spark application with sbt run or with spark-submit script
问题描述
I am new to Spark and as I am learning this framework, I figured out that, to the best of my knowledge, there are two ways for running a spark application when written in Scala:
- Package the project into a JAR file, and then run it with the spark-submit script.
- Running the project directly with sbt run.
I am wondering what the difference between those two modes of execution could be, especially when running with sbt run can throw a java.lang.InterruptedException when it runs perfectly with spark-submit.
Thanks!
解决方案
SBT是一个构建工具(我喜欢在 Linux 上运行),它并不一定意味着使用 Spark。碰巧它像 IntelliJ 一样用于 Spark 应用程序。
您可以在 SBT 控制台下的单个 JVM中打包和运行应用程序,但不能大规模运行。因此,如果您创建了一个带有指定依赖项的 Spark 应用程序,SBT 将使用包编译代码并创建一个包含所需依赖项等的 jar 文件以在本地运行。
您还可以在 SBT 中使用组装选项,它创建一个uber jar或fat jar,其中包含您上传到集群并通过调用spark-submit运行的 jar 中包含的所有依赖项。因此,同样,如果您创建了一个带有指定依赖项的 Spark 应用程序,SBT 将通过汇编、编译代码并创建一个包含所有必需依赖项等的 uber jar 文件,但您需要发送给 Workers 的外部文件除外。在您的集群上运行(通常)。
推荐阅读
- java - 如何从for循环内的文本字段中获取多个值并将其接收到数组中
- excel - Excel 到 PDF,多个范围相同的工作表(字符串)但 PrintArea 255 字符串限制
- html - 有没有办法将两个网站并排插入到一个网站上?
- mysql - sql server 作业中的 ssis 包出错
- php - 为什么我不能在 symfony4 的任何课程中使用服务。依赖注入
- r - R rbind 数据帧的数据帧
- php - 如何在多个文件中扩展 PHP 类并标记命名空间中的每个扩展?
- html - 带有 css 和 bootstrap 的 html 页面无法一致地呈现卡片
- python - 熊猫:对由列表组成的两列求和
- amazon-web-services - DynamoDB:返回多个项目还是一个项目?