GBase 8a数据库集群,支持从现有集群扩容操作,可以同时扩容多个数据节点和管理节点。扩容一般是因为空间占用或者性能问题导致。GBase 通过重分布功能将数据重新分散到所有的数据节点上,以实现数据空间的再平衡。本文是一个详细操作步骤和手顺。
扩容和缩容是2个完全相反的结果,但大体操作步骤基本类似,只是相反的。缩容步骤请参考。 GBase 8a 缩容操作步骤实例
目标
本文的目标,是将一个2节点的集群,扩容到3个节点,也就是增加1个管理和数据符合节点。现状如下:
2个节点集群
V95版本的一些注意事项,请参考 GBase 8a集群V95新安装注意事项
编辑扩容操作配置文件
安转包的解压步骤就不介绍了,我们直接转到安装包的gcinstall目录下,编写demo.options。 按照实际情况填写用户信息。
注意本文用的是V95版本,其格式和V8的不同,请参考安装手册的相关介绍。但其中重要的部分是一致的。其中
installPrefix 是集群安装目录,请一定和原有节点的保持一致。
coordinatorHost 是要扩容的节点IP,多个时用逗号分割
coordinateHostNodeID 这个只有IPV6时才有用,ipv4写不写都行,被内部忽略
dataHost 本次扩容的数据节点IP
existCoordinateHost 已经存在的管理节点IP, 多个用逗号分割
existDataHost 已经存在的数据节点IP,多个用逗号分割
dbaUser 操作系统的dba用户名,在v95里面是有用户自行创建的
dbaGroup 操作系统的dba用户名所属用户组
dbaPwd 操作系统的dba用户密码
rootPwd操作系统root用户密码,在V95里不需要。
genDBPwd 这个是V95的名字,代表数据库用户root的密码。请区分数据库用户和操作系统用户的区别。
[gbase@localhost gcinstall]$ cat demo.options
installPrefix= /opt/gbase
coordinateHost = 10.0.2.203
coordinateHostNodeID = 203
dataHost = 10.0.2.203
existCoordinateHost =10.0.2.102,10.0.2.202
existDataHost =10.0.2.102,10.0.2.202
dbaUser = gbase
dbaGroup = gbase
dbaPwd = 'gbase1234'
rootPwd = '111111'
#rootPwdFile = rootPwd.json
genDBPwd=''
如下是一个V8版本的demo.options的样子。其中loginUser请尽量用root用户。dbRootPwd是数据库root用户的密码。
[root@localhost gcinstall]# cat demo.options
installPrefix= /opt
coordinateHost = 10.0.2.106
coordinateHostNodeID = 106
dataHost = 10.0.2.106
#existCoordinateHost =
#existDataHost =
loginUser= root
loginUserPwd = '111111'
#loginUserPwdFile = loginUserPwd.json
dbaUser = gbase
dbaGroup = gbase
dbaPwd = 'gbase1234'
rootPwd = '111111'
#rootPwdFile = rootPwd.json
dbRootPwd = ''
#mcastAddr = 226.94.1.39
mcastPort = 5493
[root@localhost gcinstall]#
停止数据库服务
如果扩容服务有管理节点,需要停下所有节点的数据库服务。如果只扩容数据节点,则可以跳过本步骤。
如果不停服务,而扩容管理节点,扩容安装步骤会报这个错误 must stop all gcluster nodes before extend gcluster. you can search ‘still running’ in gcinstall.log to find them.
停服务的方法,请自行在每个节点操作即可。本文用的是ssh远程操作的。
[gbase@localhost gcinstall]$ ssh 10.0.2.102 "gcluster_services all stop"
The authenticity of host '10.0.2.102 (10.0.2.102)' can't be established.
ECDSA key fingerprint is d1:17:f6:1e:3b:97:e4:db:37:d5:9b:cb:00:14:66:b6.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.2.102' (ECDSA) to the list of known hosts.
gbase
gbase@10.0.2.102's password:
Stopping GCMonit success!
Stopping gcrecover : [ OK ]
Stopping gcluster : [ OK ]
Stopping gcware : [ OK ]
Stopping gbase : [ OK ]
Stopping syncserver : [ OK ]
[gbase@localhost gcinstall]$ ssh 10.0.2.202 "gcluster_services all stop"
gbase@10.0.2.202's password:
Stopping GCMonit success!
Stopping gcrecover : [ OK ]
Stopping gcluster : [ OK ]
Stopping gcware : [ OK ]
Stopping gbase : [ OK ]
Stopping syncserver : [ OK ]
[gbase@localhost gcinstall]$
开始安装服务
调用gcinstall.py 用前面编写好的demo.options 开始安装。
请注意,如果扩容了管理节点,则需要将现有管理节点的【元数据】全部复制一份到新的管理节点上,其耗时取决于你的表数量,磁盘和网络的性能。其耗时可能在几分钟到几个小时不等。
[gbase@localhost gcinstall]$ ./gcinstall.py --silent=demo.options
*********************************************************************************
Thank you for choos