메뉴 건너뛰기

Bigdata, Semantic IoT, Hadoop, NoSQL

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

   


번호 제목 글쓴이 날짜 조회 수
221 fuseki의 endpoint를 이용한 insert, delete하는 sparql예시 총관리자 2018.02.14 106
220 [SparkR]SparkR 설치 사용기 1 - Installation Guide On Yarn Cluster & Mesos Cluster & Stand Alone Cluster file 총관리자 2016.11.04 106
219 [TLS/SSL]Cloudera CDH6.3.4기준 Hue TLS설정 항목 총관리자 2022.05.13 105
218 kafkaWordCount.scala의 producer와 consumer 클래스를 이용하여 kafka를 이용한 word count 테스트 하기 총관리자 2016.08.02 105
217 TopBraid Composer에서 SPIN 사용법 file 총관리자 2016.02.25 105
216 RDF storage조합에대한 test결과(4store, Jena+HBase, Hive+HBase, CumulusRDF, Couchbase) 페이지 링크 총관리자 2016.05.26 103
215 우분투 16.04LTS에 Jupyter설치 총관리자 2018.04.17 101
214 php auction 프로그램 총관리자 2017.05.14 101
213 kudu rebalance수행 command예시 총관리자 2022.01.17 100
212 참고할만한 spark예제를 설명하는 사이트 총관리자 2016.11.11 100
211 Jena는 기본적으로 multi thread환경을 지원하지 않는다. 총관리자 2016.08.16 100
210 Kudu tablet이 FAILED일때 원인 확인 방법 총관리자 2022.01.17 99
209 원격에 있는 git를 받은후 기존repository삭제후 새로운 리포지토리에 연결하여 소스 등록 총관리자 2019.07.13 99
208 HBase write 성능 튜닝 file 총관리자 2017.07.18 99
207 It is indirectly referenced from required .class files 오류 발생시 조치방법 총관리자 2017.03.09 99
206 impala session type별 표시되는 정보로 구분하는 방법 총관리자 2021.05.25 98
205 collection생성시 -shards와 -replicationFactor값을 잘못지정하면 write.lock for client xxx.xxx.xxx.xxx already exists오류가 발생한다. 총관리자 2016.04.28 98
204 에러 추적(Error Tracking) 및 로그 취합(logging aggregation) 시스템인 Sentry 설치 총관리자 2018.03.14 97
203 MongoDB에 있는 특정컬럼의 값을 casting(string->integer)하여 update하기 java 소스 총관리자 2016.12.19 97
202 [Elephas] Jena Elephas를 이용하여 Spark에서 rdfTriples의 RDD를 만들고 RDD관련 작업하는 샘플소스 총관리자 2016.08.10 97

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.

위로