我有一个问题:如何获取位于 dataproc hdfs 中的文件的路径/url?我想基于位于 dataproc hdfs 中的文件运行 M/R 作业。
最佳答案
以下是 Dataproc 集群中的所有有效 HDFS URI:
-
hdfs://<master-hostname>:8020/<path-to-file>
-
hdfs://<master-hostname>/<path-to-file>
-
hdfs:///<path-to-file>
第三个有效,因为默认情况下,在 Dataproc 集群的每个节点中,fs.defaultFS
属性配置为 hdfs://<master-hostname>
在/etc/hadoop/conf/core-site.xml
。和8020
是默认的NameNode端口。
<property>
<name>fs.defaultFS</name>
<value>hdfs://<master-hostname></value>
<description>
The name of the default file system. A URI whose scheme and authority
determine the FileSystem implementation. The uri's scheme determines
the config property (fs.SCHEME.impl) naming the FileSystem
implementation class. The uri's authority is used to determine the
host, port, etc. for a filesystem.
</description>
</property>
您可以运行hadoop fs -ls <uri>
在任何节点上列出文件。
关于hadoop - Dataproc HDFS 文件 URI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69349242/