标签:查看 cal scl ips ack 上传文件 rom pack cli
1、eclipse中编写代码后双击main方法--->Run as ---> java application ,然后指定的文件 就会提交到hdfs中。
2、查看文件:http://192.168.108.128:50070/dfshealth.html#tab-overview
package hdfs24;
import java.net.URI;
import java.net.URISyntaxException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
public class hdfsClientDemo {
public static void main(String[] args) throws Exception
{
Configuration conf = new Configuration();
//复本数
conf.set("dfs.replication", "1");
conf.set("dfs.blocksize", "1024m");
FileSystem fs = FileSystem.get(new URI("hdfs://192.168.108.128:9000"), conf, "root");
fs.copyFromLocalFile(new Path("D:/postman-4.1.2.rar"), new Path("/aaa/"));
fs.close();
}
}
hadoop实践02---eclipse操作hdfs的api上传文件
标签:查看 cal scl ips ack 上传文件 rom pack cli
原文地址:https://www.cnblogs.com/zhengwei-cq/p/12389340.html