一、部署gcdw步骤
1. 修改/opt/gcdw-k8s-9.8.0.4.1/helm/helm_gcdw/chart的配置文件values.yaml,如下:
灰色阴影部分是需要修改的部分,其他可使用默认配置:
# Default values
for gcdw.
# This is a
YAML-formatted file.
# Declare variables
to be passed into your templates.
global:
# images setting
image:
registry: "harbor.gbase.cn" =========>仓库地址
pullPolicy: Always
imagePullSecrets: "" =========>仓库密钥,公有仓库不用填
# Tenant mode for gcdw, true:
multiple-tenant; false: single-tenant
multiTenantMode:
enabled: false ======>是否开启多租户模式,不开启时为单租户模式,开启后为多租户模式
imageRegistry:
server: "" ======>仓库地址
username: "" ======>访问仓库的用户名
password: "" ======>访问仓库的密码
# fdb setting
metadata:
fdb_cluster: "WQSxlF05:Ujlj3egX@10.10.7.75:4500" ======>fdb服务
# persistant storage setting for gcware
storage:
enabled: false
storageClass: ""
storageSize: ""
# logging system setting
logging:
enabled: false
filebeatImage: ""
filebeatOutput:
output.elasticsearch:
hosts:
- ""
username: ""
password: ""
index:
'gcdw-${MY_POD_NAMESPACE}-${MY_POD_NAME}-log-%{+yyyy.MM.dd}'
logrotateImage:
"gcdw/gcdw-logrotate"
# node affinity setting
nodeAffinitySchedule:
cloudServiceAffinity:
key:
cloudService
value: gcdw
coordiantorServiceAffinity:
key: coordinatorService
value: gcdw
warehouseServiceAffinity:
key: warehouseService
value: gcdw
# kerberos setting
kerberos:
enabled: true
# # Namespace label setting
# namespaceLabel:
"Organization=gcdw"
# gcdw operator
values-------------
operator:
enabled: true
image:
repository: gcdw/gcdw-operator
tag: 9.8.0.4.1
replicas: 1
leaderElect: true
resources:
requests:
cpu: 1
memory: 1Gi
limits:
cpu: 2
memory: 2Gi
# gcdw server
values-------------------
server:
image:
repository: gcdw/gcdw-server
tag: 9.8.0.4.1
gcware_replicas: 3 =====>初始部署的gcware个数
coordinator_replicas: 2 ======>初始部署的coor个数
gcware_resource: =====>以下是gcware、coor、warehosue的大小设置,根据具体需要配置
request:
cpu: "1"
mem: "2Gi"
limit:
cpu: "4"
mem: 4Gi
coordinator_resource:
request:
cpu: "2"
mem: 4Gi
limit:
cpu: "4"
mem: 16Gi
warehouse_resource:
request:
cpu: "2"
mem: 4Gi
limit:
cpu: "4"
mem: 16Gi
# gcdw saas
values--------------------
saas:
enabled: true
# set time zone env for saas-backend
TZ: "Asia/Shanghai"
image:
frontend:
repository: gcdw/clound-database-frontend
tag: 9.8.0.4.1
backend:
repository: gcdw/clound-database-backend
tag: 9.8.0.4.1
redis:
repository: gcdw/redis
tag: latest
vsftpd:
repository: gcdw/vsftpd
tag: latest
replicas:
frontend: 1
backend:
1
redis: 1
vsftpd: 1
webServicePort: 32144
=====>前端段口号
2. 创建命名空间
kubectl create ns gcdwtest2
3. 在/opt/gcdw-k8s-9.8.0.4.1/helm/helm_gcdw目录下进行安装
helm install gcdw chart/ -n gcdwtest2
4. 查看命名空间,等待基础服务组件已安装成功后注册租户
[root@liurui-node-2 helm_gcdw]# kubectl get
all -n gcdwtest2
NAME READY STATUS
RESTARTS AGE
pod/gcdw-ftp-0 1/1 Running
0 26s
pod/gcdw-operator-5d6c5857bb-xlx46 1/1
Running 0 28s
pod/gcdw-redis-0 1/1 Running
0 26s
pod/gcdw-saas-backend-0 1/1 Running
0 26s
pod/gcdw-saas-frontend-0 1/1 Running
0 26s
注册租户(前端或后端注册均可以)
前端入口:10.10.7.75:32145(配置文件中设置的端口号)
后端注册的方式:
①进入pod/gcdw-saas-backend-0
kubectl exec -it gcdw-saas-backend-0 -n
gcdwtest -- bash
②注册租户
./account --create -A testaccount -U root -P 111111 -C
gcdw -M 18812345678 -E langzhishuang@gbase.cn -N gcdw
--S3_accessKey=BW2L6QN5JV60R160QGTV
--S3_secretKey=fDY4NtDGh5Mf8zVKD2+w9yeZGZTsDngkExsZihu1 --S3_endPoint=10.10.7.75:9000
--S3_region=minio --S3_bucket=song --comment=test
5. 查看租户是否注册成功
[root@liurui-node-2 helm_gcdw]# kubectl get all -o
wide -n test
NAME READY STATUS
RESTARTS AGE
pod/coordinator-1-0 1/1 Running
0 48m
pod/coordinator-2-0 1/1 Running
0 48m
pod/gcdw-ftp-0 1/1 Running
0 4h23m
pod/gcdw-operator-5d6c5857bb-sr5gf 1/1
Running 0 52m
pod/gcdw-redis-0 1/1 Running
0 4h23m
pod/gcdw-saas-backend-0 1/1 Running
0 4h23m
pod/gcdw-saas-frontend-0 1/1 Running
0 4h23m
pod/gcware-0 1/1 Running
0 48m
pod/gcware-1 1/1 Running
0 48m
pod/gcware-2 1/1 Running
0 48m
进入coordinator-1-0并使用集群:
[root@liurui-node-2 ~]# kubectl exec -it
coordinator-1-0 -n test -- bash
[gbase@coordinator-1-0 /]$ gccli -uroot -p111111
GBase client 9.8.0.4.17ff7898. Copyright (c)
2004-2023, GBase. All Rights Reserved.
gbase> create warehouse wh1;
Query OK, 0 rows affected (Elapsed: 00:00:00.26)
gbase> alter warehouse wh1 resume;
Query OK, 0 rows affected (Elapsed: 00:00:07.78)
gbase> alter user root default_warehouse='wh1';
Query OK, 0 rows affected (Elapsed: 00:00:00.09)
gbase> \q
Bye
租户注册成功且集群能正常使用。
6. 多租户模式需开启values.yaml配置文件中的参数;
multiTenantMode:
enabled: true
该模式下可以注册多个租户,但租户名与命名空间名称不能相同,单租户则要求命名空间要与注册租户名字一致。
注册多个租户(这里注册syl1和syl2作为示例)
(1)注册租户syl1
注册租户(前端或后端注册均可以,前端入口:10.10.55.74:32168,这里展示后端注册的方式)
①进入pod/gcdw-saas-backend-0
kubectl exec -it gcdw-saas-backend-0 -n
test -- bash
②注册租户
./account --create -A syl1 -U root -P 111111 -C gcdw
-M 13042299268 -E songyanling@gbase.cn -N gcdw
--S3_accessKey=BW2L6QN5JV60R160QGTV
--S3_secretKey=fDY4NtDGh5Mf8zVKD2+w9yeZGZTsDngkExsZihu1
--S3_endPoint=10.10.55.36:9000 --S3_region=minio --S3_bucket=song1
--comment=test
(2) 注册租户syl2
①进入pod/gcdw-saas-backend-0
kubectl exec -it gcdw-saas-backend-0 -n
gcdwtest2 -- bash
②注册租户
./account --create -A account1 -U root -P 111111 -C
gcdwtest2 -M 13042299268 -E langzhishuang@gbase.cn -N gcdwtest2
--S3_accessKey=BW2L6QN5JV60R160QGTV
--S3_secretKey=fDY4NtDGh5Mf8zVKD2+w9yeZGZTsDngkExsZihu1 --S3_endPoint=10.10.7.75:9000
--S3_region=minio --S3_bucket=gbase --comment=gcdwtest2
7. 查看syl1和syl2租户是否注册成功
(1)查看syl1租户是否注册成功及集群是否可用
[root@liurui-node-2 helm_gcdw]# kubectl get all -n
syl1
NAME
READY STATUS RESTARTS
AGE
pod/coordinator-1-0
1/1 Running 0
26m
pod/coordinator-2-0
1/1 Running 0
26m
pod/gcware-0
1/1 Running 0
26m
pod/gcware-1
1/1 Running 0
26m
pod/gcware-2
1/1 Running 0
26m
进入coordinator-1-0并使用集群:
[root@liurui-node-2 ~]# kubectl exec -it
coordinator-1-0 -n syl1 -- bash
[gbase@coordinator-1-0 /]$ gccli -uroot -p111111
GBase client 9.8.0.4.17ff7898. Copyright (c)
2004-2023, GBase. All Rights Reserved.
gbase> create warehouse wh1;
Query OK, 0 rows affected (Elapsed: 00:00:00.26)
gbase> alter warehouse wh1 resume;
Query OK, 0 rows affected (Elapsed: 00:00:07.78)
gbase> alter user root default_warehouse='wh1';
Query OK, 0 rows affected (Elapsed: 00:00:00.09)
gbase> \q
Bye
[gbase@coordinator-1-0 /]$ gccli -uroot -p111111
GBase client 9.8.0.4.17ff7898. Copyright (c)
2004-2023, GBase. All Rights Reserved.
gbase> create database test;
Query OK, 1 row affected (Elapsed: 00:00:00.28)
gbase> use test;
Query OK, 0 rows affected (Elapsed: 00:00:00.01)
gbase>
CREATE TABLE lineitem (
-> "l_orderkey" bigint(20) DEFAULT
NULL,
-> "l_partkey" bigint(20) DEFAULT
NULL,
-> "l_suppkey" bigint(20) DEFAULT
NULL,
-> "l_linenumber" bigint(20) DEFAULT
NULL,
-> "l_quantity" decimal(15,2)
DEFAULT NULL,
-> "l_extendedprice" decimal(15,2)
DEFAULT NULL,
-> "l_discount" decimal(15,2) DEFAULT
NULL,
-> "l_tax" decimal(15,2) DEFAULT
NULL,
-> "l_returnflag" char(1) DEFAULT
NULL,
-> "l_linestatus" char(1) DEFAULT
NULL,
-> "l_shipdate" date DEFAULT NULL,
-> "l_commitdate" date DEFAULT NULL,
-> "l_receiptdate" date DEFAULT
NULL,
-> "l_shipinstruct" char(25) DEFAULT
NULL,
-> "l_shipmode" char(10) DEFAULT
NULL,
-> "l_comment" varchar(50) DEFAULT
NULL
-> )
ENGINE=EXPRESS DISTRIBUTED
BY('l_orderkey');
Query OK, 0 rows affected (Elapsed: 00:00:00.10)
gbase> load data infile
'sftp://gbase:gbase@10.10.14.88/opt/lineitem.tbl' into table test.lineitem
fields terminated by '|' ;
Query OK, 6001215 rows affected (Elapsed: 00:00:14.54)
Task 3 finished, Loaded 6001215 records, Skipped 0
records
syl1租户注册成功且集群能正常使用。
(2)查看syl2租户是否注册成功及集群是否可用
[root@liurui-node-2 helm_gcdw]# kubectl get all -n
syl2
NAME
READY STATUS RESTARTS
AGE
pod/coordinator-1-0
1/1 Running 0
77s
pod/coordinator-2-0
1/1 Running 0
76s
pod/gcware-0
1/1 Running 0
77s
pod/gcware-1
1/1 Running 0
77s
pod/gcware-2
1/1 Running 0
77s
进入coordinator-1-0并使用集群:
[root@liurui-node-2 ~]# kubectl exec -it
coordinator-1-0 -n syl2 -- bash
[gbase@coordinator-1-0 /]$ gccli -uroot -p111111
GBase client 9.8.0.4.17ff7898. Copyright (c)
2004-2023, GBase. All Rights Reserved.
gbase> create warehouse wh1;
Query OK, 0 rows affected (Elapsed: 00:00:00.26)
gbase> alter warehouse wh1 resume;
Query OK, 0 rows affected (Elapsed: 00:00:07.78)
gbase> alter user root default_warehouse='wh1';
Query OK, 0 rows affected (Elapsed: 00:00:00.09)
gbase> \q
Bye
[gbase@coordinator-1-0 /]$ gccli -uroot -p111111
GBase client 9.8.0.4.17ff7898. Copyright (c)
2004-2023, GBase. All Rights Reserved.
gbase> create database test;
Query OK, 1 row affected (Elapsed: 00:00:00.28)
gbase> use test;
Query OK, 0 rows affected (Elapsed: 00:00:00.01)
gbase>
CREATE TABLE lineitem (
-> "l_orderkey" bigint(20) DEFAULT
NULL,
-> "l_partkey" bigint(20) DEFAULT
NULL,
-> "l_suppkey" bigint(20) DEFAULT
NULL,
-> "l_linenumber" bigint(20) DEFAULT
NULL,
-> "l_quantity" decimal(15,2)
DEFAULT NULL,
-> "l_extendedprice" decimal(15,2)
DEFAULT NULL,
-> "l_discount" decimal(15,2) DEFAULT
NULL,
-> "l_tax" decimal(15,2) DEFAULT
NULL,
-> "l_returnflag" char(1) DEFAULT
NULL,
-> "l_linestatus" char(1) DEFAULT
NULL,
-> "l_shipdate" date DEFAULT NULL,
-> "l_commitdate" date DEFAULT NULL,
-> "l_receiptdate" date DEFAULT
NULL,
-> "l_shipinstruct" char(25) DEFAULT
NULL,
-> "l_shipmode" char(10) DEFAULT
NULL,
-> "l_comment" varchar(50) DEFAULT
NULL
-> )
ENGINE=EXPRESS DISTRIBUTED
BY('l_orderkey');
Query OK, 0 rows affected (Elapsed: 00:00:00.10)
gbase> load data infile
'sftp://gbase:gbase@10.10.14.88/opt/lineitem.tbl' into table test.lineitem
fields terminated by '|' ;
Query OK, 6001215 rows affected (Elapsed: 00:00:14.54)
Task 3 finished, Loaded 6001215 records, Skipped 0
records
syl2租户注册成功且集群能正常使用。
二、卸载gcdw步骤
1.删除fdb中租户信息
kubectl exec -it 进入到coordinator的pod上执行 accout drop -A租户名
account --drop -A syl1
如果执行account drop -A 租户名命令报错时,先执行:
export GBASE_NOT_CREATE_ACCOUNT_RESOURCE=1
2.执行卸载命令:helm uninstall gcdw -n
3.删除namespace,也可以不删,再次部署时可以继续使用。
删除命名空间:kubectl delete ns test




