메뉴 건너뛰기

Bigdata, Semantic IoT, Hadoop, NoSQL

Bigdata, 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

 

 

번호 제목 글쓴이 날짜 조회 수
130 insert hbase by hive ... error occured after 5 hours..HMaster가 뜨지 않는 장애에 대한 복구 방법 총관리자 2014.04.29 7129
129 hive 2.0.1 설치및 mariadb로 metastore 설정 총관리자 2016.06.03 5185
128 Hive Query Examples from test code (2 of 2) 총관리자 2014.03.26 5029
127 Spark에서 Serializable관련 오류및 조치사항 총관리자 2017.04.21 4901
126 의사분산모드에서 presto설치하기 총관리자 2014.03.31 3050
125 Hive 사용법 및 쿼리 샘플코드 구퍼 2013.03.07 2991
124 spark-sql실행시 Caused by: java.lang.NumberFormatException: For input string: "0s" 오류발생시 조치사항 총관리자 2016.06.09 2802
123 Hive+mysql 설치 및 환경구축하기 file 구퍼 2013.03.07 2722
122 banana pi에 hive 0.13.1+mysql(metastore)설치 file 총관리자 2014.09.09 2406
121 Hive java connection 설정 file 구퍼 2013.04.01 2013
120 VisualVM 1.3.9을 이용한 spark-submit JVM 모니터링을 위한 설정및 spark-submit실행 옵션 총관리자 2016.10.28 1891
119 Spark 2.1.1 clustering(5대) 설치(YARN기반) 총관리자 2016.04.22 1882
118 java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error: Unable to deserialize reduce input key from...오류해결방법 총관리자 2015.06.16 1757
117 hive에서 생성된 external table에서 hbase의 table에 값 insert하기 총관리자 2014.04.11 1748
116 index생성, 삭제, 활용 총관리자 2014.04.25 1702
115 impald에서 idle_query_timeout 와 idle_session_timeout 구분 총관리자 2021.05.20 1630
114 FAILED: IllegalStateException Variable substitution depth too large: 40 오류발생시 조치사항 총관리자 2014.08.19 1521
113 hiverserver2기동시 connection refused가 발생하는 경우 조치방법 총관리자 2014.05.22 1472
112 schema설정없이 hive를 최초에 실행했을때 발생하는 오류메세지및 처리방법 총관리자 2016.09.25 1226
111 json 값 다루기 총관리자 2014.04.17 1222

A personal place to organize information learned during the development of such Hadoop, Hive, Hbase, Semantic IoT, etc.
We are open to the required minutes. Please send inquiries to gooper@gooper.com.

위로