GBase 8a 学习笔记 002 —— GBase 8a MPP Cluster 安装
环境准备
节点环境
IP | 角色 | OS | hostID |
---|---|---|---|
192.168.254.138 | 管理、数据、主节点 | CentOS7 | node138 |
192.168.254.139 | 管理、数据节点 | CentOS7 | node139 |
192.168.254.140 | 管理、数据节点 | CentOS7 | node140 |
操作系统环境
[root@192 ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@192 ~]#
[root@192 ~]# cat /proc/version
Linux version 3.10.0-1160.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) ) #1 SMP Mon Oct 19 16:18:59 UTC 2020
[root@192 ~]#
# 检查所有节点 selinux 服务是否禁用
[root@192 ~]# sestatus
SELinux status: disabled
[root@192 ~]#
# 检查所有节点防火墙是否关闭
[root@192 ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
[root@192 ~]#
安装包
将下载的安装包 GBase8a_MPP_Cluster-License-9.5.2.39-redhat7.3-x86_64.tar.bz2 上传到 node138节点的:/opt 下。
其他
- 虚拟机:VMware Workstation
- SSH工具:MobaXterm
集群安装
在集群所有的节点上创建DBA用户
[root@192 opt]# useradd gbase [root@192 opt]# passwd gbase 更改用户 gbase 的密码 。 新的 密码: 无效的密码: 密码少于 8 个字符 重新输入新的 密码: passwd:所有的身份验证令牌已经成功更新。 [root@192 opt]#
设置gbase账户密码为gbase
在集群所有节点上创建安装目录并授权
需要将GBase 8a 安装在 /opt/gbase 下
# 创建安装目录
[root@192 opt]# mkdir -p /opt/gbase
# 授权
[root@192 opt]# chown gbase:gbase /opt/gbase
# 查看权限
[root@192 opt]# ll
总用量 137176
drwxr-xr-x 2 gbase gbase 6 2月 23 23:01 gbase
-rw-r--r-- 1 root root 140464404 2月 23 22:46 GBase8a_MPP_Cluster-License-9.5.2.39-redhat7.3-x86_64.tar.bz2
drwxr-xr-x. 2 root root 6 10月 31 2018 rh
[root@192 opt]#
解压安装包
在主节点 node138 执行
[root@192 opt]# pwd /opt [root@192 opt]# tar xfj GBase8a_MPP_Cluster-License-9.5.2.39-redhat7.3-x86_64.tar.bz2 [root@192 opt]# ls gbase GBase8a_MPP_Cluster-License-9.5.2.39-redhat7.3-x86_64.tar.bz2 gcinstall rh
解压完成后,opt 下生成 gcinstall 安装目录。
设置环境变量
SetSysEnv.py 文件
在所有节点复制主节点的环境设置脚本(SetSysEnv.py)至从节点
[root@192 opt]# scp root@192.168.254.138:/opt/gcinstall/SetSysEnv.py /opt The authenticity of host '192.168.254.138 (192.168.254.138)' can't be established. ECDSA key fingerprint is SHA256:e7rUiN2ArTeZSfsx3CydZShUXa0bJVEbbqaBe3hW45U. ECDSA key fingerprint is MD5:cf:3d:c5:e8:ec:ae:c1:6b:2a:48:5f:7a:b9:29:ec:95. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.254.138' (ECDSA) to the list of known hosts. root@192.168.254.138's password: SetSysEnv.py 100% 27KB 24.0MB/s 00:00 [root@192 opt]# ls gbase GBase8a_MPP_Cluster-License-9.5.2.39-redhat7.3-x86_64.tar.bz2 gcinstall rh SetSysEnv.py [root@192 opt]#
在所有节点运行SetSysEnv.py脚本配置安装环境
[root@192 opt]# python SetSysEnv.py --dbaUser=gbase --installPrefix=/opt/gbase --cgroup [root@192 opt]#
修改主节点的安装配置文件
demo.options
node173节点执行
[root@192 opt]# su - gbase 上一次登录:四 2月 23 23:18:29 CST 2023pts/0 上 [gbase@192 ~]$ cd /opt/gcinstall/ [gbase@192 gcinstall]$ vi demo.options
# 安装目录
installPrefix= /opt/gbase
# 管理节点
coordinateHost = 192.168.254.138,192.168.254.139,192.168.254.140
# 管理节点ID标识
coordinateHostNodeID = 138,139,140
# 数据节点
dataHost = 192.168.254.138,192.168.254.139,192.168.254.140
#existCoordinateHost =
#existDataHost =
# 用户
dbaUser = gbase
dbaGroup = gbase
# 用户密码
dbaPwd = 'gbase'
# 操作系统的root账户的密码,明文
rootPwd = '20230222'
# 操作系统的root账户的密码,存储在文件中
#rootPwdFile = rootPwd.json
# 设置完成后,保存退出
执行安装脚本
node173节点执行
[gbase@192 gcinstall]$ ./gcinstall.py --silent=demo.options
# 安装过程可能会出现如下警告,操作系统没cgroup(资源管理)组件,输入 Y 回车
Environmental Checking on gcluster nodes.
Cgconfig service is not exist on host ['192.168.254.138','192.168.254.139','192.168.254.140'],resource manangement can not be used,continue([Y,y]/[N,n])?
在所有节点安装成功后,会发现gcluster启动失败,gcadmin会提示未找到命令……
重新登录gbase即可
[gbase@192 gcinstall]$ exit 登出 [root@192 opt]# su - gbase 上一次登录:四 2月 23 23:36:53 CST 2023从 192.168.254.138pts/4 上 [gbase@192 ~]$ gcadmin CLUSTER STATE: ACTIVE ================================================================== | GBASE COORDINATOR CLUSTER INFORMATION | ================================================================== | NodeName | IpAddress | gcware | gcluster | DataState | ------------------------------------------------------------------ | coordinator1 | 192.168.254.138 | OPEN | CLOSE | 0 | ------------------------------------------------------------------ | coordinator2 | 192.168.254.139 | OPEN | CLOSE | 0 | ------------------------------------------------------------------ | coordinator3 | 192.168.254.140 | OPEN | CLOSE | 0 | ------------------------------------------------------------------ ================================================================ | GBASE CLUSTER FREE DATA NODE INFORMATION | ================================================================ | NodeName | IpAddress | gnode | syncserver | DataState | ---------------------------------------------------------------- | FreeNode1 | 192.168.254.138 | CLOSE | OPEN | 0 | ---------------------------------------------------------------- | FreeNode2 | 192.168.254.139 | CLOSE | OPEN | 0 | ---------------------------------------------------------------- | FreeNode3 | 192.168.254.140 | CLOSE | OPEN | 0 | ---------------------------------------------------------------- 0 virtual cluster 3 coordinator node 3 free data node [gbase@192 ~]$
查看集群状态,发现gcluster 和 gnode 服务都为CLOSE状态,这是因为没有注册授权的原因。
没有license
检查授权
[gbase@192 gcinstall]$ pwd /opt/gcinstall [gbase@192 gcinstall]$ ./chkLicense -n 192.168.254.138,192.168.254.139,192.168.254.140 -u gbase -p gbase ====================================================================== 192.168.254.140 is_exist:no ====================================================================== 192.168.254.139 is_exist:no ====================================================================== 192.168.254.138 is_exist:no [gbase@192 gcinstall]$
申请授权
获取所有节点指纹信息
[gbase@192 gcinstall]$ ./gethostsid -n 192.168.254.138,192.168.254.139,192.168.254.140 -u root -p 20230222 -f /tmp/finger.txt ====================================================================== Successful node nums: 3 ====================================================================== [gbase@192 gcinstall]$ ls 192.168.254.138.options bundle.tar.bz2 CorosyncConf.py FileCheck.py gccopy.py gcwareGroup.json InstallFuns.pyc pexpect.pyc rmt.py SSHThread.pyc 192.168.254.139.options CGConfigChecker.py demo.options FileCheck.pyc gcexec.py gethostsid InstallTar.py replace.py rmt.pyc unInstall_fulltext.py 192.168.254.140.options CGConfigChecker.pyc dependRpms fulltext.py gcgenfinger GetOSType.py License replaceStop.py rootPwd.json unInstall.py BUILDINFO chkLicense example.xml gbase_data_timezone.sql gcinstall.log importLicense license.txt RestoreLocal.py SetSysEnv.py unInstall.pyc bundle_data.tar.bz2 cluster.conf extendCfg.xml gcChangeInfo.xml gcinstall.py InstallFuns.py pexpect.py Restore.py SSHThread.py vclink.xml [gbase@192 gcinstall]$ cat /tmp/finger.txt {"HWADDR":"00:0C:29:76:DC:01,52:54:00:D1:08:EC,52:54:00:D1:08:EC","SOCKETS":2,"ARCHITECTURE":"x86_64","BYTE ORDER":"Little Endian","MODEL":"158","THREADS":2,"CPUS":2,"NNNODES":1,"CONFUSE DATA":"61kzi!T4I47KDXl"} {"HWADDR":"00:0C:29:64:CC:32,52:54:00:40:8D:C1,52:54:00:40:8D:C1","SOCKETS":2,"ARCHITECTURE":"x86_64","BYTE ORDER":"Little Endian","MODEL":"158","THREADS":2,"CPUS":2,"NNNODES":1,"CONFUSE DATA":"IovP#Ku64d6I&7:"} {"HWADDR":"00:0C:29:29:A4:A3,52:54:00:AE:1B:90,52:54:00:AE:1B:90","SOCKETS":2,"ARCHITECTURE":"x86_64","BYTE ORDER":"Little Endian","MODEL":"158","THREADS":2,"CPUS":2,"NNNODES":1,"CONFUSE DATA":"61kzi!T4I47KDXl"} [gbase@192 gcinstall]$
获取license后,导入和检查授权
[gbase@192 gcinstall]$ pwd
/opt/gcinstall
# 导入授权
[gbase@192 gcinstall]$ ./License -n 192.168.254.138,192.168.254.139,192.168.254.140 -f /opt/20230224-04.lic -u gbase -p gbase
======================================================================
Successful node nums: 3
======================================================================
# 检查授权
[gbase@192 gcinstall]$ ./chkLicense -n 192.168.254.138,192.168.254.139,192.168.254.140 -u gbase -p gbase
======================================================================
192.168.254.140
is_exist:yes
version:trial
expire_time:20230524
is_valid:yes
======================================================================
192.168.254.139
is_exist:yes
version:trial
expire_time:20230524
is_valid:yes
======================================================================
192.168.254.138
is_exist:yes
version:trial
expire_time:20230524
is_valid:yes
[gbase@192 gcinstall]$
License 状态说明:
- is_exist 用于标识 license 文件是否存在: yes 代表存在,no 代表不存在;
- version 用于标识 license 类型: trial 为试用版, business 为商用版;
- expire_time 用于标识试用版 license 的到期日期,只在检测试用版license 时才会显示;
- is_valid 用于标识 license 是否有效: yes 代表 license 有效,no代表 license 失效;
在集群所有节点上启动全部集群服务
> 在所有节点执行
[root@192 opt]# su - gbase 上一次登录:五 2月 24 21:34:14 CST 2023pts/0 上 [gbase@192 ~]$ gcluster_services all start Starting gcware : [ OK ] Starting gcluster : [ OK ] Starting gcrecover : [ OK ] Starting gbase : [ OK ] Starting syncserver : [ OK ] Starting GCMonit success! [gbase@192 ~]$ gcadmin CLUSTER STATE: ACTIVE ================================================================== | GBASE COORDINATOR CLUSTER INFORMATION | ================================================================== | NodeName | IpAddress | gcware | gcluster | DataState | ------------------------------------------------------------------ | coordinator1 | 192.168.254.138 | OPEN | CLOSE | 0 | ------------------------------------------------------------------ | coordinator2 | 192.168.254.139 | OPEN | CLOSE | 0 | ------------------------------------------------------------------ | coordinator3 | 192.168.254.140 | OPEN | CLOSE | 0 | ------------------------------------------------------------------ ================================================================ | GBASE CLUSTER FREE DATA NODE INFORMATION | ================================================================ | NodeName | IpAddress | gnode | syncserver | DataState | ---------------------------------------------------------------- | FreeNode1 | 192.168.254.138 | CLOSE | OPEN | 0 | ---------------------------------------------------------------- | FreeNode2 | 192.168.254.139 | CLOSE | OPEN | 0 | ---------------------------------------------------------------- | FreeNode3 | 192.168.254.140 | CLOSE | OPEN | 0 | ---------------------------------------------------------------- 0 virtual cluster 3 coordinator node 3 free data node [gbase@192 ~]$
设置分片信息
安装成功后,gcinstall 下会生成 gcChangeInfo.xml 文件
文件列出安装的节点列表
[gbase@192 gcinstall]$ vi gcChangeInfo.xml
<?xml version="1.0" encoding="utf-8"?> <servers> <rack> <node ip="192.168.254.138"/> <node ip="192.168.254.139"/> <node ip="192.168.254.140"/> </rack> </servers>
创建分片信息
[gbase@192 gcinstall]$ gcadmin distribution gcChangeInfo.xml p 2 d 1 pattern 1 gcadmin generate distribution ... NOTE: node [192.168.254.138] is coordinator node, it shall be data node too NOTE: node [192.168.254.139] is coordinator node, it shall be data node too NOTE: node [192.168.254.140] is coordinator node, it shall be data node too gcadmin generate distribution successful
查看发布信息
[gbase@192 gcinstall]$ gcadmin showdistribution node Distribution ID: 1 | State: new | Total segment num: 6 ==================================================================================================================================== | nodes | 192.168.254.138 | 192.168.254.139 | 192.168.254.140 | ------------------------------------------------------------------------------------------------------------------------------------ | primary | 1 | 2 | 3 | | segments | 4 | 5 | 6 | ------------------------------------------------------------------------------------------------------------------------------------ |duplicate | 3 | 1 | 2 | |segments 1| 5 | 6 | 4 | ==================================================================================================================================== [gbase@192 gcinstall]$
数据库初始化
分片设置后,激活分布表
安装成功后会产生根用户root,密码为空
此时只能查看一些元数据信息,并且可以打开元数据库,但还不能创建数据,需要初始化nodedatamap
[gbase@192 gcinstall]$ gccli -u root -p
Enter password:
GBase client 9.5.2.39.126761. Copyright (c) 2004-2023, GBase. All Rights Reserved.
gbase> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| performance_schema |
| gbase |
| gctmpdb |
+--------------------+
4 rows in set (Elapsed: 00:00:00.02)
gbase> use gbase;
Query OK, 0 rows affected (Elapsed: 00:00:00.00)
gbase> create database gbase;
ERROR 1707 (HY000): gcluster command error: (GBA-02CO-0003) nodedatamap is not initialized.
初始化
gbase> initnodedatamap;
Query OK, 0 rows affected (Elapsed: 00:00:00.86)
# 初始化后,可以创建数据库
gbase> create database gbase;
ERROR 1701 (HY000): gcluster database error: Can't create database 'gbase'; database exists.
gbase>
gbase> create database test;
Query OK, 1 row affected (Elapsed: 00:00:00.03)
gbase> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| performance_schema |
| gbase |
| gctmpdb |
| gclusterdb |
| test |
+--------------------+
6 rows in set (Elapsed: 00:00:00.00)
gbase>
安装过程中的问题
集群安装成功后,在管理节点执行 gcadmin,系统提示找不到命令
原因:环境变量没有生效
处理:切换系统账户,重新进入gbase
[gbase@192 gcinstall]$ exit 登出 [root@192 opt]# su - gbase 上一次登录:四 2月 23 23:36:53 CST 2023从 192.168.254.138pts/4 上 [gbase@192 ~]$ gcadmin
在管理节点执行 gcadmin,系统报错提示
Could not initialize CRM instance error: [122]->[can not connect to any server]
原因:所有节点的集群服务都没有启动
处理:在集群所有节点上启动全部集群服务
[root@192 opt]# su - gbase 上一次登录:五 2月 24 21:34:14 CST 2023pts/0 上 [gbase@192 ~]$ gcluster_services all start Starting gcware : [ OK ] Starting gcluster : [ OK ] Starting gcrecover : [ OK ] Starting gbase : [ OK ] Starting syncserver : [ OK ] Starting GCMonit success!
最后修改时间:2023-02-26 22:57:49
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。