How To View Contents Of Uploaded In Hadoop
Hadoop - HDFS Operations
Starting HDFS
Initially you have to format the configured HDFS file system, open namenode (HDFS server), and execute the following command.
$ hadoop namenode -format
After formatting the HDFS, commencement the distributed file organization. The following command will start the namenode equally well as the data nodes as cluster.
$ starting time-dfs.sh
Listing Files in HDFS
Afterwards loading the information in the server, nosotros can find the listing of files in a directory, condition of a file, using 'ls'. Given beneath is the syntax of ls that you tin can pass to a directory or a filename as an statement.
$ $HADOOP_HOME/bin/hadoop fs -ls <args>
Inserting Data into HDFS
Assume we have data in the file called file.txt in the local system which is ought to be saved in the hdfs file organisation. Follow the steps given below to insert the required file in the Hadoop file system.
Step 1
You take to create an input directory.
$ $HADOOP_HOME/bin/hadoop fs -mkdir /user/input
Step 2
Transfer and store a data file from local systems to the Hadoop file system using the put control.
$ $HADOOP_HOME/bin/hadoop fs -put /home/file.txt /user/input
Stride three
Yous tin can verify the file using ls command.
$ $HADOOP_HOME/bin/hadoop fs -ls /user/input
Retrieving Data from HDFS
Assume nosotros accept a file in HDFS called outfile. Given below is a simple demonstration for retrieving the required file from the Hadoop file system.
Step 1
Initially, view the data from HDFS using cat command.
$ $HADOOP_HOME/bin/hadoop fs -cat /user/output/outfile
Pace two
Go the file from HDFS to the local file system using get control.
$ $HADOOP_HOME/bin/hadoop fs -get /user/output/ /home/hadoop_tp/
Shutting Downwards the HDFS
Yous tin can shut down the HDFS past using the following command.
$ stop-dfs.sh
Useful Video Courses
Video
Video
Video
Video
Video
Video
Source: https://www.tutorialspoint.com/hadoop/hadoop_hdfs_operations.htm
Posted by: cristwhounteet.blogspot.com
0 Response to "How To View Contents Of Uploaded In Hadoop"
Post a Comment