2014년 10월 10일 금요일

SUNDB Install Guide for Linux


1. OS버젼 확인

1.1. Linux Kernel 버전 확인


[kevin@cheroky ~]$ uname -a
Linux cheroky.sunje.co.kr 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux



1.2. Linux OS 버전 확인


[sundb@cheroky ~]$ cat /etc/issue
CentOS release 6.5 (Final)
Kernel \r on an \m

[sundb@cheroky ~]$ getconf LONG_BIT
64
[sundb@cheroky ~]$



2. 시스템 설정

2.1. root 계정으로 변경


[kevin@cheroky ~]$ su - root
Password:
[root@cheroky ~]# id
uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[root@cheroky ~]#



2.2. /etc/sysctl.conf 의 설정


[root@cheroky ~]# vi /etc/sysctl.conf



2.2.1. sysctl.conf 파일의 편집


# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128



2.2.1.1. example


shared memory 관련 설정

sudo vi /etc/sysctl.conf해서 아래를 붙여 넣는다.
fs.file-max = 65536
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

sudo sysctl -p로 적용
Reliability test를 위해서는 공유 메모리 세그먼트 크기를 30G 이상으로 설정해야 한다.
kernel.shmall = 8388608
kernel.shmmax = 34359738368



2.2.2. sysctl.conf 파일의 반영


[root@cheroky ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
fs.file-max = 65536
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
kernel.core_pattern = %e.%p.core
[root@cheroky ~]#



2.2.3. 시스템 설정 확인


[root@cheroky ~]# ipcs -l

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 67108864
max total shared memory (kbytes) = 17179869184
min seg size (bytes) = 1

------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 100
semaphore max value = 32767

------ Messages: Limits --------
max queues system wide = 3754
max size of message (bytes) = 65536
default max size of queue (bytes) = 65536

[root@cheroky ~]#



3. 설치

3.1 root Login


[root@symphony ~]# id
uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[root@symphony ~]#



3.2 database를 설치할 account 생성

[root@symphony home]# useradd qcubic



3.3 생성된 계정의 password 변경

[root@symphony ~]# passwd qcubic
Changing password for user qcubic.
New password:
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@symphony ~]#



3.4 생성한 계정으로 Login

[root@symphony ~]# su - qcubic
[qcubic@symphony ~]$



3.5 qcubic 계정의 .bash_profile에 아래의 내용 추가

[qcubic@symphony ~]$ vi ~/.bash_profile

#######################################
# QCUBIC MERCURY [2014-10-21]
#######################################

export SUNDB_HOME=/home/qcubic/sundb/sundb_mercury/sundb_home
export SUNDB_DATA=/home/qcubic/sundb/sundb_mercury/sundb_data

export LANG=zh_CN.utf8
export PATH=$SUNDB_HOME/bin:$PATH
export LD_LIBRARY_PATH=$SUNDB_HOME/lib:$LD_LIBRARY_PATH




3.6 .profile 적용하기

[qcubic@symphony ~]$ . .bash_profile
[qcubic@symphony ~]$ echo $SUNDB_HOME
/home/qcubic/sundb/sundb_mercury/sundb_home
[qcubic@symphony ~]$ echo $SUNDB_DATA
/home/qcubic/sundb/sundb_mercury/sundb_data
[qcubic@symphony ~]$ echo $LANG
zh_CN.utf8



3.7 character set 찾기

[qcubic@symphony ~]$ locale -a | grep utf8



3.8 설치할 디렉토리 생성


[qcubic@symphony ~]$ pwd
/home/qcubic
[qcubic@symphony ~]$ mkdir -p sundb/sundb_mercury/product
[qcubic@symphony product]$ pwd
/home/qcubic/sundb/sundb_mercury/product



3.9 설치 파일 복사 (현재의 디렉토리에 설치파일을 복사)

[qcubic@symphony product]$ pwd
/home/qcubic/sundb/sundb_mercury/product
[qcubic@symphony product]$ ls -la
total 35076
drwxrwxr-x. 2 qcubic qcubic 4096 Oct 21 14:38 .
drwxrwxr-x. 3 qcubic qcubic 4096 Oct 21 14:36 ..
-rwxr-xr-x. 1 qcubic qcubic 35909270 Oct 21 14:38 qcubic-server-mercury.2.1.3-linux-x86_64.tar.gz
[qcubic@symphony product]$



3.10 압축 해제 (이 작업은 아래의 디렉토리에서 수행)

[qcubic@symphony product]$ cd ..
[qcubic@symphony sundb_mercury]$ pwd
/home/qcubic/sundb/sundb_mercury
[qcubic@symphony sundb_mercury]$ tar -zxvf product/qcubic-server-mercury.2.1.3-linux-x86_64.tar.gz
qcubic-server-mercury.2.1.3-linux-x86_64/sundb_data/wal/README
qcubic-server-mercury.2.1.3-linux-x86_64/sundb_data/archive_log/README
qcubic-server-mercury.2.1.3-linux-x86_64/sundb_data/trc/README
qcubic-server-mercury.2.1.3-linux-x86_64/sundb_data/backup/README
qcubic-server-mercury.2.1.3-linux-x86_64/sundb_data/db/README
qcubic-server-mercury.2.1.3-linux-x86_64/sundb_data/conf/sundb.listener.conf
...
qcubic-server-mercury.2.1.3-linux-x86_64/sundb_home/include/sundbxa.h
qcubic-server-mercury.2.1.3-linux-x86_64/sundb_home/include/sundbesql.h
qcubic-server-mercury.2.1.3-linux-x86_64/sundb_home/include/README
[qcubic@symphony sundb_mercury]$

[qcubic@symphony sundb_mercury]$ ls -la
total 16
drwxrwxr-x. 4 qcubic qcubic 4096 Oct 21 14:42 .
drwxrwxr-x. 3 qcubic qcubic 4096 Oct 21 14:35 ..
drwxrwxr-x. 2 qcubic qcubic 4096 Oct 21 14:38 product
drwxrwxr-x. 4 qcubic qcubic 4096 Oct 21 14:42 qcubic-server-mercury.2.1.3-linux-x86_64
[qcubic@symphony sundb_mercury]$



3.11 link생성

[qcubic@symphony sundb_mercury]$
[qcubic@symphony sundb_mercury]$ ln -s /home/qcubic/sundb/sundb_mercury/qcubic-server-mercury.2.1.3-linux-x86_64/sundb_home sundb_home
[qcubic@symphony sundb_mercury]$ ln -s /home/qcubic/sundb/sundb_mercury/qcubic-server-mercury.2.1.3-linux-x86_64/sundb_data sundb_data
[qcubic@symphony sundb_mercury]$ ls -la
total 24
drwxrwxr-x. 4 qcubic qcubic 4096 Oct 21 14:43 .
drwxrwxr-x. 3 qcubic qcubic 4096 Oct 21 14:35 ..
drwxrwxr-x. 2 qcubic qcubic 4096 Oct 21 14:38 product
drwxrwxr-x. 4 qcubic qcubic 4096 Oct 21 14:42 qcubic-server-mercury.2.1.3-linux-x86_64
lrwxrwxrwx. 1 qcubic qcubic 84 Oct 21 14:43 sundb_data -> /home/qcubic/sundb/sundb_mercury/qcubic-server-mercury.2.1.3-linux-x86_64/sundb_data
lrwxrwxrwx. 1 qcubic qcubic 84 Oct 21 14:43 sundb_home -> /home/qcubic/sundb/sundb_mercury/qcubic-server-mercury.2.1.3-linux-x86_64/sundb_home
[qcubic@symphony sundb_mercury]$



3.12 database 생성하기 (gcreatedb를 사용하여 생성)

[qcubic@symphony ~]$ cd $SUNDB_HOME/bin
[qcubic@symphony bin]$ pwd
/home/qcubic/sundb/sundb_mercury/sundb_home/bin
[qcubic@symphony bin]$ ll
TOTAL 60552
-rwxr-xr-x. 1 qcubic qcubic 7737180 10月 17 16:40 cyclone
-rwxr-xr-x. 1 qcubic qcubic 2545607 10月 17 16:40 cyclonet
-rwxr-xr-x. 1 qcubic qcubic 2341570 10月 17 16:39 cymon
-rwxr-xr-x. 1 qcubic qcubic 6683679 10月 17 16:40 gcreatedb
-rwxr-xr-x. 1 qcubic qcubic 3026571 10月 17 16:38 gdump
-rwxr-xr-x. 1 qcubic qcubic 7616710 10月 17 16:40 gloader
-rwxr-xr-x. 1 qcubic qcubic 2435658 10月 17 16:40 gloadernet
-rwxr-xr-x. 1 qcubic qcubic 171156 10月 17 16:38 glsnr
-rwxr-xr-x. 1 qcubic qcubic 6825693 10月 17 16:40 gmaster
-rwxr-xr-x. 1 qcubic qcubic 1993441 10月 17 16:40 gpec
-rwxr-xr-x. 1 qcubic qcubic 7014252 10月 17 16:40 gserver
-rwxr-xr-x. 1 qcubic qcubic 8173423 10月 17 16:40 gsql
-rwxr-xr-x. 1 qcubic qcubic 2985406 10月 17 16:40 gsqlnet
-rwxr-xr-x. 1 qcubic qcubic 2430589 10月 17 16:40 logmirror
-rw-r--r--. 1 qcubic qcubic 24 10月 17 14:19 README
[qcubic@symphony bin]$
[qcubic@symphony bin]$
[qcubic@symphony bin]$ gcreatedb --db_name="sundb" --db_comment="sundb database" --timezone="+09:00" --character_set="UTF8" --char_length_units="OCTETS"

 Copyright (c) 2010, 2014, SUNJESOFT Inc. All rights reserved.
 Release Mercury.2.1.3 revision(13760)

Database created

[qcubic@symphony bin]$



3.13 license 설정 (license 디렉토리에 license라는 파일에 설정)

[qcubic@symphony license]$ ll
TOTAL 8
-rw-rw-r--. 1 qcubic qcubic 129 10月 21 14:54 license
-rw-r--r--. 1 qcubic qcubic 13 10月 17 14:19 README


// license 확인
[qcubic@symphony license]$ cat license
8C32285ECE8D2048A5E3C0EC45D6EC71D7AAC85ECE8D2048A5E38D2048A5E3
[qcubic@symphony license]$



3.14 database 시작

[qcubic@symphony license]$ cd
[qcubic@symphony ~]$ gsql --as sysdba

 Copyright (c) 2010, 2014, SUNJESOFT Inc. All rights reserved.
 Release Mercury.2.1.3 revision(13760)

Connected to an idle instance.

gSQL> \startup

Startup success

gSQL>
gSQL> select * from catalog_name;

CATALOG_ID CATALOG_NAME CHARACTER_SET_ID CHARACTER_SET_NAME CHAR_LENGTH_UNITS_ID
---------- ------------ ---------------- ------------------ --------------------
CHAR_LENGTH_UNITS TIME_ZONE_INTERVAL DEFAULT_DATA_TABLESPACE_ID
----------------- ------------------ --------------------------
DEFAULT_TEMP_TABLESPACE_ID CREATED_TIME MODIFIED_TIME
-------------------------- -------------------------- --------------------------
COMMENTS
--------------
1 sundb 1 UTF8 2
OCTETS +00 09:00:00 2
3 2014-10-21 14:51:07.670000 2014-10-21 14:51:07.670000
sundb database

1 row selected.


gSQL>