scala - 无法将卷挂载到 spark.kubernetes.executor
问题描述
我正在尝试使用 kubernetes 在 spark 集群模式下从服务器读取文件,因此我将文件放在所有工作人员上,并使用
val conf = new SparkConf().setAppName("sparksetuptest") .set("spark. kubernetes.driver.volumes.hostPath.host.mount.path", "/file-directory")
在这里一切正常,但是当我执行时,它显示在特定位置找不到该文件。所以我用 .set("spark.kubernetes.executor.volumes.hostPath.host.mount.path", "/file-directory") 将目录挂载到执行器但现在我无法执行它卡在一个永无止境的程序在获取数据的同时进行处理。
请提出一些建议,以便我可以使用执行程序挂载我的目录并读取该文件。
解决方案
这是来自nfs-example 的示例
spark.kubernetes.driver.volumes.nfs.images.options.server=example.com
spark.kubernetes.driver.volumes.nfs.images.options.path=/data
我认为您需要声明要挂载的路径,options.path
并且spark.kubernetes.driver.volumes.[VolumeType].[VolumeName].mount.path
是容器中的挂载路径
例如:
如果我想在 k8s 的节点上挂载到带有 VolumeName/home/lemon/data
的 docker 容器的路径,那么/data
exepv
conf.set("spark.kubernetes.executor.volumes.hostPath.exepv.mount.path","/data")
conf.set("spark.kubernetes.executor.volumes.hostPath.exepv.options.path", "/home/lemon/data")
/data
在此之后,您可以访问执行程序容器中的路径
推荐阅读
- reactjs - 代码 - 笔问题:为什么我的元胞自动机反应项目不起作用?
- python - 使用 matplotli、pandas 和 python 绘制基于事件的错误
- python - 提取数据框中一个日期的位置
- reactjs - react js axios没有显示来自django rest api的图像
- javascript - 通过将键传递给 react 和 lodash 中的对象数组来获取值
- c# - 将类名传递给 GenericMethod
, 当 className 存储为 String - reactjs - 待办事项列表上的编辑功能
- typescript - fp-ts:如何将嵌套的`Either`/`TaskEither`“拉起”到外部类型?
- javascript - 链接 reactQuery 调用
- python - spacy 3 NER Scorer() 抛出 TypeError: score() 接受 2 个位置参数,但给出了 3 个