diens
diens

Reputation: 659

How to recovery part of the content of a corrupted file in HDFS

I have a corrupted file in the HDFS and I would like to recover it as much as I can. Is there a way to do this as a normal user? I mean trying to omite the content of the missing blocks? Sorry in advance if this is a dumm question, I am not really know how is the process to recovery part of a file in HDFS. Regards!

Upvotes: 1

Views: 62

Answers (1)

mjbsgll
mjbsgll

Reputation: 732

As far as I know, as a "normal user" you cannot recover any blocks of a corrupted file. To do so, you have to have admin privileges.

A non elegant solution, could be to check if you can see part of the content of your corrupted file:

hdfs dfs -cat <path-to-file>

and redirect the output to another file to your local filesystem:

hdfs dfs -cat <path-to-file> >> my-new-file.txt

and then you can upload it to the hdfs:

hdfs dfs -copyFromLocal my-new-file.txt <path-to-file>.

Upvotes: 1

Related Questions