本次实验涉及三个节点,即是管理节点 又是数据节点
数据库版本 GBase8a 8.6.2
操作系统版本 CentOS Linux release 7.9.2009 (Core)
验证开启ssh【所有节点】
[root@localhost ~]# service sshd status
关闭selinux【所有节点】
[root@localhost ~]# vi /etc/selinux/config
[root@localhost ~]# reboot
[root@localhost ~]# sestatus
SELINUX=disabled
关闭防火墙【所有节点】
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl status firewalld.service
安装解压软件【所有节点】
[root@localhost opt]# yum -y install bzip2.x86_64
解压【在一个管理节点执行即可】
[root@localhost ~]# cd /opt/
[root@localhost opt]# ls
GBase8a_MPP_Cluster-NoLicense-8.6.2_build43-R33-132743-redhat7-x86_64.tar.bz2
[root@localhost opt]# tar xfj GBase8a_MPP_Cluster-NoLicense-8.6.2_build43-R33-132743-redhat7-x86_64.tar.bz2
配置集群信息
[root@localhost gcinstall]# vi demo.options
installPrefix= /opt
coordinateHost = 192.168.61.132,192.168.61.133,192.168.61.134
coordinateHostNodeID = 132,133,134
dataHost = 192.168.61.132,192.168.61.133,192.168.61.134
#existCoordinateHost =
#existDataHost =
loginUser= root
loginUserPwd = '111111'
#loginUserPwdFile = loginUserPwd.json
dbaUser = gbase
dbaGroup = gbase
dbaPwd = 'gbase'
rootPwd = '111111'
#rootPwdFile = rootPwd.json
dbRootPwd = ''
#mcastAddr = 226.94.1.39
mcastPort = 5493
安装
[root@localhost gcinstall]# ./gcinstall.py --slient=demo.options
查看集群运行状态
[root@localhost gcinstall]# service gcware status
corosync (pid 5042) is running...
gclusterd (pid 5766) is running...
gcrecover (pid 5827) is running...
gbased (pid 5133) is running...
gc_sync_server (pid 5732) is running...
[root@localhost gcinstall]# gcadmin
CLUSTER STATE: ACTIVE
CLUSTER MODE: NORMAL
=====================================================================
| GBASE COORDINATOR CLUSTER INFORMATION |
=====================================================================
| NodeName | IpAddress |gcware |gcluster |DataState |
---------------------------------------------------------------------
| coordinator1 | 192.168.61.132 | OPEN | OPEN | 0 |
---------------------------------------------------------------------
| coordinator2 | 192.168.61.133 | OPEN | OPEN | 0 |
---------------------------------------------------------------------
| coordinator3 | 192.168.61.134 | OPEN | OPEN | 0 |
---------------------------------------------------------------------
=================================================================
| GBASE DATA CLUSTER INFORMATION |
=================================================================
|NodeName | IpAddress |gnode |syncserver |DataState |
-----------------------------------------------------------------
| node1 | 192.168.61.132 | OPEN | OPEN | 0 |
-----------------------------------------------------------------
| node2 | 192.168.61.133 | OPEN | OPEN | 0 |
-----------------------------------------------------------------
| node3 | 192.168.61.134 | OPEN | OPEN | 0 |
-----------------------------------------------------------------
设置集群分布方式
【p=2 每个节点2个分片,d=2 每个分片2个备份,pattern=1 负载均衡分布方式】
[root@localhost opt]# su - gbase
[gbase@localhost ~]$ cd /opt/gcinstall/
[gbase@localhost gcinstall]$ gcadmin distribution gcChangeInfo.xml p 2 d 2 pattern 1
gcadmin generate distribution ...
NOTE: node [192.168.61.132] is coordinator node, it shall be data node too
NOTE: node [192.168.61.133] is coordinator node, it shall be data node too
NOTE: node [192.168.61.134] is coordinator node, it shall be data node too
gcadmin generate distribution successful
查看集群分布情况
[gbase@localhost gcinstall]$ gcadmin showdistribution node
Distribution ID: 1 | State: new | Total segment num: 6
====================================================================================================================================
|nodes | 192.168.61.132 | 192.168.61.133 | 192.168.61.134 |
------------------------------------------------------------------------------------------------------------------------------------
|primary | 1 | 2 | 3 |
|segments | 4 | 5 | 6 |
------------------------------------------------------------------------------------------------------------------------------------
|duplicate | 3 | 1 | 2 |
|segments 1| 5 | 6 | 4 |
------------------------------------------------------------------------------------------------------------------------------------
|duplicate | 2 | 3 | 1 |
|segments 2| 6 | 4 | 5 |
====================================================================================================================================
连接并初始化数据库
[gbase@localhost gcinstall]$ gccli -uroot -p
Enter password:
GBase client 8.6.2.43-R33.132743. Copyright (c) 2004-2022, GBase. All Rights Reserved.
gbase> show database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your GBase server version for the right syntax to use near 'database' at line 1
gbase> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| performance_schema |
| gbase |
| gclusterdb |
| gctmpdb |
+--------------------+
5 rows in set (Elapsed: 00:00:00.01)
gbase> create database a;
ERROR 1707 (HY000): gcluster command error: (GBA-02CO-0003) nodedatamap is not initialized.
gbase> initnodedatamap;
Query OK, 0 rows affected (Elapsed: 00:00:01.12)
gbase> create database a;
Query OK, 1 row affected (Elapsed: 00:00:00.00)