HDFS and HAdoop command
HDFS and HAdoop command
Example:
sql
hdfs dfs -put local-file.txt /user/hadoop/data/
Example:
bash
hdfs dfs -ls /user/hadoop/data/
Example:
bash
hdfs dfs -mkdir /user/hadoop/output/
Example:
sql
hdfs dfs -copyToLocal /user/hadoop/data/local-file.txt local-copy/
Example:
bash
hdfs dfs -mv /user/hadoop/data/local-file.txt /user/hadoop/archive/
Example:
bash
hdfs dfs -rm /user/hadoop/data/unwanted-file.txt
Example:
bash
hdfs dfs -cat /user/hadoop/data/sample.txt
Example:
bash
hdfs dfs -du -s -h /user/hadoop/data/
Example:
bash
hdfs dfs -setrep -w 3 /user/hadoop/data/high-replication-file.txt
1.
These basic commands should help you get started with managing files and directories in
HDFS. Hadoop HDFS commands often follow a similar structure to traditional Unix commands,
so if you're familiar with Unix/Linux commands, you'll find it relatively easy to work with HDFS.
hadoop version
Example:
Example:
Example:
Example:
Example:
Example:
Example: