天天看點

Docker 搭建 GBase 8s資料庫服務

前置條件

1,Docker服務已經建立

2,足夠的空間(GBase 8s For Docker最少需要2G的空間及1G以上的記憶體)

具體步驟

1,查找GBase 8s 鏡像版本

[[email protected] ~]# docker search gbase8s
NAME                DESCRIPTION             STARS               OFFICIAL            AUTOMATED
liaosnet/gbase8s    GBase8sV8.7_2.0.1a2_2   1                                       
           

2,拉取GBase 8s鏡像

[[email protected] ~]# docker pull liaosnet/gbase8s:2.0.1a2_2
2.0.1a2_2: Pulling from liaosnet/gbase8s
9b4ebb48de8d: Pull complete 
feabbffc73e8: Pull complete 
b361dbaead54: Pull complete 
c84f88b6f6bf: Pull complete 
Digest: sha256:5e84d1b00de967a033facb115d4c3630fcd931b2fb68820eb4662fb52d8f1153
Status: Downloaded newer image for liaosnet/gbase8s:2.0.1a2_2
docker.io/liaosnet/gbase8s:2.0.1a2_2
           

拉取時間可能會有些長,記得配置使用國内鏡像。

3,檢視本地鏡像

[[email protected] ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
liaosnet/gbase8s    2.0.1a2_2           d8f4c547d6ae        10 days ago         986MB
           

上面可以看到我們已經安裝了最新版本2.0.1a2_2版本的GBase 8s鏡像。

4,運作容器

[[email protected] ~]# docker run -itd -p 19088:9088 liaosnet/gbase8s:2.0.1a2_2
           

參數說明:

-p 19088:9088:映射容器服務的 9088端口到主控端的 19088端口,外部主機可以直接通過 主控端ip:19088通路到 GBase 8s的服務。

5,安裝成功

通過docker ps 指令檢視安裝是否成功

[[email protected] ~]# docker ps
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS              PORTS                     NAMES
194b078358cc        liaosnet/gbase8s:2.0.1a2_2   "/bin/sh -c 'su - gb…"   5 seconds ago       Up 3 seconds        0.0.0.0:19088->9088/tcp   strange_poincare
           

進入容器,檢視資料庫狀态

[[email protected] ~]# docker exec -it 194b078358cc bash
[[email protected] /]# su - gbasedbt
[[email protected] ~]$ onstat -g ntt

GBase Database Server Version 12.10.FC4G1AEE -- On-Line -- Up 00:05:12 -- 640264 Kbytes

global network information:
  #netscb connects         read        write    q-free  q-limits  q-exceed alloc/max
   2/   2        0            0            0    0/   0  240/  10    0/   0    0/  -1

Individual thread network information (times):
          netscb thread name    sid     open     read    write address                  
        4dce6b70 soctcplst        3 05:49:33                   0.0.0.0|9088|soctcp      
        4d4e2b70 soctcppoll       2 05:49:33 
        
[[email protected] ~]$ onstat -d

GBase Database Server Version 12.10.FC4G1AEE -- On-Line -- Up 00:06:40 -- 640264 Kbytes

Dbspaces
address          number   flags      fchunk   nchunks  pgsize   flags    owner    name
47149028         1        0x40001    1        1        2048     N  BA    gbasedbt rootdbs
58834d98         2        0x40001    2        1        2048     N  BA    gbasedbt datadbs01
 2 active, 2047 maximum

Chunks
address          chunk/dbs     offset     size       free       bpages     flags pathname
47149258         1      1      0          128000     43039                 PO-B-D /opt/gbase/data/rootchk
589c1028         2      2      0          16000      14041                 PO-BED /opt/gbase/data/datachk01
 2 active, 32766 maximum

NOTE: The values in the "size" and "free" columns for DBspace chunks are
      displayed in terms of "pgsize" of the DBspace to which they belong.


Expanded chunk capacity mode: always