南大通用数据库-Gbase-8a-MPP-Cluster-集群节点扩容-07

一、测试环境

名称
cpuIntel® Core™ i5-1035G1 CPU @ 1.00GHz
操作系统CentOS Linux release 7.9.2009 (Core)
内存4G
逻辑核数3
原有节点1-IP192.168.142.10
扩容节点2-IP192.168.142.11
数据库版本8.6.2.43-R33

 

二、操作步骤

1、查看集群状态
[root@localhost ~]# gcadmin
CLUSTER STATE:  ACTIVE
CLUSTER MODE:   NORMAL

=====================================================================
|               GBASE COORDINATOR CLUSTER INFORMATION               |
=====================================================================
|   NodeName   |       IpAddress       |gcware |gcluster |DataState |
---------------------------------------------------------------------
| coordinator1 |    192.168.142.10     | OPEN  |  OPEN   |    0     |
---------------------------------------------------------------------
=================================================================
|                GBASE DATA CLUSTER INFORMATION                 |
=================================================================
|NodeName |       IpAddress       |gnode |syncserver |DataState |
-----------------------------------------------------------------
|  node1  |    192.168.142.10     | OPEN |   OPEN    |    0     |
-----------------------------------------------------------------
2、停掉集群

由于我们需要添加管理节点,所以必须要关闭所有节点服务,如果只添加数据节点,可以不停止服务。添加管理节点,不停服务,报错如下:

some gcluster process still running on host 192.168.142.10, use 'pidof gclusterd gbased corosync gcmonit gcrecover gc_sync_server;' to check.
Must stop all gcluster nodes before extend gcluster. you can search 'still running' in gcinstall.log to find them.

每个节点都需要执行。

[root@localhost ~]# service gcware stop
3、查看集群进程是否关闭
[root@localhost ~]# ps -ef|grep gbase
[root@localhost ~]# ps -ef|grep gclusterd

 4、修改配置文件demo.options

[root@localhost gcinstall]# cat demo.options 
installPrefix= /opt
coordinateHost = 192.168.142.11
coordinateHostNodeID = 234,235,237
dataHost = 192.168.142.11
existCoordinateHost = 192.168.142.10
existDataHost = 192.168.142.10
loginUser= root
loginUserPwd = 'qwer1234'
#loginUserPwdFile = loginUserPwd.json
dbaUser = gbase
dbaGroup = gbase
dbaPwd = 'gbase'
rootPwd = 'qwer1234'
#rootPwdFile = rootPwd.json
dbRootPwd = ''
#mcastAddr = 226.94.1.39
mcastPort = 5493

 5、安装数据库服务

[root@localhost gcinstall]# su - gbase
[gbase@localhost gcinstall]$ ./gcinstall.py --silent=demo.options

6、查看集群当前状态 

[gbase@localhost gcinstall]$ gcadmin 
CLUSTER STATE:  ACTIVE
CLUSTER MODE:   NORMAL

=====================================================================
|               GBASE COORDINATOR CLUSTER INFORMATION               |
=====================================================================
|   NodeName   |       IpAddress       |gcware |gcluster |DataState |
---------------------------------------------------------------------
| coordinator1 |    192.168.142.10     | OPEN  |  OPEN   |    0     |
---------------------------------------------------------------------
| coordinator2 |    192.168.142.11     | OPEN  |  OPEN   |    0     |
---------------------------------------------------------------------
=================================================================
|                GBASE DATA CLUSTER INFORMATION                 |
=================================================================
|NodeName |       IpAddress       |gnode |syncserver |DataState |
-----------------------------------------------------------------
|  node1  |    192.168.142.10     | OPEN |   OPEN    |    0     |
-----------------------------------------------------------------
|  node2  |    192.168.142.11     | OPEN |   OPEN    |    0     |
-----------------------------------------------------------------
[gbase@localhost gcinstall]$ gcadmin showdistribution

              Distribution ID: 1 | State: new | Total segment num: 1

     Primary Segment Node IP                           Segment ID         Duplicate Segment node IP
========================================================================================================================
|    192.168.142.10                              |       1          |                                                  |
========================================================================================================================

可以看到管理节点已经添加成功,数据节点还没有添加分布策略,原来的分布策略ID为1。

7、配置新的分布策略
[gbase@localhost gcinstall]$ cat gcChangeInfo.xml 
<?xml version="1.0" encoding="utf-8"?>
<servers>
 <rack>
  <node ip="192.168.142.11"/>
  <node ip="192.168.142.10"/>
 </rack>
</servers>

[gbase@localhost gcinstall]$  gcadmin distribution gcChangeInfo.xml p 1 d 0
gcadmin generate distribution ...

[warning]: parameter [d num] is 0, the new distribution will has no segment backup
please ensure this is ok, input y or n: y
NOTE: node [192.168.142.11] is coordinator node, it shall be data node too
copy system table from 192.168.142.10 to 192.168.142.11
source ip: 192.168.142.10
target ip: 192.168.142.11
gcadmin generate distribution successful

[gbase@localhost gcinstall]$ gcadmin showdistribution

              Distribution ID: 2 | State: new | Total segment num: 2

     Primary Segment Node IP                           Segment ID         Duplicate Segment node IP
========================================================================================================================
|    192.168.142.11                              |       1          |                                                  |
------------------------------------------------------------------------------------------------------------------------
|    192.168.142.10                              |       2          |                                                  |
========================================================================================================================

              Distribution ID: 1 | State: old | Total segment num: 1

     Primary Segment Node IP                           Segment ID         Duplicate Segment node IP
========================================================================================================================
|    192.168.142.10                              |       1          |                                                  |
========================================================================================================================

可以看到现在有两个分布策略,后续我们删除老的分布策略。

8、初始化
[gbase@localhost gcinstall]$ gccli

GBase client 8.6.2.43-R33.132743. Copyright (c) 2004-2022, GBase.  All Rights Reserved.

gbase> initnodedatamap;
Query OK, 0 rows affected, 1 warning (Elapsed: 00:00:00.76)
9、关闭并行度

如果有需要调整优先级,做此操作。

gbase> set global gcluster_rebalancing_concurrent_count = 0;
gbase> set global gcluster_reblancing_concurrent_count = 0;
10、重分布

重分布支持instance, database、table三种等级。

gbase> rebalance instance;
11、调整优先级

根据现场实际情况来调整,也可以不调整。

(1)查看重分布状态
gbase> select * from  gclusterdb.rebalancing_status;
(2)调整优先度

priority值小的,优先级高,改完之后,需加大并行度。

gbase> update gclusterdb.rebalancing_status set priority = 3 where index_name like 'abc.abc';
gbase> select * from  gclusterdb.rebalancing_status;
gbase> set global gcluster_rebalancing_concurrent_count = 5;

12、查看重分布完成度
gbase> select * from  gclusterdb.rebalancing_status;

13、查看是否有表使用老的策略

gbase> select * from gbase.table_distribution where data_distribution_id=1;

 如果有的话,请使用rebalance table 库名.表名,重新分布表;

gbase> refreshnodedatamap drop 1;

15、删除老的分布策略

[gbase@localhost gcinstall]$ gcadmin rmdistribution 1

 16、查看最终结果

各节点状态正常,分布策略是最新的
[gbase@localhost gcinstall]$ gcadmin
[gbase@localhost gcinstall]$ gcadmin showdistribution

  • 3
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值