리눅스의 종류는 크게 데비안(debian) 계열과 레드햇(Redhat) 계열로 나뉩니다. MACHBASE는 리눅스 배포판에 맞게 *.deb 와 *.rpm 등의 설치 패키지를 제공하고 있습니다. 패키지를 사용한 설치는 간편하다는 장점이 있지만, 원하는 디렉토리에 설치할 수 없다는 단점이 있습니다. 또한 설정 변경에 제약이 있기 때문에 테스트를 하기엔 부적합합니다.
MACHBASE는 tgz 패키지도 함께 배포를 합니다. 이번 포스트에서는 tgz 패키지로 설치하는 과정을 다루겠습니다. tgz 패키지를 통한 설치는 모든 리눅스 배포판에서 진행 가능합니다. 아래의 글에서는 설치 방법을 간략하게 설명해 드리겠습니다. 자세한 내용은 여기를 참고해 주세요.
STEP 01. 패키지 다운로드
아래의 명령어를 통해 tgz파일을 다운받아 주세요. 예시의 링크는 구버전일 수 있으니, 마크베이스 홈페이지에서 다운로드를 신청하여 신규 링크를 확인 부탁드립니다.
wget http://www.machbase.com/dist/machbase-community-3.5.0.826b8f2.community-LINUX-X86-64-release.tgz
STEP 02. 압축 풀기
먼저 사용자 계정이 접근 가능한 경로에 machbase_home
디렉토리를 만들어 주세요. 그리고 패키지 파일을 디렉토리로 옮겨 압축을 풀어주세요. 아래는 압축을 해제한 결과입니다.
machbase@myhost:~/machbase_home$ tar -xvf machbase-community-3.5.0.826b8f2.community-LINUX-X86-64-release.tgz 3rd-party/ 3rd-party/python-module/ 3rd-party/python-module/machbaseAPI-1.0.tar.gz ……….. 생략 ……………. webadmin/flask/MWA/machTaskSqlite.py webadmin/flask/MWA/machServer.py machbase@myhost:~/machbase_home$ ls -al 합계 109160 drwxrwxr-x 16 machbase machbase 4096 8월 4 11:44 . drwxr-xr-x 24 machbase machbase 4096 8월 4 11:44 .. drwxrwxr-x 3 machbase machbase 4096 8월 3 12:12 3rd-party drwxrwxr-x 2 machbase machbase 4096 8월 3 12:12 bin drwxrwxr-x 6 machbase machbase 4096 8월 3 12:12 collector drwxrwxr-x 2 machbase machbase 4096 8월 3 12:12 conf drwxrwxr-x 2 machbase machbase 4096 8월 3 12:12 dbs drwxrwxr-x 3 machbase machbase 4096 8월 3 12:12 doc drwxrwxr-x 2 machbase machbase 4096 8월 3 12:12 include drwxrwxr-x 2 machbase machbase 4096 8월 3 12:12 install drwxrwxr-x 2 machbase machbase 4096 8월 3 12:12 lib -rw-rw-r– 1 machbase machbase 111709524 8월 4 11:08 machbase-community-3.5.0.826b8f2.community-LINUX-X86-64-release.tgz drwxrwxr-x 2 machbase machbase 4096 8월 3 12:12 meta drwxrwxr-x 9 machbase machbase 4096 8월 3 12:12 sample drwxrwxr-x 2 machbase machbase 4096 8월 3 12:12 trc drwxrwxr-x 10 machbase machbase 4096 8월 3 12:12 tutorials drwxrwxr-x 3 machbase machbase 4096 8월 3 12:12 webadmin |
STEP 03. OS 환경 변경
MACHBASE의 정상적인 작동을 위해서 열 수 있는 파일의 갯수를 높여야 합니다. 먼저 아래의 방법대로 현재 설정되어 있는 내용을 확인해 주세요.
machbase@myhost:~/machbase_home$ ulimit -Sn 4096 |
위와 같이 4096으로 설정되었다면 값을 조정해야 하는데, 이를 위해 다음과 같이 /etc/security/limits
.conf
의 내용을 변경해야 합니다. 먼저 아래의 명령어를 실행해 주세요.
* 참고로 해당 파일은 우분투와 레드햇 모두 동일하게 적용
sudo vi /etc/security/limits.conf |
그리고 아래와 같이 내용을 변경해 주세. 변경이 완료되면 다시 reboot해 주세요.
* hard nofile 65535 * soft nofile 65535 |
다음의 명령어를 실행하면 65536으로 변경된 것을 확인할 수 있습니다.
machbase@mb:~$ ulimit -Sn 65536 |
STEP 04. 환경변수 추가
마크베이스의 바이너리와 라이브러리를 활용하기 위해서 다음과 같이 환경 변수를 추가해 주세요.
export MACHBASE_HOME=/home/machbase/machbase_home export PATH=$MACHBASE_HOME/bin:$PATH export LD_LIBRARY_PATH=$MACHBASE_HOME/lib:$LD_LIBRARY_PATH |
실행이 완료되면, 재로그인을 하거나 환경변수를 다시 로딩해서 변경된 내용을 확인합니다. 아래와 같이 출력되면 성공적으로 변경된 것입니다. PATH에는 bin 디렉토리가, LD_LIBRARY_PATH에는 lib 디렉토리가 들어있는지 확인하셔야 합니다.
machbase@myhost:~$ env | grep machbase_home LD_LIBRARY_PATH=/home/machbase/machbase_home/lib:…..생략.. PATH=/home/machbase/machbase_home/bin:.. 생략 MACHBASE_HOME=/home/machbase/machbase_home |
STEP 05. configureation 설정
만일 사용자 포트를 변경하고 싶다면 conf/machbase.conf 의 PORT_NO를 수정하면 됩니다. 이 부분은 필수가 아니니 생략하셔도 됩니다. machloader.conf 를 함께 변경하면 PORT로 인한 혼란을 방지할 수 있습니다.
machbase@myhost:~/machbase_home/conf$ grep PORT * machbase.conf:PORT_NO = 5656 machcollector.conf:PORT_NO = 9999 machloader.conf:PORT_NO = 5656 |
STEP 06. 데이터베이스 생성
이번에는 MACHBASE 데이터베이스를 생성해 보겠습니다. 초기화는 machadmin이라는 도구를 사용해서 수행할 수 있습니다.
machbase@myhost:~/machbase_home$ machadmin -c —————————————————————– Machbase Administration Tool Release Version – 3.5.0.826b8f2.community Copyright 2014, InfiniFlux Corp. or its subsidiaries All Rights Reserved —————————————————————– Database created successfully. machbase@myhost:~/machbase_home$ machbase@myhost:~/machbase_home$ ls dbs SYSTEM_TABLESPACE meta.dbs-0 meta.dbs-1 meta.dbs-2 meta.dbs-3 |
-c 옵션을 통해서 데이터베이스가 생성되었습니다. 그리고 dbs 디렉토리에 파일과 디렉토리가 생긴 것을 확인할 수 있습니다.
STEP 07. 데이터베이스 구동
데이터베이스를 구동할 때도, machadmin을 사용하여 간편하게 구동할 수 있습니다. 명령어는 machbase -u입니다.
machbase@myhost:~/machbase_home$ machadmin -u —————————————————————– Machbase Administration Tool Release Version – 3.5.0.826b8f2.community Copyright 2014, InfiniFlux Corp. or its subsidiaries All Rights Reserved —————————————————————– Waiting for Machbase server start. Machbase server started successfully. |
STEP 08. 데이터베이스 종료
마찬가지로 machadmin을 사용하여 종료합니다. 명령어는 machadmin -s 입니다. 참고로 machadmin -k는 kill 종료입니다.
machbase@myhost:~/machbase_home$ machadmin -s —————————————————————– Machbase Administration Tool Release Version – 3.5.0.826b8f2.community Copyright 2014, InfiniFlux Corp. or its subsidiaries All Rights Reserved —————————————————————– Waiting for Machbase server shut down… Machbase server shut down successfully. |
위에서 알아본, -c, -u, -s, -k 이외에 더 많은 명령을 아래와 같이 machadmin을 통해 수행할 수 있습니다.
machbase@myhost:~/machbase_home$ machadmin —————————————————————– Machbase Administration Tool Release Version – 3.5.0.826b8f2.community Copyright 2014, InfiniFlux Corp. or its subsidiaries All Rights Reserved —————————————————————– << available option lists >> -u, –startup Startup Machbase server. –recovery[=simple,complex,reset] Recovery mode. (default: simple) -s, –shutdown Shutdown Machbase server. -c, –createdb Create Machbase database. -d, –destroydb Destroy Machbase database. -k, –kill Terminate Machbase server. -i, –silence Produce less output. -r, –restore Restore Machbase database. -x, –extract Extract BackupFile to BackupDirectory. -w, –viewimage Display information of BackupImageFile. -e, –check Check whether Machbase Server is running. -t, –licinstall Install the license file. -f, –licinfo Display information of installed license file. |
STEP 09. 마크베이스 접속
마크베이스는 machsql을 통하여 접속할 수 있습니다. 그전에 machadmin -u로 마크베이스를 다시 구송시키겠습니다.
machbase@myhost:~/machbase_home$ machadmin -u —————————————————————– Machbase Administration Tool Release Version – 3.5.0.826b8f2.community Copyright 2014, InfiniFlux Corp. or its subsidiaries All Rights Reserved —————————————————————– Waiting for Machbase server start. Machbase server started successfully. |
machsql을 실행하면 ID와 PW입력을 요구하는데 ID와 PW는 다음과 같습니다.
- ID : SYS
- PW : MANAGER
machbase@myhost:~/machbase_home$ machsql ================================= Machbase Client Query Utility Release Version 3.5.0.826b8f2.community Copyright 2014 InfiniFlux Corporation or its subsidiaries. All Rights Reserved. ================================= Machbase server address (Default:127.0.0.1) : Machbase user ID (Default:SYS) Machbase User Password : MACHBASE_CONNECT_MODE=INET, PORT=5656 Type ‘help’ to display a list of available commands. Mach> select * from m$tables; NAME TYPE DATABASE_ID ID USER_ID COLCOUNT ————————————————————– M$SYS_COLLECTOR_COLUMNS 1 -1 1000049 0 11 M$COLUMNS 1 -1 1000043 0 13 M$SYS_COLUMNS 1 -1 1000042 0 13 M$SYS_INDEX_COLUMNS 1 -1 1000045 0 9 M$SYS_COLLECTOR_SOURCES 1 -1 1000050 0 7 M$SYS_TABLESPACE_DISKS 1 -1 1000020 0 8 M$SYS_COLLECTORS 1 -1 1000048 0 25 M$SYS_TABLES 1 -1 1000038 0 8 M$TABLES 1 -1 1000040 0 8 M$SYS_INDEXES 1 -1 1000044 0 15 M$SYS_USERS 1 -1 1000046 0 4 M$SYS_TABLESPACES 1 -1 1000016 0 5 M$SYS_COLLECTORMANAGERS 1 -1 1000047 0 7 [13] row(s) selected. Elapsed time: 0.002 Mach> |
마치며
파일 다운로드를 제외하면, 설치는 20분 정도 걸린 것 같습니다. 시스템 설정 외에는 크게 어려운 부분은 없었습니다. 이제 다음에는 직접 데이터도 로딩하는 방법에 대해서 알려드리겠습니다.