-
package org.apache.hadoop.test;
-
import java.io.IOException;
-
import org.apache.hadoop.conf.Configurable;
-
import org.apache.hadoop.conf.Configuration;
-
import org.apache.hadoop.fs.FileSystem;
-
import org.apache.hadoop.fs.Path;
-
-
public class HDFSmkdir {
-
-
public static void main(String[] args) throws IOException {
-
// TODO Auto-generated method stub
-
Configuration conf = new Configuration();
-
FileSystem fs = FileSystem.get(conf);
-
fs.mkdirs(new Path("user/hadoop/lb/test"));
-
}
-
-
}
基于hadoop1.1.2的hdfs API接口
通过eclipse的export 选中jar file,导出jar包,利用hadoop jar test.jar org.apache.hadoop.test.HDFS.mkdir就可以执行,
然后hadoop fs -ls / 可以查看到
阅读(2700) | 评论(0) | 转发(0) |