JAVA读取HDFS信息

uri填路径

public static void main(String[] args) throws IOException {
String uri = "/user/WeiboAD/DF/part-r-00000";
BufferedReader br =null;
Configuration conf = new Configuration();
FileSystem fs = FileSystem. get(URI.create (uri), conf);
InputStream in = null;
try {
in = fs.open( new Path(uri));
br = new BufferedReader(new InputStreamReader(in, "UTF-8"));
System.out.println(br.readLine());
} finally {
IOUtils.closeStream(in); }
}
上一篇:docker 容器模式下部署mysql 主从复制


下一篇:Head First Servlets & JSP 学习笔记 第十一章 —— Web应用部署