package com.imooc.bigdata.hadoop.hdfs;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.*;
import org.apache.hadoop.io.IOUtils;
import org.apache.hadoop.util.Progressable;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URI;
/**
* 使用Java API操作HDFS文件系统
*
* 关键点:
* 1)创建Configuration
* 2)获取FileSystem
* 3)...就是你的HDFS API的操作
*/
public class HDFSApp {
public static final String HDFS_PATH = "hdfs://192.168.0.233:8020";
FileSystem fileSystem = null;
Configuration configuration = null;
@Before
public void setUp() throws Exception {
System.out.println("--------setUp---------");
configuration = new Configuration();
configuration.set("dfs.replication","1");
/**
hdfs之copyFromLocalFile
最新推荐文章于 2022-08-17 07:15:00 发布