GBase 8a数据库是一款基于Mysql数据库研发的分析型数据库,对Mysql的语法、特性、字段类型基本兼容。
官网地址
选择镜像
1
| docker pull shihd/gbase8a:1.0
|
Kubernetes 部署
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
| kind: StatefulSet apiVersion: apps/v1 metadata: name: gbase namespace: stable-db labels: app: gbase spec: replicas: 1 selector: matchLabels: app: gbase template: metadata: labels: app: gbase spec: containers: - name: gbase image: shihd/gbase8a:1.0 ports: - name: tcp-5258 containerPort: 5258 protocol: TCP resources: limits: cpu: "1" memory: 2Gi ephemeral-storage: 10Gi requests: cpu: "1" memory: 2Gi ephemeral-storage: 10Gi terminationMessagePath: /dev/termination-log terminationMessagePolicy: File imagePullPolicy: IfNotPresent livenessProbe: tcpSocket: port: 5258 initialDelaySeconds: 10 timeoutSeconds: 1 periodSeconds: 10 successThreshold: 1 failureThreshold: 3 readinessProbe: tcpSocket: port: 5258 initialDelaySeconds: 10 timeoutSeconds: 1 periodSeconds: 10 successThreshold: 1 failureThreshold: 3 startupProbe: tcpSocket: port: 5258 initialDelaySeconds: 10 timeoutSeconds: 1 periodSeconds: 10 successThreshold: 1 failureThreshold: 3 --- apiVersion: v1 kind: Service metadata: name: gbase namespace: stable-db annotations: cloud.google.com/l4-rbs: "enabled" labels: app: gbase spec: loadBalancerIP: <your-ip> type: LoadBalancer externalTrafficPolicy: Cluster ports: - port: <your-port> nodePort: <your-port> targetPort: 5258 protocol: TCP selector: app: gbase
|
docker-compose 部署
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| version: '3' services: gaussdb: image: shihd/gbase8a:1.0 container_name: gbase8a restart: always ports: - "5258:5258" volumes: - /data/gbase8a:/home/gbase/GBase/userdata/gbase8a deploy: resources: limits: cpus: '1' memory: 2G reservations: cpus: '1' memory: 2G
|
可以不做持久化挂载,如果不做持久化可以把volumes删掉。
如果需要做持久化:
- 先手动运行容器,
1
| docker run -it -p5258:5258 shihd/gbase8a:1.0
|
- 将数据存储目录复制到宿主机目标目录,
1
| docker cp 914c076670d8:/home/gbase/GBase/userdata/gbase8a/ <宿主机目标目录>
|
- 然后再删除容器启动docker compose即可。
登录到容器内,执行:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| [gbase@e73f4ed825f3 ~]$ gbase -uroot -p Enter password:
GBase client Free Edition 8.6.2.43-R7-free.110605. Copyright (c) 2004-2023, GBase. All Rights Reserved.
gbase> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | performance_schema | | gbase | | gclusterdb | | gctmpdb | +--------------------+ 5 rows in set (Elapsed: 00:00:00.00)
|