Chinaunix首页 | 论坛 | 博客
  • 博客访问: 220690
  • 博文数量: 39
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 218
  • 用 户 组: 普通用户
  • 注册时间: 2013-11-06 12:33
文章分类
文章存档

2017年(2)

2015年(11)

2014年(18)

2013年(8)

我的朋友

分类: 系统运维

2015-02-10 10:57:37


点击(此处)折叠或打开

  1. package org.apache.hadoop.test;
  2. import java.io.IOException;
  3. import org.apache.hadoop.conf.Configurable;
  4. import org.apache.hadoop.conf.Configuration;
  5. import org.apache.hadoop.fs.FileSystem;
  6. import org.apache.hadoop.fs.Path;

  7. public class HDFSmkdir {
  8.  
  9.     public static void main(String[] args) throws IOException {
  10.         // TODO Auto-generated method stub
  11.         Configuration conf = new Configuration();
  12.         FileSystem fs = FileSystem.get(conf);
  13.         fs.mkdirs(new Path("user/hadoop/lb/test"));
  14.     }
  15.  
  16. }
   基于hadoop1.1.2的hdfs API接口
通过eclipse的export 选中jar file,导出jar包,利用hadoop jar test.jar org.apache.hadoop.test.HDFS.mkdir就可以执行,
然后hadoop fs -ls /  可以查看到

阅读(2601) | 评论(0) | 转发(0) |
0

上一篇:hadoop命令大全

下一篇:常见的面试题(1)

给主人留下些什么吧!~~