http://blog.csdn.net/pipisorry/article/details/51340838

'Hadoop DFS'和'Hadoop FS'的区别

While exploring HDFS, I came across these two syntaxes for querying HDFS:
> hadoop dfs

> hadoop fs



why we have two different syntaxes for a common purpose

为什么会对同一个功能提供两种命令标记?

命令的定义

it seems like there's no difference between the two syntaxes. If we look at the definitions of the two commands (hadoop fs and hadoop dfs) in $HADOOP_HOME/bin/hadoop

从两个命令的定义中(在$HADOOP_HOME/bin/hadoop)可以看到这两者之间似乎没有什么区别。
...  

elif [ "$COMMAND" = "datanode" ] ; then  

  CLASS='org.apache.hadoop.hdfs.server.datanode.DataNode'  

  HADOOP_OPTS="$HADOOP_OPTS $HADOOP_DATANODE_OPTS"  

elif [ "$COMMAND" = "fs" ] ; then  

  CLASS=org.apache.hadoop.fs.FsShell  

  HADOOP_OPTS="$HADOOP_OPTS $HADOOP_CLIENT_OPTS"  

elif [ "$COMMAND" = "dfs" ] ; then  

  CLASS=org.apache.hadoop.fs.FsShell  

  HADOOP_OPTS="$HADOOP_OPTS $HADOOP_CLIENT_OPTS"  

elif [ "$COMMAND" = "dfsadmin" ] ; then  

  CLASS=org.apache.hadoop.hdfs.tools.DFSAdmin  

  HADOOP_OPTS="$HADOOP_OPTS $HADOOP_CLIENT_OPTS"  

...  

貌似更有道理的解释

Unconvinced, and these excerpts made more sense to me:

FS relates to a generic file system which can point to any file systems like local, HDFS etc. But dfs is very specific to HDFS. So when we use FS it?can perform operation with from/to local or
hadoop distributed file system to destination. But specifying DFS operation relates to?HDFS.

这个理由并不完全信服,下面这个解释貌似更有道理:

FS涉及到一个通用的文件系统,可以指向任何的文件系统如local,HDFS等。
但是DFS仅是针对HDFS的。
那么什么时候用FS呢?可以在本地与hadoop分布式文件系统的交互操作中使用。特定的DFS指令与HDFS有关。

Hadoop文档对这两个不同的shell的描述

Below are two excerpts from the Hadoop documentation that describe these two as different shells.

下面是两个摘录Hadoop文档,描述这两个不同的shell。

  1. FS Shell
  2. The FileSystem (FS) shell is invoked by bin/hadoop fs. All the FS shell commands take path URIs as arguments. The URI format is scheme://autority/path. For HDFS the scheme is hdfs, and for the local filesystem the scheme is file. The scheme and authority are optional. If not specified, the default scheme specified in the configuration is used. An HDFS file or directory such as /parent/child can be specified as hdfs://namenodehost/parent/child or simply as /parent/child (given that your configuration is set to point to hdfs://namenodehost). Most of the commands in FS shell behave like corresponding Unix commands.?
  1. DFShell
  2. The HDFS shell is invoked by bin/hadoop dfs. All the HDFS shell commands take path URIs as arguments. The URI format is scheme://autority/path. For HDFS the scheme is hdfs, and for the local filesystem the scheme is file. The scheme and authority are optional. If not specified, the default scheme specified in the configuration is used. An HDFS file or directory such as /parent/child can be specified as hdfs://namenode:namenodeport/parent/child or simply as /parent/child (given that your configuration is set to point to namenode:namenodeport). Most of the commands in HDFS shell behave like corresponding Unix commands.?

So, based on the above, we can conclude that it all depends on the scheme configuration. When using these two commands with absolute URI (i.e. scheme://a/b) the?behavior?shall be identical. Only it's the default configured scheme value for file and hdfs
for fs and dfs respectively, which is the cause for difference in?behavior. 
由上述内容可以看出来,这两个命令依赖于模式的配置。当使用绝对URI(如scheme://a/b)这两个命令式相同的。只有默认的模式配置参数对dfs和fs起作用。

[http://java.dzone.com/articles/difference-between-hadoop-dfs]

stackoverflow的解释

Hadoop fs:使用面最广,可以操作任何文件系统。

hadoop dfs与hdfs dfs:只能操作HDFS文件系统相关(包括与Local FS间的操作),前者已经Deprecated,一般使用后者。

Following are the three commands which appears same but have minute differences

  1. hadoop fs {args}
  2. hadoop dfs {args}
  3. hdfs dfs {args}

    hadoop fs <args>
    

FS relates to a generic file system which can point to any file systems like local, HDFS etc. So this can be used when you are dealing with different file systems such as Local FS, HFTP FS, S3 FS, and others

  hadoop dfs <args>

dfs is very specific to HDFS. would work for operation relates to HDFS. This has been deprecated and we should use hdfs dfs instead.

  hdfs   dfs <args>

same as 2nd i.e would work for all the operations related to HDFS and is the recommended command instead of hadoop dfs

below is the list categorized as HDFS commands.

  **#hdfs commands**
  namenode|secondarynamenode|datanode|dfs|dfsadmin|fsck|balancer|fetchdt|oiv|dfsgroups

So even if you use Hadoop dfs , it will look locate hdfs and delegate that command to hdfs dfs

[何时使用hadoop fs、hadoop dfs与hdfs dfs命令]

from: http://blog.csdn.net/pipisorry/article/details/51340838

ref:

Hadoop:hadoop fs、hadoop dfs与hdfs dfs命令的区别的更多相关文章

  1. 何时使用hadoop fs、hadoop dfs与hdfs dfs命令(转)

    hadoop fs:使用面最广,可以操作任何文件系统. hadoop dfs与hdfs dfs:只能操作HDFS文件系统相关(包括与Local FS间的操作),前者已经Deprecated,一般使用后 ...

  2. 何时使用hadoop fs、hadoop dfs与hdfs dfs命令

    hadoop fs:使用面最广,可以操作任何文件系统. hadoop dfs与hdfs dfs:只能操作HDFS文件系统相关(包括与Local FS间的操作),前者已经Deprecated,一般使用后 ...

  3. hadoop fs、hadoop dfs与hdfs dfs的区别

    不多说,直接上干货! hadoop fs:    使用面最广,可以操作任何文件系统. hadoop dfs与hdfs dfs :   只能操作HDFS文件系统相关(包括与Local FS间的操作),前 ...

  4. Hadoop点滴-何时使用hadoop fs、hadoop dfs与hdfs dfs命令

    何时使用hadoop fs.hadoop dfs与hdfs dfs命令 编辑 删除 hadoop fs:使用面最广,可以操作任何文件系统. hadoop dfs与hdfs dfs:只能操作HDFS文件 ...

  5. hadoop fs、hadoop dfs与hdfs dfs命令的区别

    Hadoop fs:使用面最广,可以操作任何文件系统. hadoop dfs与hdfs dfs:只能操作HDFS文件系统相关(包括与Local FS间的操作),前者已经Deprecated,一般使用后 ...

  6. hadoop fs,hadoop dfs,hdfs dfs

    hadoop fs: FS relates to a generic file system which can point to any file systems like local, HDFS ...

  7. Hadoop学习记录(2)|HDFS shell命令|体系结构

    HDFS的shell 调用文件系统(FS)shell命令使用hadoop fs的形式 所有的FS shell命令使用URI路径作为参数. URI格式是scheme://authority/path.H ...

  8. hadoop 学习(三)之hdfs shell命令

    1.HDFS shell 1.0查看帮助  hadoop fs -help <cmd> 1.1上传  hadoop fs -put <linux上文件> <hdfs上的路 ...

  9. Hadoop之hadoop fs和hdfs dfs、hdfs fs三者区别

      适用范围 案例 备注 小记 hadoop fs 使用范围最广,对象:可任何对象       hadoop dfs 只HDFS文件系统相关       hdfs fs 只HDFS文件系统相关(包括与 ...

随机推荐

  1. 【USACO Feb 2014】Cow Decathlon

    题目描述 约翰有 N 头奶牛,组成了一直队伍参加全能比赛.比赛一共有 N 项,每头奶牛必须参加一项比 赛,每项比赛也必须有一头奶牛参加.任何一头奶牛可以胜任任何一项比赛,但得分不一样.如果第 i 头奶 ...

  2. NOIP2014-5-10模拟赛

    Problem 1 机器人(robot.cpp/c/pas) [题目描述] 早苗入手了最新的Gundam模型.最新款自然有着与以往不同的功能,那就是它能够自动行走,厉害吧. 早苗的新模型可以按照输入的 ...

  3. poj 3904(莫比乌斯反演)

    POJ 3904 题意: 从n个数中选择4个数使他们的GCD = 1,求总共有多少种方法 Sample Input 4 2 3 4 5 4 2 4 6 8 7 2 3 4 5 7 6 8 Sample ...

  4. hdu 5637 BestCoder Round #74 (div.2)

    Transform  Accepts: 7  Submissions: 49  Time Limit: 4000/2000 MS (Java/Others)  Memory Limit: 131072 ...

  5. BZOJ1095(动态点分治+堆)

    终于把这个坑填了.. 按重心分治建树,每个点存两个堆,第一个存的是这个点子树中的点到父重心的距离,第二个存的是子节点第一个堆的堆顶,同时有一个全局答案堆,存的是每个点第二个堆的最大值+次大值. 20亿 ...

  6. 如何导入python中的模块

    作为一名新手Python程序员,你首先需要学习的内容之一就是如何导入模块或包.但是我注意到,那些许多年来不时使用Python的人并不是都知道Python的导入机制其实非常灵活.在本文中,我们将探讨以下 ...

  7. Python中生成器和迭代器的功能介绍

    生成器和迭代器的功能介绍 1. 生成器(generator) 1. 赋值生成器 1. 创建 方法:x = (variable for variable in iterable) 例如:x = (i f ...

  8. openwrt 下添加sim760ce usb驱动

    SIM7500_SIM7600 系列模块的 USB VID 是 0x1E0E PID 是 0x9001. 作为 Slave USB 设备,配置如下表 USB 接口波特率自适应 9600.115200 ...

  9. 关于一些基础的Java问题的解答(五)

    21. 实现多线程的两种方法:Thread与Runable 在Java中实现多线程编程有以下几个方法: 1.继承Thread类,重写run方法 public class Test { public s ...

  10. 跟着小菜学习RabbitMQ启动和基础(系列一)

    前言 今天开始我们正式进入RabbitMQ系列学习,在这系列博客中也会发表.NET Core和EF Core文章,网上关于RabbitMQ例子比比皆是,我将综合网上所提供的信息并加上我个人的理解来详细 ...