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 18 in Big Data Hadoop by Karan
78 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 18 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 in Big Data Hadoop by ravikiran
• 4,560 points
115 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,290 points
130 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,290 points
78 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 in Big Data Hadoop by Gitika
• 25,340 points
39 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 15, 2018 in Big Data Hadoop by nitinrawat895
• 10,670 points
83 views
0 votes
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
• 10,670 points
2,714 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
• 10,670 points
287 views
0 votes
10 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
13,477 views
0 votes
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,240 points
988 views
0 votes
1 answer

Edge nodes in Hadoop

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

answered Feb 18 in Big Data Hadoop by Siri
317 views