Opening a file stored in HDFS to edit in VI Opening a file stored in HDFS to edit in VI hadoop hadoop

Opening a file stored in HDFS to edit in VI


There are couple of options that you could try, which allows you to mount HDFS to your local machine and then you could use your local system commands like cp, rm, cat, mv, mkdir, rmdir, more, etc. But neither of them supports random write operations but supports append operations.

NFS Gateway uses NFS V3 and support appending to file but could not perform random write operations.

And regarding your comment on hue, maybe Hue is downloading the file to a local buffer and after editing it might be replacing the original file in HDFS.


A simple way is to copy from and to hdfs, and edit locally (See here)

hvim <filename>

Source code of hvim

hadoop fs -text $1>hvim.txtvim hvim.txthadoop fs -rm -skipTrash $1hadoop fs -copyFromLocal hvim.txt $1rm hvim.txt


File in HDFS can be replaced using the -f option in hadoop fs -put -f This will eliminate the need to delete and then copy.