메뉴 건너뛰기

Cloudera, BigData, Semantic IoT, Hadoop, NoSQL

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


0. hadoop, hbase, tomcat등이 이미 서버에 설치되어 있어야 한다.


1. eclipse에서 https://github.com/Merck/Halyard를 import한다.

  가. File->Import->Projects from Git를 선택한다.

  나. Select Repository Source를 Clone URI를 선택한다.

  다. URI에 https://github.com/Merck/Halyard를 입력한다.

  라. Branch Selection에서 master를 선택한다.

  마. Local Destination의 Directory를 디폴트로 선택한다

  바. Finish를 선택하면 github에서 소스를 받아 로컬 리포지토리에 저장하고 eclipse 프로젝트를 생성해준다.


* verion up등으로 git pull했을때 충돌이 발생하면 git stash -> git pull -> git pop순서데로 처리해서 로컬에 반영해준다.

           (참조 : http://vezi95.blogspot.kr/2016/05/git-pull.html)


2. halyard를 eclipse에서 build 한다.

  가. halyard폴더의 pom.xml을 선택하고 -> Run As -> Maven Build..-> goal에 package를 입력및 Skip Tests선택후 Run한다.

  나. 이때 몇가지 오류가 발생하는데 Windows RegCreateKeyEx(...) returned error code 5. 가 발생하면 아래를 참조한다.

  다. halyard-sail, halyard-tools 프로젝트에서 halyard-common.jar관련 dependency오류가 발생하면 아래처럼 주석처리한다.

        <!--  dependency>

            <groupId>${project.groupId}</groupId>

            <artifactId>halyard-common</artifactId>

            <version>${project.version}</version>

            <type>test-jar</type>

            <scope>test</scope>

        </dependency -->


3. web모듈을 tomcat서버에 deploy한다.

 가. Halyard/webapps/target에 생성된 rdf4j-server.war, rdf4j-workbench.war를 tomcat webapps에 복사하여 디플로이한다.

     (halyard-webapps-1.1-SNAPSHOT.zip파일에도 동일한 파일이 압축되어있다)

 나. http://sda1/rdf4j-server/, http://sda1/rdf4j-workbench/로 웹에서 접근가능하나 rdf4j-server는 workbench에서 사용되므로 외부에 노출시켜서는 안된다.

 다. tomcat의 bin 폴더에 setenv.sh파일을 생성하고 아래의 내용을 추가한후 tomcat를 재기동한다.(이것을 설정하지 않으면 rdf4j-workbench를 브라우저에서 조회시 Hbase class관련 오류를 방지할 수 있다)

export CLASSPATH=$CLASSPATH:"$JAVA_HOME/jre/lib/ext/servlet-api.jar:"`$HOME/hadoop/bin/hadoop classpath`:`$HOME/hbase/bin/hbase classpath`


4. Halyard SDK를 서버에 복사/압축해제한다.

  가. RDF4J에서 제공하는 기능에 Hbase를 추가한 버젼이며 repository를 생성하고 삭제하는 등의 작업을 command라인에서 수행할 수 있다.

    (http://sda1/rdf4j-workbench/를 이용하면 web에서 동일한 작업을 할 수 있다)

  나. 서버의 특정 위치에 폴더(예, halyard-sdk)를 만들고 Halyard/sdk/target/halyard-sdk-1.1-SNAPSHOT.zip를 업로드 한후 압축을 푼다.(unzip halyard-sdk-1.1-SNAPSHOT.zip)

  다. 압축을 풀면 폴더내에 아래와 같은 실행파일등이 생성된다.

LICENSE  LICENSES_THIRD_PARTY  bulkload  bulkupdate  console  export  halyard-sdk-1.1-SNAPSHOT.zip  hiveload  img  index.html  lib  pexport  update


  라.RDF4J console 실행(테스트)

     - ./console

   * console실행시 오류가 발생하면 아래를 참조하여 정확한 경로를 지정해준다.

 

-bash-4.1$ cat console
#!/bin/sh
lib="$(dirname "${0}")/lib"
#java -Xmx2G -cp "$lib/halyard-tools-1.1-SNAPSHOT.jar:"`hadoop classpath`":"`hbase classpath` org.eclipse.rdf4j.console.Console "$@"
java -Xmx2G -cp "$lib/halyard-tools-1.1-SNAPSHOT.jar:"`hadoop classpath`":"`$HOME/hbase/bin/hbase classpath` org.eclipse.rdf4j.console.Console "$@"

5. console작업(예시)

  가. Repository생성 (query timeout : 604800(60*60*24*7), defualt: 180초)

    

> create hbase   
Please specify values for the following variables:
Repository ID: testRepo
Repository title: 
HBase Table Name: 
Create HBase Table if missing (true|false) [true]: 
HBase Table presplit bits [0]: 
Use Halyard Push Evaluation Strategy (true|false) [true]: 
Query Evaluation Timeout [180]: 604800
Repository created


  나. 생성된 Repository에 접속

> open testRepo
Opened repository 'testRepo'


  다. sparql실행(등록된 데이타 없는 상태)(여러줄을 입력할 수 있고 마지막 줄에 '.'을 입력하면 쿼리가 수행된다.)

testRepo> sparql
enter multi-line SPARQL query (terminate with line containing single '.')
select * where {?s ?p ?o} limit 10
.
Evaluating SPARQL query...
+------------------------+------------------------+------------------------+
| s                      | p                      | o                      |
+------------------------+------------------------+------------------------+
+------------------------+------------------------+------------------------+
0 result(s) (27 ms)

  라. data파일 로드(약 905336건)

testRepo> load /home/gooper/aa/test.nq
Loading data...
Data has been added to the repository (83878 ms)


  마. sparql 실행(등록된 데이타 있음)

testRepo> sparql
enter multi-line SPARQL query (terminate with line containing single '.')
select * where {?s ?p ?o} limit 10
.
Evaluating SPARQL query...
+------------------------+------------------------+------------------------+
| s                      | p                      | o                      |
+------------------------+------------------------+------------------------+
| <http://www.gooper.com/herit-in/herit-cse/TempSensor_LR0001TS0004/status/Data/CONTENT_INST_167822>| <http://www.w3.org/2000/01/rdf-schema#label>| ","                    |
| <http://www.gooper.com/herit-in/herit-cse/TempSensor_LR0001TS0004/status/Data/CONTENT_INST_167822>| <http://purl.org/dc/elements/1.1/creator>| "TAS"                  |
| <http://www.gooper.com/herit-in/herit-cse/TempSensor_LR0001TS0004/status/Data/CONTENT_INST_167822>| <http://www.gooper.com/m2m/hasLastModifiedDate>| "2015-12-23T19:34:08"^^<http://www.w3.org/2001/XMLSchema#dateTime>|
| <http://www.gooper.com/herit-in/herit-cse/TempSensor_LR0001TS0004/status/Data/CONTENT_INST_167822>| <http://www.gooper.com/m2m/isContentInstanceOf>| <http://www.gooper.com/herit-in/herit-cse/TempSensor_LR0001TS0004/status/Data>|
| <http://www.gooper.com/herit-in/herit-cse/TempSensor_LR0001TS0004/status/Data/CONTENT_INST_167822>| <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>| <http://www.gooper.com/m2m/ContentInstance>|
| <http://www.gooper.com/herit-in/herit-cse/TempSensor_LR0001TS0004/status/Data/CONTENT_INST_167822>| <http://www.gooper.com/m2m/hasContentValue>| "26.3"^^<http://www.w3.org/2001/XMLSchema#double>|
| <http://www.gooper.com/herit-in/herit-cse/TempSensor_LR0001TS0004/status/Data/CONTENT_INST_167822>| <http://www.gooper.com/m2m/resourceName>| "CONTENT_INST_167822"  |
| <http://www.gooper.com/herit-in/herit-cse/TempSensor_LR0001TS0004/status/Data/CONTENT_INST_167822>| <http://www.gooper.com/m2m/hasCreateDate>| "2015-12-23T19:34:08"^^<http://www.w3.org/2001/XMLSchema#dateTime>|
| <http://www.gooper.com/herit-in/herit-cse/TempSensor_LR0001TS0004/status/Data/CONTENT_INST_167822>| <http://www.gooper.com/m2m/hasParentResource>| <http://www.gooper.com/herit-in/herit-cse/TempSensor_LR0001TS0004/status/Data>|
| <http://www.gooper.com/herit-in/herit-cse/UserInOutInfo_u00002/status/Data/CONTENT_INST_158789>| <http://www.w3.org/2000/01/rdf-schema#label>| ","                    |
+------------------------+------------------------+------------------------+
10 result(s) (102 ms)


* 쿼리결과가 특정시간내에 산출되지 않으면 exception이 발생한다.(Query evaluation error: Query evaluation exceeded specified timeout 180s)

* 개수 카운트

testRepo> sparql
enter multi-line SPARQL query (terminate with line containing single '.')
select (count(*) as ?cnt) where {?s ?p ?o}
.
Evaluating SPARQL query...
+-----------------------------------------------------------------------------+
| cnt                                                                           |
+-----------------------------------------------------------------------------+
| "919049"^^<http://www.w3.org/2001/XMLSchema#integer>                        |
+-----------------------------------------------------------------------------+
1 result(s) (8468 ms)


   바. console명령어

List of all commands:
help        Displays this help message
info        Shows info about the console
connect     Connects to a (local or remote) set of repositories
disconnect  Disconnects from the current set of repositories
create      Creates a new repository
federate    Federate existing repositories.
drop        Drops a repository
open        Opens a repository to work on, takes a repository ID as argument
close       Closes the current repository
show        Displays an overview of various resources
load        Loads a data file into a repository, takes a file path or URL as argument
verify      Verifies the syntax of an RDF data file, takes a file path or URL as argument
clear       Removes data from a repository
sparql      Evaluate a SPARQL query
serql       Evaluate a SeRQL query
set         Allows various console parameters to be set
exit, quit  Exit the console


6. bulkload쉘 사용(예시)

  가. bulkload파일을 현재 상황에 맞게 패스등을 변경한다.

-bash-4.1$ cat bulkload 
#!/bin/sh
lib="$(dirname "${0}")/lib"
libjars="$(echo "$lib"/*.jar | tr ' ' ',')"
export HADOOP_CLASSPATH=`$HOME/hadoop/bin/hadoop classpath`:`$HOME/hbase/bin/hbase classpath`
#hadoop jar lib/halyard-tools-1.1-SNAPSHOT.jar com.msd.gin.halyard.tools.HalyardBulkLoad -conf /etc/hbase/conf/hbase-site.xml -libjars $libjars "$@"
hadoop jar lib/halyard-tools-1.1-SNAPSHOT.jar com.msd.gin.halyard.tools.HalyardBulkLoad -conf $HOME/hbase/conf/hbase-site.xml -libjars $libjars "$@"

  나. bulkload 실행(데이타 파일은 test.nq.gz파일을 이용함)

    - halyard 작업디렉토리 생성 : hdfs dfs -mkdir halyard

    - data저장 디렉토리 생성 : hdfs dfs -mkdir halyard/input

    - data upload : hdfs dfs -put test.nq.gz halyard/input

    - bulkload실행(오류가 발생하면 Exception발생) : ./bulkload halyard/input halyard/temp testRepo

    - bulkload실행(오류가 있어도 Exception발생하지 않고 진행함) : ./bulkload -Dhalyard.parser.skipinvalid=true halyard/input halyard/temp testRepo

   


번호 제목 날짜 조회 수
101 [vue storefrontui]외부 API통합하기 참고 문서 2022.02.09 80
100 oracle 접속 방식에 따른 --connect 지정 방법 2022.02.11 176
99 service name방식의 oracle을 메타정보 저장소로 사용할때 Hue Configuration설정하는 방법 2022.02.12 210
98 Oracle RAC 구성된 DB서버에 대한 컴포넌트별 설정 방법 2022.02.12 606
97 [CentOS 7.4]Hadoop NFS gateway기동시 Cannot connect to port 2049 오류 발생시 확인/조치 2022.03.02 339
96 [TLS]TLS용 사설 인증서 변경 혹은 신규 지정시 No trusted certificate found 오류 발생시 확인및 조치사항 2022.03.15 563
95 [TLS]pkcs12형식의 인증서 생성및 jks형식 인증서 생성 커맨드 예시 2022.03.15 211
94 Hue impala에서 query결과를 HDFS 파일로 export시 AuthorizationException: User 'gooper1234' does not have privileges to access: db명.query_impala_123456 2022.03.17 486
93 [application수행 로그]Failed to read the application application_123456789012_123456시 조치 방법 2022.03.21 505
92 [oozie]Oozie WF수행시 단계별 ID넘버링 비교/설명 2022.03.23 127
91 HDFS에서 quota 설정 방법및 확인 방법 2022.03.30 399
90 hue메타 정보를 저장(oracle DB)하는 내부 테이블을 이용하여 전체 테이블목록, 전체 코디네이터 목록, 코디네이터기준 workflow구조를 추출하는 쿼리문 2022.04.01 137
89 collection생성혹은 collection조회시 Plugin init failure for [schema.xml] fieldType "pdate": Error loading class 'solr.IntField' 오류 조치사항 2022.04.07 344
88 [hive] hive.tbls테이블의 owner컬럼값은 hadoop.security.auth_to_local에 의해서 filtering된다. 2022.04.14 169
87 [oracle]10자리 timestamp값을 날짜로 변환하는 방법 2022.04.14 128
86 Could not authenticate, GSSException: No valid credentials provided (Mechanism level: Failed to find any kerberos tgt) 2022.04.28 334
85 restaurant-controller,에서 등록 예시 2022.04.30 99
84 주문 생성 데이터 예시 2022.04.30 112
83 주문히스토리 조회 2022.04.30 99
82 [bitbucket] 2022년 3월 2일 부터 git 작업시 기존에 사용하던 비빌번호를 사용할 수 없도록 변경되었다. 2022.04.30 127
위로