Insert Text data into HDFS file structure

In this post I am going to insert below text file data into HDFS folder.File name is Sample.txt
id,Name,City,email
1,Pubudu,Colombo,pubududewagam@gamil.com
2,Suranga,Colombo,pubududewagam@gamil.com
3,Dewagama,Colombo,pubududewagam@gamil.com

Then create a folder in the HDFS file structure.
Coomand:-
hdfs dfs mkdir /mydatafolder


To verified the file creation we can use below command.
hdfs dfs –ls /

To copy the text data you can use copyFromLocal command as below.
hdfs dfs -copyFromLocal C:\Users\pubudu\Desktop\test.txt /mydatafolder

To verify the uploaded file, you can use below command.
hdfs dfs –ls /mydatafolder


To view the content of the file we can use below command.
hdfs dfs –cat /mydatafolder/test.txt

Thank you !!!

reference:- https://hadoop.apache.org/docs/r3.1.0/hadoop-project-dist/hadoop-hdfs/HDFSCommands.html
Insert Text data into HDFS file structure Insert Text data into HDFS file structure Reviewed by Pubudu Dewagama on 2:30:00 AM Rating: 5

No comments: