Overview of Hadoop Filesystem Commands
The Hadoop Distributed File System (HDFS) is the primary storage system used by Hadoop applications. HDFS commands are essential for interacting with the file system, performing various operations such as file creation, deletion, and management. In this section, we will explore the commonly used HDFS commands and their functionalities.
HDFS Command-Line Interface (CLI)
The HDFS CLI provides a set of shell commands that allow you to interact with the HDFS file system. These commands are similar to the standard Unix file system commands, making them familiar and easy to use.
Some of the commonly used HDFS CLI commands include:
hdfs dfs -ls
: Lists the contents of a directory in HDFS.
hdfs dfs -put
: Uploads a file or directory from the local file system to HDFS.
hdfs dfs -get
: Downloads a file or directory from HDFS to the local file system.
hdfs dfs -rm
: Removes a file or directory from HDFS.
hdfs dfs -mkdir
: Creates a new directory in HDFS.
hdfs dfs -cat
: Displays the contents of a file in HDFS.
## Example: List the contents of the HDFS root directory
hdfs dfs -ls /
HDFS Web UI
In addition to the CLI, Hadoop also provides a web-based user interface (UI) for managing the HDFS file system. The HDFS Web UI can be accessed through a web browser and offers a graphical interface for performing various file system operations.
The HDFS Web UI can be accessed at http://<NameNode>:9870
, where <NameNode>
is the hostname or IP address of the Hadoop NameNode.
graph TD
A[HDFS CLI] --> B[HDFS Web UI]
B --> C[File System Operations]
C --> D[File Creation]
C --> E[File Deletion]
C --> F[File Management]
By understanding the HDFS CLI and Web UI, you can effectively manage and interact with the Hadoop file system, which is a crucial component for Hadoop-based data processing and storage.