requires


hadoop 2.5.0  running

hostname mapping

eclipse config

 


Hadoop2.5.0 Client USE

Hadoop2.5.0 Client USE

Hadoop2.5.0 Client USE

Hadoop2.5.0 Client USE

Hadoop2.5.0 Client USE

Hadoop2.5.0 Client USE


package com.dasenlin.hadoop;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IOUtils;

/**
 * hadoop client use
 *
 */
public class App 
{
    public static void main( String[] args ){
        Configuration hadoopconf = new Configuration();
        org.apache.hadoop.fs.FSDataInputStream  inStream =null;
        try {
            FileSystem fileSystem = FileSystem.get(hadoopconf);
            Path path = new Path("/user/jasper/conf/tmp/core-site.xml");
            inStream = fileSystem.open(path);
            IOUtils.copyBytes(inStream, System.out, 4096,false);
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if(null!=inStream)IOUtils.closeStream(inStream);
        }
        
    }
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-05
  • 2022-12-23
  • 2022-01-23
猜你喜欢
  • 2022-12-23
  • 2021-06-25
  • 2021-07-10
  • 2022-12-23
  • 2021-08-02
  • 2021-06-11
相关资源
相似解决方案