일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- sql
- 코딩야학
- 하둡
- 숫자야구소스
- BigData
- 데이터분석
- 숫자야구
- for문
- R
- 루비페이퍼
- if문
- 숫자야구코드
- DataAnalysis
- list
- 임경덕
- 이토록 쉬운 통계&R
- 리스트
- stat
- 데이터과학
- 빅데이터
- 야학
- python
- hadoop
- DATABASE
- 데이터사이언스
- 함수
- 생활코딩
- 파이썬
- big_data
- code
Archives
- Today
- Total
yekang
HDFS 입출력 예제 본문
SingleFileWrite.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | package edu.pusan.ch03; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; public class SingleFileWrite { public static void main(String[] args) { // TODO Auto-generated method stub if(args.length!=2){ System.err.println("Usage: "); System.exit(2); } try{ //파일 시스템 제어 객체 생성 Configuration conf = new Configuration(); FileSystem hdfs = FileSystem.get(conf); //hdfs //경로 체크 Path path = new Path(args[0]); if(hdfs.exists(path)){ hdfs.delete(path, true); } //파일 저장.72p2번 FSDataOutputStream outStream = hdfs.create(path); outStream.writeUTF(args[1]); outStream.close(); } catch(Exception e){ e.printStackTrace(); } } } | cs |
잘 출력되는 모습이다.
'빅데이터' 카테고리의 다른 글
[데이터 전처리 대전] 리뷰 (0) | 2019.12.15 |
---|---|
WordCount 구현 in JAVA (0) | 2018.01.25 |
하둡1 wordcount -하늘과 바람과 별과 시 (1948) (0) | 2018.01.25 |
하둡1 wordcount - 문재인 대통령 (0) | 2018.01.24 |
빅데이터란? (0) | 2017.07.03 |
Comments