Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

사용자 생성

마크베이스 설치 및 사용을 위한 리눅스 사용자

Create User


Create a Linux user 'machbase' 를 생성한다for installing and using  Machbase.

Code Block
languagebash
sudo useradd machbase

패스워드를 설정한 다음, machbase 계정으로 접속한다.

패키지 설치

machbase_home 이라는 디렉터리를 생성하고, 마크베이스 다운로드 사이트에서 패키지를 다운로드 받아서 설치한다After setting the password,  log in as 'machbase' account.


Package Installation


Create a directory called 'macbase_home' and download and install the package from the Machbase download site.

Code Block
languagebash
[machbase@localhost ~]$ wget http://www.machbase.com/dist/machbase-fog-x.x.x.official-LINUX-X86-64-release.tgz
[machbase@localhost ~]$ mkdir machbase_home
[machbase@localhost ~]$ mv machbase-fog-x.x.x.official-LINUX-X86-64-release.tgz machbase_home/
[machbase@localhost ~]$ cd machbase_home/
[machbase@localhost machbase_home]$ tar zxf machbase-fog-x.x.x.official-LINUX-X86-64-release.tgz

[machbase@loclahost machbase_home]$ ls -l
drwxrwxr-x  5 machbase machbase        64 Oct 30 16:10 3rd-party
drwxrwxr-x  2 machbase machbase      4096 Oct 30 16:10 bin
drwxrwxr-x  6 machbase machbase       189 Dec 21 14:04 collector
drwxrwxr-x  2 machbase machbase       306 Jan  2 11:36 conf
drwxrwxr-x  2 machbase machbase       136 Jan  2 11:37 dbs
drwxrwxr-x  3 machbase machbase        22 Oct 30 16:10 doc
drwxrwxr-x  2 machbase machbase        96 Oct 30 16:10 include
drwxrwxr-x  2 machbase machbase        29 Oct 30 16:10 install
drwxrwxr-x  2 machbase machbase       283 Oct 30 16:10 lib
-rw-rw-r--  1 machbase machbase 139888377 Dec 20 11:33 machbase-fog-x.x.x.official-LINUX-X86-64-release.tgz
drwxrwxr-x  2 machbase machbase        22 Dec 21 15:43 msg

drwxrwxr-x  2 machbase machbase         6 Oct 30 16:10 package
drwxrwxr-x 12 machbase machbase       140 Oct 30 16:10 sample
drwxrwxr-x  2 machbase machbase      4096 Jan  2 09:37 trc
drwxrwxr-x 10 machbase machbase       160 Oct 30 16:10 tutorials
drwxrwxr-x  3 machbase machbase        19 Oct 30 16:10 webadmin

[machbase@loclahost machbase_home]$




Table of Contents

설치된 디렉터리 설명은 다음과 같다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

includeCLI 프로그램을 위한 각종 헤더 파일들
installMakefile을 위한 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-partygrafana 연동 파일들

환경변수 설정

.bashrc 파일에 마크베이스 관련 환경 변수를 추가한다

Grafana plug-in files


Set Environment Variable


Add Machbase-related environment variables to your .bashrc file.

Code Block
languagebash
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
languagebash
[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
languagebash
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
languagebash
[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
languagebash
[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
languagebash
[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
languagebash
[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
languagebash
[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
languagesql
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
languagesql
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
languagebash
[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 옵션으로 데이터베이스를 삭제한다.

Warning모든 데이터가 삭제되므로 매우 주의해서 사용해야 한다

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
languagebash
[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]$