Hdfs java API 使用注意
org.apache.hadoop.hadoop-hdfs
org.apache.hadoop.hadoop-common
2.相關配置
方法1:拷貝core-site.xml和hdfs-site.xml到當前工程下resources目錄
方法2:配置 fs.defaultFS(舊版本為:fs.default.name)
如:Configuration conf = new Configuration();
conf.set("fs.default.name", "hdfs://master:9000");
3.在window系統除錯時,許可權問題需要設定:
System.setProperty("HADOOP_USER_NAME", "hdfs");