설치된 디렉터리 설명은 다음과 같다The directory descriptions installed are as follows.
디렉터리 Directory | 설명 Description |
---|---|
bin실행 | 파일들 Executable files |
collector로그 수집기 파일들 | Log collector files |
conf설정 | 파일들 Configuration files |
dbs데이터 저장 공간 | Data storage space |
doc라이선스 | 파일들 License files |
include | CLI 프로그램을 위한 각종 헤더 파일들 |
install | Makefile을 위한 mk 파일 |
lib | 각종 라이브러리 Various header files for the CLI program |
install | mk files for Makefile |
lib | Various libraries |
msg | Machbase 서버 에러 메시지server error messages |
package | (Cluster edition) 추가된 패키지를 저장할 경로Path to save the added package |
sample각종 예제 파일들 | Various example files |
trc | Machbase 서버 로그 및 추적 내용들server logs and trace contents |
webadmin | MWA 웹서버 파일들Web Server Files |
3rd-party | grafana 연동 파일들 |
환경변수 설정
.bashrc 파일에 마크베이스 관련 환경 변수를 추가한다Grafana plug-in files |
Set Environment Variable
Add Machbase-related environment variables to your .bashrc file.
Code Block | ||
---|---|---|
| ||
export MACHBASE_HOME=/home/machbase/machbase_home export PATH=$MACHBASE_HOME/bin:$PATH export LD_LIBRARY_PATH=$MACHBASE_HOME/lib:$LD_LIBRARY_PATH # 변경사항을 아래 명령어로 적용한다 Apply the changes with the following command. source .bashrc |
마크베이스 프로퍼티 설정
Set Machbase Property
The $MACHBASE_HOME/conf 디렉터리에 machbasedirectory contains the file macbase.conf.sample 파일이 있다sample.
Code Block | ||
---|---|---|
| ||
[machbase@localhost ~]$ cd $MACHBASE_HOME/conf [machbase@localhost conf]$ ls -l -rw-rw-r-- 1 machbase machbase 106 Oct 30 16:10 machtag.sql.sample -rw-rw-r-- 1 machbase machbase 17556 Oct 30 16:10 machbase.conf.sample -rw-rw-r-- 1 machbase machbase 1706 Oct 30 16:10 machcollector.conf.sample [machbase@localhost conf]$ |
또한 리눅스 환경 변수를 이용하여 마크베이스 접속 포트번호를 변경할 수도 있다. 아래는 디폴트값(5656)이 아닌 다른 포트번호(7878)로 변경하는 예이다You can also change the Machbase connection port number using the Linux environment variable. Below is an example of switching to a different port number (7878) other than the default value (5656).
Code Block | ||
---|---|---|
| ||
export MACHBASE_PORT_NO=7878 |
마크베이스 간단 사용
데이터베이스 생성
데이터베이스 생성은 machadmin 유틸리티를 이용한다. --help 옵션으로 명령어를 볼 수 있다Machbase Simple Usage
Create Database
To create the database, use the machadmin utility. You can see the command with the --help option.
Code Block | ||
---|---|---|
| ||
[machbase@localhost machbase_home]$ machadmin --help ----------------------------------------------------------------- Machbase Administration Tool Release Version - x.x.x.official Copyright 2014, MACHBASE 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. [machbase@localhost machbase_home]$ |
Create a database with the -c 옵션으로 데이터베이스를 생성한다option.
Code Block | ||
---|---|---|
| ||
[machbase@localhost machbase_home]$ machadmin -c ----------------------------------------------------------------- Machbase Administration Tool Release Version - x.x.x.official Copyright 2014, MACHBASE Corp. or its subsidiaries All Rights Reserved ----------------------------------------------------------------- Database created successfully. [machbase@localhost machbase_home]$ |
마크베이스 서버 실행
-u 옵션으로 마크베이스 서버를 실행한다Launch Machbase Server
Run the Machbase server with the -u option.
Code Block | ||
---|---|---|
| ||
[machbase@localhost machbase_home]$ machadmin -u ----------------------------------------------------------------- Machbase Administration Tool Release Version - x.x.x.official Copyright 2014, MACHBASE Corp. or its subsidiaries All Rights Reserved ----------------------------------------------------------------- Waiting for Machbase server start. Machbase server started successfully. [machbase@localhost machbase_home]$ |
ps 명령을 통해 아래와 같이 서버 데몬인 machbased 가 구동된 것을 확인할 수 있다You can see that the server daemon, machbased, is running through the ps command as shown below.
Code Block | ||
---|---|---|
| ||
[machbase@localhost machbase_home]$ ps -ef |grep machbased machbase 11178 1 2 11:25 ? 00:00:01 /home/machbase/machbase_home/bin/machbased -s --recovery=simple machbase 11276 9867 0 11:26 pts/1 00:00:00 grep --color=auto machbased [machbase@localhost machbase_home]$ |
마크베이스 서버 접속
machsql 이라는 접속 유틸리티를 이용하여 마크베이스 서버에 접속한다.
관리자 계정인 SYS 가 준비되어 있으며, 패스워드는 MANAGER 로 설정되어 있다.Machbase Server Connection
Connect to the Machbase server using an access utility called machsql.
The administrator account SYS is ready and the password is set to MANAGER.
Code Block | ||
---|---|---|
| ||
[machbase@localhost machbase_home]$ machsql ================================================================= Machbase Client Query Utility Release Version x.x.x.official Copyright 2014 MACHBASE 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> |
간단한 테이블 생성 및 데이터를 입력, 출력 해보자Let's create a simple table and input / output data.
Code Block | ||
---|---|---|
| ||
create table hello( id integer ); insert into hello values( 1 ); insert into hello values( 2 ); select * from hello; select _arrival_time, * from hello; |
Code Block | ||
---|---|---|
| ||
Mach> create table hello( id integer ); Created successfully. Elapsed time: 0.054 Mach> insert into hello values( 1 ); 1 row(s) inserted. Elapsed time: 0.000 Mach> insert into hello values( 2 ); 1 row(s) inserted. Elapsed time: 0.000 Mach> select * from hello; ID -------------- 2 1 [2] row(s) selected. Elapsed time: 0.000 Mach> select _arrival_time, * from hello; _arrival_time ID ----------------------------------------------- 2019-01-02 11:33:00 122:806:804 2 2019-01-02 11:32:57 383:848:361 1 [2] row(s) selected. Elapsed time: 0.000 Mach> |
위의 SELECT 결과를 보면 최근에 입력된 데이터가 가장 먼저 표시되는 것을 확인할 수 있다.
또한 _arrival_time 칼럼을 통해 해당 레코드가 입력된 시간이 나노초 단위까지 설정된 것을 알 수 있다.
마크베이스 서버 중단
-s 옵션으로 마크베이스 서버를 종료한다.
Code Block | ||
---|---|---|
| ||
[machbase@localhost machbase_home]$ machadmin -s
-----------------------------------------------------------------
Machbase Administration Tool
Release Version - x.x.x.official
Copyright 2014, MACHBASE Corp. or its subsidiaries
All Rights Reserved
-----------------------------------------------------------------
Waiting for Machbase server shut down...
Machbase server shut down successfully.
[machbase@localhost machbase_home]$ |
데이터베이스 삭제
-d 옵션으로 데이터베이스를 삭제한다.
The above SELECT results show that the most recently input data is displayed first.
Also, it can be seen through the _arrival_time column that the input time of the record is set to the nanosecond.
Stop Machbase Server
Shut down the Machbase server with the -s option.
Delete Database
Delete the database with the -d option.
Warning |
---|
Be very careful because all data will be deleted. |
Code Block | ||
---|---|---|
| ||
[machbase@localhost machbase_home]$ machadmin -d ----------------------------------------------------------------- Machbase Administration Tool Release Version - x.x.x.official Copyright 2014, MACHBASE Corp. or its subsidiaries All Rights Reserved ----------------------------------------------------------------- Destroy Machbase database. Are you sure?(y/N) y Database destoryed successfully. [machbase@localhost machbase_home]$ |