spring hadoop fsshell


一个简单的例子:连接hadoop,列出文件

class HdpShell implements CommandLineRunner{

    private Logger logger = LoggerFactory.getLogger(HdpShell.class);

    @Autowired
    private FsShell shell;

    @Override
    public void run(String... strings) throws Exception {

        for (FileStatus f : shell.lsr("/user/wsh")) {

            logger.info(f + "");
        }
    }
}
   
   

   
   
    
    
    
     
     4.0.0
    
    

    
    
    
     
     com.xmgps.linyun
    
    
    
    
    
     
     springboot-hadoop
    
    
    
    
    
     
     1.0.0.0
    
    

    
    
    
        
     
     
      
      UTF-8
     
     
        
     
     
      
      1.7
     
     
    
    
    

    
    
    
        
     
     
      
      org.springframework.boot
     
     
        
     
     
      
      spring-boot-starter-parent
     
     
        
     
     
      
      1.4.0.RELEASE
     
     
    
    
    
    
    
    
        
     
     
            
      
      
       
       org.springframework.boot
      
      
            
      
      
       
       spring-boot-starter-web
      
      
        
     
     
        
     
     
            
      
      
       
       org.springframework.boot
      
      
            
      
      
       
       spring-boot-starter-test
      
      
            
      
      
       
       test
      
      
        
     
     
        
     
     
            
      
      
       
       org.springframework.boot
      
      
            
      
      
       
       spring-boot-configuration-processor
      
      
            
      
      
       
       true
      
      
        
     
     

        
     
     
            
      
      
       
       org.springframework.data
      
      
            
      
      
       
       spring-data-hadoop-boot
      
      
            
      
      
       
       2.4.0.RELEASE
      
      
        
     
     
            
     
     
                
      
      
       
       org.springframework.data
      
      
                
      
      
       
       spring-data-hadoop
      
      
                
      
      
       
       2.4.0.RELEASE
      
      
            
     
     

        
     
     
            
      
      
       
       org.apache.hadoop
      
      
            
      
      
       
       hadoop-mapreduce-examples
      
      
            
      
      
       
       2.7.2
      
      
        
     
     
        
     
     
            
      
      
       
       org.apache.hadoop
      
      
            
      
      
       
       hadoop-common
      
      
            
      
      
       
       2.7.2
      
      
            
      
      
       
       compile
      
      
            
      
      
                
       
        
        
          slf4j-log4j12 
         
        
          org.slf4j 
         
       
            
      
      
        
     
     

        
     
     
            
     
     
            
     
     
            
     
     
            
     
     
        
     
     
    
    
    

    
    
    
        
     
     
            
      
      
            
      
      
            
      
      
            
      
      
            
      
      
            
      
      
                
       
       
         maven-source-plugin 
       
                
       
       
         2.1 
       
                
       
        
        
          true 
         
       
                
       
        
         
         
           compile 
          
          
          
            jar 
           
          
         
       
            
      
      
            
      
      
            
      
      
                
       
       
         org.apache.maven.plugins 
       
                
       
       
         maven-dependency-plugin 
       
                
       
        
         
         
           copy-dependencies 
          
         
           package 
          
          
          
            copy-dependencies 
           
          
          
          
            ${project.build.directory}/lib 
           
          
            false 
           
          
            true 
           
          
         
       
            
      
      
            
      
      
            
      
      
                
       
       
         maven-resources-plugin 
       
                
       
       
         2.5 
       
                
       
        
         
         
           copy-resources 
          
         
           validate 
          
          
          
            copy-resources 
           
          
          
          
            target/config 
           
           
            
            
              src/main/config 
             
            
              src/main/resources 
             
            
              true 
             
            
           
          
         
       
            
      
      
        
     
     
    
    
    


   
   


配置文件application.yml:

spring.main.web-environment: false
spring:
  hadoop:
    fs-uri: hdfs://mycluster:8020

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值