Dataproc HDFS 文件 URI

Dataproc HDFS file URIs

我有一个问题如何 path/url 到位于 dataproc hdfs 中的文件?我想 运行 一个基于位于 dataproc hdfs 中的文件的 M/R 作业。

以下是 Dataproc 集群中所有有效的 HDFS URI:

  1. hdfs://<master-hostname>:8020/<path-to-file>
  2. hdfs://<master-hostname>/<path-to-file>
  3. hdfs:///<path-to-file>

第三个有效,因为默认情况下,在 Dataproc 集群的每个节点中,fs.defaultFS 属性 在 /etc/hadoop/conf/core-site.xml 中配置为 hdfs://<master-hostname>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> 在任何节点上列出文件。