一、GBase简介
GBase 是南大通用数据技术有限公司推出的自主品牌的数据库产品,在国内数据库市场具有较高的品牌知名度。
二、下载地址(需要先注册账号)
https://www.gbase.cn/download/gbase-8a?category=INSTALL_PACKAGE
三、环境
服务器 | 192.168.**.175(主节点) 192.168.**.174 |
数据库版本 | GBase8a_MPP_Cluster-License-9.5.3.14-redhat7.3-x86_64.tar.bz2 |
四、安装
4.1 上传压缩包
把压缩包上传至175节点的/opt目录下
4.2 创建用户
所有节点(175、174)新建gbase用户,同时创建安装目录并授权,并切换到gbase用户下
[root@vertica ~]# useradd gbase
[root@vertica ~]# passwd gbase
[root@vertica ~]# mkdir -p /opt/gbase
[root@vertica ~]# chown gbase:gbase /opt/gbase
su gbase
4.3 解压
在主节点(175)执行解压命令
tar xjf GBase8a_MPP_Cluster-License-9.5.3.14-redhat7.3-x86_64.tar.bz2
解压完成后,opt 下生成 gcinstall 安装目录。
4.4 配置环境
把主节点的文件,在所有节点(175/174)运行SetSysEnv.py脚本配置安装环境
[gbase@vertica ~]# scp root@192.168.20.175:/opt/gcinstall/SetSysEnv.py /opt
4.5 修改安装配置文件
修改主节点的安装配置文件/opt/gcinstall/demo.options,内容如下
# 安装目录
installPrefix= /opt/gbase
# 管理节点
coordinateHost = 192.168.20.175,192.168.20.174
# 管理节点ID标识
coordinateHostNodeID = 175,174
# 数据节点
dataHost = 192.168.20.175,192.168.20.174
#existCoordinateHost =
#existDataHost =
gcwareHost = 192.168.20.175,192.168.20.174
#gcwareHostNodeID = 234,235,237
# 用户
dbaUser = gbase
dbaGroup = gbase
# 用户密码
dbaPwd = 'gbase'
# 操作系统的root账户的密码,明文
rootPwd = 'root1234'
# 操作系统的root账户的密码,存储在文件中
#rootPwdFile = rootPwd.json
# 设置完成后,保存退出
4.6 安装
主节点(175)进入/opt/gcinstall目录下,执行安装命令
./gcinstall.py --silent=demo.options
使用exit退出当前用户,再重新切换到gbase用户,并使用gcadmin查看集群状态
[gbase@node5 opt]$ exit
exit
[root@node5 opt]# su gbase
[gbase@node5 opt]$ gcadmin
CLUSTER STATE: ACTIVE
VIRTUAL CLUSTER MODE: NORMAL
======================================
| GBASE GCWARE CLUSTER INFORMATION |
======================================
| NodeName | IpAddress | gcware |
--------------------------------------
| gcware1 | 192.168.20.174 | OPEN |
--------------------------------------
| gcware2 | 192.168.20.175 | OPEN |
--------------------------------------
========================================================
| GBASE COORDINATOR CLUSTER INFORMATION |
========================================================
| NodeName | IpAddress | gcluster | DataState |
--------------------------------------------------------
| coordinator1 | 192.168.20.175 | CLOSED | 0 |
--------------------------------------------------------
| coordinator2 | 192.168.20.174 | CLOSED | 0 |
--------------------------------------------------------
=========================================================================================================
| GBASE DATA CLUSTER INFORMATION |
=========================================================================================================
| NodeName | IpAddress | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
| node1 | 192.168.20.175 | 1 | CLOSED | OPEN | 0 |
---------------------------------------------------------------------------------------------------------
| node2 | 192.168.20.174 | 1 | CLOSED | OPEN | 0 |
---------------------------------------------------------------------------------------------------------
发现gcluster 和 gnode 服务都为CLOSE状态,ctrl+z停止
4.7 检查license
进入/opt/gcinstall目录下检查license,发现都是no
[gbase@node5 opt]$ cd gcinstall/
[gbase@node5 gcinstall]$ ./chkLicense -n 192.168.20.175,192.168.20.174 -u gbase -p gbase
======================================================================
192.168.20.175
is_exist:no
======================================================================
192.168.20.174
is_exist:no
4.8 申请license
4.8.1 生成指纹文件
先获取所有节点的指纹信息,在gbase用户/opt/gcinstall目录下,会生成License_2024_01_26.txt的文件(9.5.3.27版本之后是./getesn.py --silent=demo.options --passwordInputMod=pwdsame > License_2024_01_26.txt)
./gethostsid -n 192.168.20.175,192.168.20.174 -u root -p root1234 -f License_2024_01_26.txt
4.8.2 发邮件
带上上面生成的License_2024_01_26.txt给partner@gbase.cn
你好,为适配公司环境对Gbase数据库的适配,现向贵公司申请GBbase 8a的试用license
公司名称:XXXXXXXX
申请用途:XXXXXXXX
安装包名称:GBase8a_MPP_Cluster-License-9.5.3.14-redhat7.3-x86_64.tar.bz2
指纹文件:见附件License_2024_01_26.txt
谢谢!
他们会返回一个mpp.lic文件
4.9 执行license文件
把mpp.lic文件上传到主节点(175)的/opt目录下,并导入LICENSE文件(如果没有权限,可以切换root用户进行处理)
./License -n 192.168.20.175,192.168.20.174 -f /opt/mpp.lic -u gbase -p gbase
再次查看license
[gbase@node5 gcinstall]$ ./chkLicense -n 192.168.20.175,192.168.20.174 -u gbase -p gbase
======================================================================
192.168.20.175
is_exist:yes
version:trial
expire_time:20240429
is_valid:yes
======================================================================
192.168.20.174
is_exist:yes
version:trial
expire_time:20240429
is_valid:yes
[gbase@node5 gcinstall]$
4.10 启动
在所有节点(175/174),启动集群服务
su - gbase
gcluster_services all start
gcadmin
[gbase@node5 gcinstall]$ gcadmin
CLUSTER STATE: ACTIVE
VIRTUAL CLUSTER MODE: NORMAL
======================================
| GBASE GCWARE CLUSTER INFORMATION |
======================================
| NodeName | IpAddress | gcware |
--------------------------------------
| gcware1 | 192.168.20.174 | OPEN |
--------------------------------------
| gcware2 | 192.168.20.175 | OPEN |
--------------------------------------
========================================================
| GBASE COORDINATOR CLUSTER INFORMATION |
========================================================
| NodeName | IpAddress | gcluster | DataState |
--------------------------------------------------------
| coordinator1 | 192.168.20.175 | OPEN | 0 |
--------------------------------------------------------
| coordinator2 | 192.168.20.174 | OPEN | 0 |
--------------------------------------------------------
=========================================================================================================
| GBASE DATA CLUSTER INFORMATION |
=========================================================================================================
| NodeName | IpAddress | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
| node1 | 192.168.20.175 | 1 | OPEN | OPEN | 0 |
---------------------------------------------------------------------------------------------------------
| node2 | 192.168.20.174 | 1 | OPEN | OPEN | 0 |
---------------------------------------------------------------------------------------------------------
4.11 设置分片信息
gcadmin distribution gcChangeInfo.xml p 1 d 0 pattern 1
4.12 初始化
切换到数据库 默认用户名root,密码为空,并进行初始化
[gbase@node5 gcinstall]$ gccli -u root -p
Enter password:
GBase client 9.5.3.14.121230. Copyright (c) 2004-2024, GBase. All Rights Reserved.
gbase> initnodedatamap;
4.13 简单使用gbase
4.13.1 创建数据库
创建数据库
-- 创建数据库
CREATE DATABASE EASYBI;
-- 创建用户
CREATE USER 'EASYBI'@'%' IDENTIFIED BY 'EASYBI';
-- 给用户授权
GRANT ALL PRIVILEGES ON EASYBI.* TO 'EASYBI'@'%';
-- 刷新权限
FLUSH PRIVILEGES;
4.13.2 新建表语句
show tables from EASYBI;
CONNECT EASYBI;
CREATE TABLE T_USER(NAME varchar(255) , AGE int);
INSERT INTO T_USER VALUES ('小兔子',18);
五、客户端连接(DBeaver)
5.1 下载驱动,下载地址见章节二
5.2 新建驱动
5.3 新建数据库连接
六、遇到问题
由于服务器上,安装过es的集群,导致第一次设置分片信息的时候报错,把datanodes都关了,gcadmin查看如图
解决方案:执行gcadmin addnodes gcChangeInfo.xml即可
七、参考文档
https://www.modb.pro/db/616028
DBeaver连接GBase数据库-CSDN博客