`
dalan_123
  • 浏览: 83668 次
  • 性别: Icon_minigender_1
  • 来自: 郑州
社区版块
存档分类
最新评论

spring hadoop

阅读更多
一、源码
// 如下代码实现 读取指定hdfs路径下tmp文件夹下面所有的文件(包括子文件)
@SpringBootApplication
public class DemoApplication implements CommandLineRunner {
        // 构建FsShell对象
@Autowired
private FsShell shell; 
        // 实现run方法
@Override
public void run(String... args) {
for (FileStatus s : shell.lsr("/tmp")) {
System.out.println("> " + s.getPath());
}
}

public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
二、配置文件
// 指定对应的hdfs的url(hadoop filesystem uri)
spring:
  main:
    show_banner: false // 输出头部信息(作用不大 可以修改成true 看看)
  hadoop:
    fsUri: hdfs://10.33.96.241:8020
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics