I know that HDFS is write once and read many times.
Suppose if i want to update a file in HDFS is there any way to do it ?
Thankyou in advance !
Option1:
If you just want to append to an existing file
echo "
OR
hdfs dfs -appendToFile - /user/hduser/myfile.txt
and then type the text on the terminal. Once you are done typing then hit 'Ctrl+D'
Option2:
Get the original file from HDFS to the local filesystem, modify it and then put it back on HDFS.
hdfs dfs -get /user/hduser/myfile.txt
vi myfile.txt
#or use any other tool and modify it
hdfs dfs -put -f myfile.txt /user/hduser/myfile.txt