The article directories

  • 1. HDFS Shell
    • 1.1 HDFS Shell CLI client
    • 1.2 HDFS Shell CLI Client — Description
    • 1.3 summarize
    • 1.4 Differences between Hadoop DFS, HDFS DFS, and Hadoop FS
    • 1.5 HDFS Shell CLI Client – Parameter Description
    • 1.6 Finding commands on the Hadoop official website

1. HDFS Shell

1.1 HDFS Shell CLI client

  • Command line interface (CLI) refers to an interpersonal interaction mode in which users input commands through the keyboard and the computer executes the commands after receiving them.
  • Hadoop provides a shell command line client for the file system, which can be used as follows:

  • The commands related to file system reads and writes arehdfs dfs [generic options]



1.2 HDFS Shell CLI Client – Description

  • HDFS Shell THE CLI supports operation of various file systems, including local file systems (file:///), distributed file system (hdfs://nn:8020) etc.
  • What file system you operate on depends on the prefix protocol in the URL.
  • If no prefix is specified, the fs.defaultfs property in the environment variable is read with the value of that property as the default file system
hdfs dfs -ls file:///  Operating on the local file system
Copy the code

hdfs dfs -ls /
Copy the code

  • View the file default system
cat /export/servers/hadoop2 -.7.4/etc/hadoop/core-site.xml
Copy the code

hdfs dfs -ls hdfs://hadoop01:9000/  # Run HDFS
Copy the code

  • sohdfs dfs -ls hdfs://hadoop01:9000/hdfs dfs -ls /Accessing the same file system.

1.3 summarize

1.4 Differences between Hadoop DFS, HDFS DFS, and Hadoop FS

  1. hadoop dfsYou can only operate HDFS files (including Local FS operations), but this operation has been Deprecated.
  2. hdfs dfsPerform operations related to HDFS file systems (including Local FS operations)
  3. hadoop fsIt can operate any file system, not only HDFS file system, but also a wide range of applications.
  • According to the current version, the official final recommendation ishadoop fs. Of course,hdfs dfsThe use in the market is also more.

1.5 HDFS Shell CLI Client – Parameter Description

  • The OPERATION commands of HDFS are similar to those of Linux. Therefore, it is relatively cheap to learn.
  • Can be achieved byhadoop fs -helpCommand to see the detailed usage of each command.

1.6 Finding commands on the Hadoop official website