本文介绍了HDFS联合会未知命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我已经分别配置了两个名称节点来管理/营销和/财务。我想知道如果将文件放在/ accounting目录中会发生什么情况。 HDFS会接受这个文件吗?如果是这样,哪个命名空间管理文件?

解决方案

写入失败。



您将得到一个 IOException ,并带有没有这样的名称空间文件或目录错误来自 ViewFs 客户端。 例如,给定以下 core-site.xml中的ViewFs配置:

  <结构> 
<属性>
<名称> fs.default.name< /名称>
< value> viewfs:///< / value>
< / property>
<属性>
< name> fs.viewfs.mounttable.default.link./namenode-a< / name>
< value> hdfs:// namenode-a< / value>
< / property>
<属性>
< name> fs.viewfs.mounttable.default.link./namenode-b< / name>
< value> hdfs:// namenode-b< / value>
< / property>
< / configuration>

显示以下行为:

  $ bin / hdfs dfs -ls / 
-r - r - r-- - sirianni gopher 0 2013-10-22 15:58 / namenode-a
-r - r - r - - sirianni gopher 0 2013-10-22 15:58 / namenode-b


$ bin / hdfs dfs -copyFromLocal / tmp / bar .txt /foo/bar.txt
copyFromLocal:`/foo/bar.txt':没有这样的文件或目录


Let's say that I have configured two name nodes to manage /marketing and /finance respectively. I am wondering what is going to be happened if I were to put a file in /accounting directory. Would HDFS accept the file? If so, which namespace manages the file?

解决方案

The write will fail. Neither namespace will manage the file.

You will get an IOException with a No such file or directory error from the ViewFs client.

For example, given the following ViewFs config in core-site.xml:

<configuration>
    <property>
        <name>fs.default.name</name>
        <value>viewfs:///</value>
    </property>
    <property>
        <name>fs.viewfs.mounttable.default.link./namenode-a</name>
        <value>hdfs://namenode-a</value>
    </property>
    <property>
        <name>fs.viewfs.mounttable.default.link./namenode-b</name>
        <value>hdfs://namenode-b</value>
    </property>
</configuration>

The following behavior is exhibited:

$ bin/hdfs dfs -ls /
-r--r--r--   - sirianni gopher          0 2013-10-22 15:58 /namenode-a
-r--r--r--   - sirianni gopher          0 2013-10-22 15:58 /namenode-b


$ bin/hdfs dfs -copyFromLocal /tmp/bar.txt /foo/bar.txt
copyFromLocal: `/foo/bar.txt': No such file or directory

这篇关于HDFS联合会未知命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 04:27