HDFS Operations

You can use hadoop fs -help to get more operations.

Quick Example

Starting HDFS

You have to format the hdfs file system first.

hadoop namenode -format

After formating HDFS, start distributed file system.

start-dfs.sh

Listing Files in HDFS

hadoop fs -ls <args>

Inserting Data Into HDFS

Create an input directory.

hadoop fs -mkdir -p /user/input

Store a new file into HDFS.

echo "Hello world, Hadoop!" > /home/hadoopuser/example.txt
hadoop fs -put /home/hadoopuser/example.txt /user/input

List the files.

hadoop fs -ls /user/input

Retrieving Data From HDFS

Cat the file.

hadoop fs -cat /user/input/example.txt

Get the HDFS file and store it into local.

hadoop fs -get /user/input/example.txt /home/hadoopuser/example_from_hdfs.txt

results matching ""

    No results matching ""