메뉴 건너뛰기

Cloudera, BigData, Semantic IoT, Hadoop, NoSQL

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


MariaDB의 study데이타 베이스에 접근하여 product테이블의 데이타를 가져와서 study/out/productimport에 저장하는 sqoop문장이다.
이때 컬럼구분자는 '\001'(^A)를 사용하고 라인구분자는 '\003'(^C)를 사용한다.
hive폴더에 저장되는 라인은 price >1인 조건을 만족해야하며 productID및 name만 저장된다
이렇게 하면 컬럼에 newline(\n)이 있어도 문제없이 가져올 수 있다.

sqoop import \
--connect=jdbc:mysql://gsda3:포트/study \
--username=db사용자\
--password=패스워드\
--table=product \
--target-dir=study/out/productimport \
--fields-terminated-by='\001' \
--lines-terminated-by='\003'
--where="price > 1 " \
--columns="productID, name"

아래는 위에서 sqoop로 가져온 데이타에 대한 external table을 생성하는 hive명령문이다.

hive 1.1에서 기본적으로 지원하는 라인 구분자는 '\n'만 지원한다.
하지만 textinputformat.record.delimiter을 이용하여 라인 구분자를 변경할 수 있다.

set textinputformat.record.delimiter='\003';
create external table productimport
(productID string, name string)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\001'
STORED AS TEXTFILE
LOCATION 'study/out/productimport';
번호 제목 날짜 조회 수
521 [CDP7.1.7]Impala Query의 Memory Spilled 양은 ScratchFileUsedBytes값을 누적해서 구할 수 있다. 2022.07.29 325
520 SQL문장과 Mongo에서 사용하는 명령어를 비교한 것입니다. 2015.09.30 327
519 impala external 테이블 생성시 컬럼과 라인 구분자를 지정하여 테이블 생성하는 예시 2020.02.20 328
518 missing block및 관련 파일명 찾는 명령어 2021.02.20 328
517 Hue Job Browser의 Queries탭에서 조건을 지정하는 방법 2018.05.10 329
516 JAVA_HOME을 명시적으로 지정하는 방법 2018.06.04 329
515 RDF4J의 rdf4j-server.war가 제공하는 RESTFul API를 이용하여 repository에 CRUD테스트 2017.08.30 330
514 python 2.6.6에서 print 'A=' 형태의 사용이 python 3.5.1에서 오류(SyntaxError: Missing parentheses in call to 'print') 발생함.. 2016.05.27 334
513 Could not compute split, block input-0-1517397051800 not found형태의 오류가 발생시 조치방법 2018.02.01 334
512 Could not authenticate, GSSException: No valid credentials provided (Mechanism level: Failed to find any kerberos tgt) 2022.04.28 334
511 solrdf초기 기동시 "Caused by: java.lang.IllegalAccessError: tried to access field org.apache.solr.handler.RequestHandlerBase.log from class org.gazzax.labs.solrdf.handler.update.RdfUpdateRequestHandler" 오류가 발생시 조치사항 2016.04.22 336
510 한번에 여러값 update하기 2016.01.13 337
509 [CentOS 7.4]Hadoop NFS gateway기동시 Cannot connect to port 2049 오류 발생시 확인/조치 2022.03.02 339
508 [SparkR]SparkR 설치 사용기 1 - Installation Guide On Yarn Cluster & Mesos Cluster & Stand Alone Cluster file 2016.11.04 340
507 hue.axes_accessattempt테이블 데이터 샘플 2020.02.10 341
506 tar를 이용한 리눅스 백업 2018.05.13 342
505 [CDP7.1.7]impala-shell을 이용하여 kudu table에 insert/update수행시 발생하는 오류(Transport endpoint is not connected (error 107)) 발생시 확인할 내용 2023.11.30 342
504 SPIN(SPARQL Inference Notation)이란.. file 2016.02.25 343
503 collection생성혹은 collection조회시 Plugin init failure for [schema.xml] fieldType "pdate": Error loading class 'solr.IntField' 오류 조치사항 2022.04.07 344
502 룰에 매칭되면 발생되는 엑티베이션 객체에 대한 작업(이전값 혹은 현재값)을 처리하는 클래스 파일 2016.07.21 346
위로