apache-spark - 成功创建火花上下文后,Livy 会话卡在启动
问题描述
我一直在尝试使用在 Ubuntu 18.04 上运行的 Livy 0.7 服务器创建一个新的 spark 会话。在同一台机器上,我有一个正在运行的火花集群,有 2 个工人,我能够创建一个正常的火花会话。
我的问题是,在对 Livy 服务器运行以下请求后,会话停留在启动状态:
import json, pprint, requests, textwrap
host = 'http://localhost:8998'
data = {'kind': 'spark'}
headers = {'Content-Type': 'application/json'}
r = requests.post(host + '/sessions', data=json.dumps(data), headers=headers)
r.json()
我可以看到会话正在启动并从会话日志中创建了 spark 会话:
20/06/03 13:52:31 INFO SparkEntries: Spark context finished initialization in 5197ms
20/06/03 13:52:31 INFO SparkEntries: Created Spark session.
20/06/03 13:52:46 INFO CoarseGrainedSchedulerBackend$DriverEndpoint: Registered executor NettyRpcEndpointRef(spark-client://Executor) (xxx.xx.xx.xxx:1828) with ID 0
20/06/03 13:52:47 INFO BlockManagerMasterEndpoint: Registering block manager xxx.xx.xx.xxx:1830 with 434.4 MB RAM, BlockManagerId(0, xxx.xx.xx.xxx, 1830, None)
也来自火花主用户界面:
并在livy.rsc.server.idle-timeout
达到会话日志后输出:
20/06/03 14:28:04 WARN RSCDriver: Shutting down RSC due to idle timeout (10m).
20/06/03 14:28:04 INFO SparkUI: Stopped Spark web UI at http://172.17.52.209:4040
20/06/03 14:28:04 INFO StandaloneSchedulerBackend: Shutting down all executors
20/06/03 14:28:04 INFO CoarseGrainedSchedulerBackend$DriverEndpoint: Asking each executor to shut down
20/06/03 14:28:04 INFO MapOutputTrackerMasterEndpoint: MapOutputTrackerMasterEndpoint stopped!
20/06/03 14:28:04 INFO MemoryStore: MemoryStore cleared
20/06/03 14:28:04 INFO BlockManager: BlockManager stopped
20/06/03 14:28:04 INFO BlockManagerMaster: BlockManagerMaster stopped
20/06/03 14:28:04 INFO OutputCommitCoordinator$OutputCommitCoordinatorEndpoint: OutputCommitCoordinator stopped!
20/06/03 14:28:04 INFO SparkContext: Successfully stopped SparkContext
20/06/03 14:28:04 INFO SparkContext: SparkContext already stopped.
我已经尝试过增加驱动程序超时但没有运气,并且没有发现任何类似的已知问题,我猜这与火花驱动程序与 rsc 的连接有关,但我不知道在哪里配置它
有人知道原因/解决方案吗?
解决方案
我们在其中一个环境中遇到了类似的问题。工作环境和非工作环境之间的唯一区别是 livy.conf 文件中的 spark master 设置。
我从 livy.conf 中删除了配置 livy.spark.master=yarn 并从代码本身设置了这个值。
// pass master as yarn
public static JavaSparkContext getSparkContext(final String master, final String appName) {
LOGGER.info("Creating spark context");
SparkConf conf = new SparkConf().setAppName(appName);
if (Strings.isNullOrEmpty(master)) {
LOGGER.warn("No spark master found setting local!!");
conf.setMaster("local");
} else {
conf.setMaster(master);
}
conf.set("spark.submit.deployMode", "client");
return new JavaSparkContext(conf);
}
这对我有用。
如果有人能指出这对我来说是如何工作的,那将会有所帮助。
推荐阅读
- wpf - 使用无代码隐藏单击子按钮后关闭弹出窗口
- java - Python setup.py 中的自定义安装脚本有什么问题?
- c - 在嵌入式平台上使用的实际位上完成输入操作数的数据类型
- bash - BEL 中的 Bash / Zsh 提示
- sql - 如何找到两个表之间关于 SQL 中每个表的不匹配?
- arrays - 从spark scala的数据框列中的数组添加文件名
- intellij-idea - 如何在 IntelliJ 中隐藏 NullPointer 警告(由于 NoArgsConstructor with force=true)?
- javascript - 带有 HLS 视频的 Chromecast Widevine DRM
- google-api - 如何取消 OAuth 同意验证流程?
- c# - 为什么微软建议我们使用静态数据类型的属性,而不是静态字段?