메뉴 건너뛰기

Cloudera, BigData, Semantic IoT, Hadoop, NoSQL

Cloudera CDH/CDP 및 Hadoop EcoSystem, Semantic IoT등의 개발/운영 기술을 정리합니다. gooper@gooper.com로 문의 주세요.


-----------------------------------------------------------------------
데이타파일#1
test01.txt
park


-----------------------------------------------------------------------
데이타파일#2
test02.txt
sang


-----------------------------------------------------------------------
user 테이블 생성
CREATE EXTERNAL TABLE user (
  name String
)
COMMENT 'User Infomation'
PARTITIONED BY (date String)

row format delimited fields terminated by 't'
LOCATION '/user/hadoop/datastore/user/';

-----------------------------------------------------------------------
20140403파티션에 데이타(test01.txt)를 date를 넣을 폴더 생성및 데이타 파일등록
hadoop@bigdata-host:~/hadoop/working$ hadoop fs -mkdir /user/hadoop/datastore/user/date=20140403
hadoop@bigdata-host:~/hadoop/working$ hadoop fs -put test01.txt /user/hadoop/datastore/user/date=20140403

-----------------------------------------------------------------------
파티션등록
hive> alter table user add partition(date='20140403');

-----------------------------------------------------------------------
결과 확인
hive> select * from user;  -->
park 20140403


-----------------------------------------------------------------------
두번째 파일 등록
20140404파티션에 데이타(test02.txt)를 date를 넣을 폴더 생성및 데이타 파일등록
hadoop@bigdata-host:~/hadoop/working$ hadoop fs -mkdir /user/hadoop/datastore/user/date=20140404
hadoop@bigdata-host:~/hadoop/working$ hadoop fs -put test02.txt /user/hadoop/datastore/user/date=20140404

-----------------------------------------------------------------------

파티션등록
hive> alter table user add partition(date='20140404');

-----------------------------------------------------------------------
결과 확인
hive> select * from user;  -->
park 20140403
sang 20140404
-----------------------------------------------------------------------

data파일 추가: test03.txt

 -----------------------------------------------------------------------

변경된 파일을 20140403파티션에 upload후 데이타 확인

hadoop@bigdata-host:~/hadoop/working$ hadoop fs -put test03.txt /user/hadoop/datastore/user/date=20140403

 -----------------------------------------------------------------------

select하면

hive> select * from user;
OK
park 20140403
append1 20140403
append2 20140403
append3 20140403
sang 20140404
Time taken: 0.318 seconds, Fetched: 5 row(s)


-----------------------------------------------------------------------

hadoop@bigdata-host:~/hadoop/working$ hadoop fs -ls /user/hadoop/datastore/user/date=20140403Found 2 items
-rw-r--r--   1 hadoop supergroup          5 2014-04-03 21:55 /user/hadoop/datastore/user/date=20140403/test01.txt
-rw-r--r--   1 hadoop supergroup         24 2014-04-03 22:42 /user/hadoop/datastore/user/date=20140403/test03.txt

 

 

번호 제목 날짜 조회 수
52 hbase shell에서 컬럼값 검색하기(SingleColumnValueFilter이용) 2014.04.25 5260
51 unique한 값 생성 2014.04.25 4829
50 sequence한 번호 생성방법 2014.04.25 4871
49 ubuntu 12.4에서 eclipse설치후 기동시 library(swt-gtk*)관련 오류 2014.04.23 3710
48 Building a Cluster docs 2014.04.22 3877
47 sqoop 1.4.4 설치및 테스트 2014.04.21 5602
46 The disk drive for uuid= is not ready yet or not present 오류 해결방법 2014.04.21 4805
45 os가 windows7인 host pc에서 ubuntu가 os인 guest pc에 접근하기 위한 네트워크설정 2014.04.20 5028
44 oozie에서 share lib설정시 action type별로 구분하여 넣을것 2014.04.18 4942
43 json serde사용법 2014.04.17 4736
42 json 값 다루기 2014.04.17 4620
41 통계자료 구할수 있는 곳 2014.04.16 4424
40 column family삭제시 Column family 'delete' does not exist오류 발생하는 경우 2014.04.14 4640
39 hive에서 생성된 external table에서 hbase의 table에 값 insert하기 2014.04.11 4702
38 Oozie 설치, 환경설정 및 테스트 2014.04.08 4669
37 다수의 로그 에이전트로 부터 로그를 받아 각각의 파일로 저장하는 방법(interceptor및 multiplexing) 2014.04.04 6741
» external partition table생성및 data확인 2014.04.03 4575
35 동일서버에서 LA와 LC동시에 기동하여 테스트 2014.04.01 4440
34 의사분산모드에서 presto설치하기 2014.03.31 5640
33 Hive Query Examples from test code (2 of 2) 2014.03.26 13562
위로