简体   繁体   English

无法在Spark Kubernetes集群模式下读取本地文件

[英]Unable to read local files in spark kubernetes cluster mode

在火花集群模式程序中读取存储在系统中的文件时遇到问题。这给我一个错误,提示“找不到文件”,但是文件存在于定义的位置。请提出一些建议,以便我可以读取本地使用kubernetes在Spark集群中添加文件。

You cannot refer local files on your machine when you submit Spark on Kubernetes. 在Kubernetes上提交Spark时,无法在计算机上引用本地文件。

The available solutions for your case might be: 针对您的案例的可用解决方案可能是:

  • Use Resource staging server . 使用资源登台服务器 Is not available in the main branch of Apache Spark codebase, so the whole integration is on your side. 在Apache Spark代码库的主分支中不可用,因此整个集成都在您身边。
  • Put your file to the http/hdfs accessible location: refer docs 将文件放在http / hdfs可访问位置:请参阅文档
  • Put your file inside Spark Docker image and refer it as local:///path/to/your-file.jar 将文件放入Spark Docker映像中,并将其称为local:///path/to/your-file.jar

If you are running local Kubernetes cluster like Minikube you can also create a Kubernetes Volume with files you are interested in and mount it to the Spark Pods: refer docs . 如果您正在运行Minikube之类的本地Kubernetes集群,则还可以使用您感兴趣的文件创建一个Kubernetes Volume,并将其安装到Spark Pods:参考docs Be sure to mount that volume to both Driver and Executors. 确保将该卷安装到驱动程序和执行器上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM