Java 写入 HDFS 方法笔记

		/**
		 * TODO
		 * 	适配 HADOOP
		 */
		Configuration configuration = new Configuration();
		// 配置文件应该放大resource文件下面
		configuration.addResource("core-site.xml");
		configuration.addResource("hdfs-site.xml");
		FileSystem fileSystem = FileSystem.get(configuration);
		FSDataOutputStream out = fileSystem.create(new Path("/tmp/gee.txt"));
		out.write("gee".getBytes("UTF-8"));
		out.close();


你可能感兴趣的:(Java,Basic,knowledge,hdfs,java,hadoop)