11
votes

Is there ln -s in hadoop HDFS?

For instance:

I have 10 files in HDFS

/user/hadoop/input, which is 1.txt, 2.txt ... 10.txt

Another dir in HDFS is /user/hadoop/test

I just wanna copy 1 file from /user/hadoop/input/1.txt to /user/hadoop/test/1.txt.

The simplest way is use hadoop dfs -cp /user/hadoop/1.txt /user/hadoop/test.

But it cost more time and disk space. Is there a way like shell such as hadoop dfs -ln /user/hadoop/1.txt /user/hadoop/test/1.txt ?

1
There are symbolic links in a somewhat newer version, what version are you using? - Thomas Jungblut
the version of my hadoop is 1.0.3 - pensz

1 Answers

10
votes

HDFS supports Symbolic links. Check 1, 2, 3, 4 for more details. So, it can be done using Java API, but never came across a CLI for the same.