私はHDFSについて新入生です。私の質問は、hadoop 2.5バージョンに保存されたファイルのシンボリックリンクを作成する方法です.HDFSにアクセスしてシンボリックリンクシンボリックリンク)と次のように例外:スレッド "メイン" java.lang.UnsupportedOperationExceptionがでhadoop 2.5で保存されたファイルのシンボリックリンクを作成する方法
例外: はorg.apache.hadoop.hdfs.DistributedFileSystem.createSymlinkで をサポートしていないシンボリックリンク(DistributedFileSystem.java:1328)
私のJavaコードは次のとおりです。
最初に、hdfs-site.xmlに内容を追加します。
<property>
<name>test.SymlinkEnabledForTesting</name>
<value>true</value>
</property>
第2に、Java APIを呼び出します。
Configuration conf = new Configuration();
conf.set("mapred.create.symlink", "yes");
conf.set("fs.defaultFS", HdfsServer);
URI uri = URI.create(HdfsServer);
String target = "/tmp/target.csv";
Path targetPath = new Path(target);
String uriWithLink = "/tmp/link.csv";
Path linkPath= new Path(uriWithLink);
FileContext fc = FileContext.getFileContext(uri,conf);
fc.createSymlink(targetPath, linkPath, true);
誰かに私に何か提案がありますか?
ありがとうございました。しかし、まだ問題があります。第一に、私は真 test.SymlinkEnabledForTesting は、/ etc/Hadoopの/ confの中でHDFS-site.xmlのを修正このXMLファイルにいくつかのコンテンツを追加しました –
squall