How can I change data in HDFS

0 votes
How can I change the data of a file that has been stored in hdfs?
Feb 19, 2019 in Big Data Hadoop by Karan
4,866 views

1 answer to this question.

0 votes

You can not modified data once stored in hdfs because hdfs follows Write Once Read Many model. You can only append the data once stored in hdfs.

answered Feb 19, 2019 by Rishi
We can only append the file which present on hdfs file system for this we follow this method

--to append a file in hdfs first we add the following property in hdfs-site.xml

<property>
  <name>dfs.support.append</name>
  <value>true</value>
  <description> HDFS allow append operation</description></property>

---use the following command for the append operation

hdfs dfs -appendToFile <local_file> /<hdfs_file_name>

EXAMPLE--
----------

hdfs dfs -appendToFile raj /lok
Hey. Thanks for the answer. I have another doubt. Suppose I have stored a text file in hdfs. Now I want to append that file and add some more lines. How can I do this?
I have already mention in above comment full procedure follow that
I am a little confused. You mentioned that only append is allowed. So when we use the command you mentioned, are the contents of the <local_file> appended to <hdfs_file>?
At first you add the property in hdfs-site. xml
And after that you use the command

Related Questions In Big Data Hadoop

0 votes
1 answer

How can I append data to an existing file in HDFS?

You have to do some configurations as ...READ MORE

answered Jul 25, 2019 in Big Data Hadoop by ravikiran
• 4,620 points
8,709 views
0 votes
1 answer

How can I use my host machine’s web browser to check my HDFS services running in the VM?

The sole purpose of the virtual machine ...READ MORE

answered Apr 18, 2018 in Big Data Hadoop by Shubham
• 13,490 points
1,431 views
0 votes
1 answer

How can I write text in HDFS using CMD?

Hadoop put & appendToFile only reads standard ...READ MORE

answered Apr 27, 2018 in Big Data Hadoop by Shubham
• 13,490 points
2,277 views
0 votes
1 answer

How can you change a column data type in Hive?

Hi, By using this command below one can ...READ MORE

answered Jun 24, 2019 in Big Data Hadoop by Gitika
• 65,770 points
31,334 views
0 votes
1 answer

How can I download only hdfs and not hadoop?

No, you cannot download HDFS alone because ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
1,541 views
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 11,380 points
11,028 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 11,380 points
2,536 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
108,832 views
–1 vote
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,350 points
4,612 views
0 votes
1 answer

Edge nodes in Hadoop

Namenodes and Datanodes are a part of ...READ MORE

answered Feb 19, 2019 in Big Data Hadoop by Siri
3,853 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP