scala - 在单个 JVM 中运行多个 SparkContext,或在 intellij env 中创建多个 JVM
问题描述
我想在 Intellij 中创建一个本地 spark 环境,用于维护多个本地 spark 会话的 Spark 应用程序的开发/测试,每个执行者一个。
所以,我的开发者。环境应允许在单个 JVM 上使用多个 sparkContext 或运行多个 JVM,以模拟执行程序及其本地会话。
你能为此目的推荐任何可能的方法吗?
以下是我的代码和错误。
val conf = new SparkConf().setAppName("Testing")
.setMaster("local-cluster[8, 2, 128]") // or .setMaster("local[*]")
.set("spark.driver.allowMultipleContexts", "true")
val sc: SparkContext = new SparkContext(conf)
[Executor task launch worker for task 2] WARN org.apache.spark.SparkContext:
Multiple running SparkContexts detected in the same JVM!
org.apache.spark.SparkException: Only one SparkContext may be running in this JVM (see SPARK-2243).
To ignore this error, set spark.driver.allowMultipleContexts = true.
The currently running SparkContext was created at:
org.apache.spark.SparkContext.<init>(SparkContext.scala:126)```
解决方案
推荐阅读
- node.js - 如何在 qna maker 中添加下拉按钮
- ffmpeg - 未找到 SRT 协议 - 通过 ffmpeg 的 Raspbery Pi 4
- java - 针对 Spring Boot 休息服务发布带有布尔列表列表的 JSON 对象
- ios - 如何更改 SceneDelegate 中的 @ObservedObject 变量?
- c++ - 如何解决 GTest 和 LibTorch 联动冲突
- php - Laravel:事件监听器 - 传递给 {closure}() 的参数 1 必须是数组类型,对象给定
- javascript - React.js 函数组件的按钮 onClick 处理程序只工作一次
- sql-server - 每月日志表列表中的 MSSQL 高效返回
- python - Djnago Apps 一个用于所有模板的静态文件夹
- html - 脚注设计 CSS:垂直对齐