在集群模式下使用spark submit时,我为file提供了--files参数当我在并行窗口中运行list命令时,我可以看到这些文件
$ hdfs dfs -ls /user/name/.sparkStaging/application_1598445422718_5631/
-rw-r--r-- 3 user hadoop 1234 2020-11-18 06:44 /user/name/.sparkStaging/application_1598445422718_5631/survey.properties
我是这样读的:
val props = Source.fromFile(System.getenv("SPARK_YARN_STAGING_DIR")+"/survey.properties")
在日志中我可以看到:
survey.properties -> resource { scheme: "hdfs" host: "myhost" port: -1 file: "/user/name/.sparkStaging/application_1598445422718_5631/survey.properties" } size: 1234timestamp: 1605680821911 type: FILE visibility: PRIVATE
但仍然得到以下错误:
client token: Token { kind: YARN_CLIENT_TOKEN, service: }
diagnostics: User class threw exception: java.io.FileNotFoundException: hdfs:/myhost/user/name/.sparkStaging/application_1598445422718_5631/survey.properties (No such file or directory)
暂无答案!
目前还没有任何答案,快来回答吧!