暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

GBase 8a MPP Cluster V9扩容数据节点示例

原创 2020-07-26
822

扩容场景

软件版本:GBase 8a MPP Cluster V9。

集群结构:集群为2个VC(虚拟集群)构成的GBase 8a MPP集群,设置3个管理节点,数据节点分为2个VC:3数据节点VC_FIR+2数据节点VC_SEC。

扩容目标:在VC_FIR扩容2个数据节点,VC_SEC保持不变。

初始集群结构

[gbase@node042 gcinstall]$ gcadmin
CLUSTER STATE:         ACTIVE

=============================================================
|           GBASE COORDINATOR CLUSTER INFORMATION           |
=============================================================
|   NodeName   | IpAddress  | gcware | gcluster | DataState |
-------------------------------------------------------------
| coordinator1 | 192.168.1.42 |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------
| coordinator2 | 192.168.1.43 |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------
| coordinator3 | 192.168.1.44 |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------
=============================================
|     GBASE VIRTUAL CLUSTER INFORMATION     |
=============================================
|    VcName    | DistributionId |  comment  |
---------------------------------------------
|    vc_fir    |       3        |           |
---------------------------------------------
|  vc_sec   |       4        | comment   |
---------------------------------------------

2 virtual cluster: vc_fir, vc_sec
3 coordinator node
0 free data node

[gbase@node042 gcinstall]$ gcadmin showcluster vc vc_fir
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

=============================================
|     GBASE VIRTUAL CLUSTER INFORMATION     |
=============================================
|    VcName    | DistributionId |  comment  |
---------------------------------------------
|    vc_fir    |       3        |           |
---------------------------------------------
=========================================================================================================
|                                 VIRTUAL CLUSTER DATA NODE INFORMATION                                 |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |                192.168.1.42                |       3        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |                192.168.1.43                |       3        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |                192.168.1.44                |       3        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

3 data node

[gbase@node042 gcinstall]$ gcadmin showcluster vc vc_sec
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

=============================================
|     GBASE VIRTUAL CLUSTER INFORMATION     |
=============================================
|    VcName    | DistributionId |  comment  |
---------------------------------------------
|    vc_sec    |       4        |           |
---------------------------------------------
=========================================================================================================
|                                 VIRTUAL CLUSTER DATA NODE INFORMATION                                 |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |                192.168.1.131                |       4        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |                192.168.1.132                |       4        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

2 data node

扩容机器检查

节点扩容

1、gbase账户登陆集群管理节点192.168.1.42

2、修改安装配置文件demo.options

[gbase@node042 gcinstall]$ cd /opt/product/gcinstall
[gbase@node042 gcinstall]$ cat demo.options
installPrefix= /opt
#coordinateHost = 192.168.1.42,192.168.1.43,192.168.1.44
#coordinateHostNodeID = 368251052,385028268
dataHost = 192.168.1.144,192.168.1.188
existCoordinateHost = 192.168.1.42,192.168.1.43,192.168.1.44
existDataHost = 192.168.1.42,192.168.1.43,192.168.1.44,192.168.1.132,192.168.1.133
dbaUser = gbase
dbaGroup = gbase
dbaPwd = 'xxxxxx'

3、安装扩容节点

[gbase@node042 gcinstall]$ /gcinstall.py --silent=demo.options

4、检查扩容节点(确认扩容节点已增加为freenode)


[gbase@node042 gcinstall]$ gcadmin
CLUSTER STATE:         ACTIVE

=============================================================
|           GBASE COORDINATOR CLUSTER INFORMATION           |
=============================================================
|   NodeName   | IpAddress  | gcware | gcluster | DataState |
-------------------------------------------------------------
| coordinator1 | 192.168.1.42 |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------
| coordinator2 | 192.168.1.43 |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------
| coordinator3 | 192.168.1.44 |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------
=============================================
|     GBASE VIRTUAL CLUSTER INFORMATION     |
=============================================
|    VcName    | DistributionId |  comment  |
---------------------------------------------
|    vc_fir    |       3        |           |
---------------------------------------------
|  vc_sec   |       4        | comment   |
---------------------------------------------
============================================================
|         GBASE CLUSTER FREE DATA NODE INFORMATION         |
============================================================
| NodeName  |  IpAddress  | gnode | syncserver | DataState |
------------------------------------------------------------
| FreeNode1 | 192.168.1.144 | OPEN  |    OPEN    |     0     |
------------------------------------------------------------
| FreeNode2 | 192.168.1.188 | OPEN  |    OPEN    |     0     |
------------------------------------------------------------

2 virtual cluster: vc_fir, vc_sec
3 coordinator node
2 free data node

5、编辑扩容节点配置文件add_vc_fir_node.xml

[gbase@node042 gcinstall]$ cat add_vc_fir_node.xml
<?xml version="1.0" encoding="utf-8"?>
<servers>
 <rack>
  <node ip="192.168.1.144"/>
  <node ip="192.168.1.188"/>
 </rack>
</servers>

6、将扩容节点加入vc_fir VC

[gbase@node042 gcinstall]$ gcadmin addnodes add_vc_fir_node.xml vc_fir

7、检查扩容节点(确认新节点加入vc_fir VC)


[gbase@node042 gcinstall]$ gcadmin
CLUSTER STATE:         ACTIVE

=============================================================
|           GBASE COORDINATOR CLUSTER INFORMATION           |
=============================================================
|   NodeName   | IpAddress  | gcware | gcluster | DataState |
-------------------------------------------------------------
| coordinator1 | 192.168.1.42 |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------
| coordinator2 | 192.168.1.43 |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------
| coordinator3 | 192.168.1.44 |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------
=============================================
|     GBASE VIRTUAL CLUSTER INFORMATION     |
=============================================
|    VcName    | DistributionId |  comment  |
---------------------------------------------
|    vc_fir    |       3        |           |
---------------------------------------------
|  vc_sec   |       4        | comment   |
---------------------------------------------

2 virtual cluster: vc_fir, vc_sec
3 coordinator node
0 free data node

[gbase@node042 gcinstall]$ gcadmin showcluster vc vc_fir
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

=============================================
|     GBASE VIRTUAL CLUSTER INFORMATION     |
=============================================
|    VcName    | DistributionId |  comment  |
---------------------------------------------
|    vc_fir    |       3        |           |
---------------------------------------------
=========================================================================================================
|                                 VIRTUAL CLUSTER DATA NODE INFORMATION                                 |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |                192.168.1.42                |       3        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |                192.168.1.43                |       3        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |                192.168.1.44                |       3        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node4   |               192.168.1.144                |                | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node5   |               192.168.1.188                |                | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

5 data node

8、编辑vc_fir VC第2个distribution配置文件

[gbase@node042 gcinstall]$ cat gcChangeInfo.xml 
<?xml version="1.0" encoding="utf-8"?>
<servers>
 <rack>
  <node ip="192.168.1.42"/>
  <node ip="192.168.1.43"/>
  <node ip="192.168.1.44"/>
  <node ip="192.168.1.144"/>
  <node ip="192.168.1.188"/>
 </rack>
</servers>

9、创建vc_fir VC第2个distribution


[gbase@node042 gcinstall]$ gcadmin distribution gcChangeInfo.xml p 1 d 1 db_user gbase db_pwd 'xxxxxxxx' vc vc_fir
[gbase@node042 gcinstall]$ gcadmin showdistribution vc vc_fir

                                 Distribution ID: 6 | State: new | Total segment num: 5

             Primary Segment Node IP                   Segment ID                 Duplicate Segment node IP
========================================================================================================================
|                   192.168.1.42                   |         1          |                   192.168.1.43                   |
------------------------------------------------------------------------------------------------------------------------
|                   192.168.1.43                   |         2          |                   192.168.1.44                   |
------------------------------------------------------------------------------------------------------------------------
|                   192.168.1.44                   |         3          |                  192.168.1.144                   |
------------------------------------------------------------------------------------------------------------------------
|                  192.168.1.144                   |         4          |                  192.168.1.188                   |
------------------------------------------------------------------------------------------------------------------------
|                  192.168.1.188                   |         5          |                   192.168.1.42                   |
========================================================================================================================

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

             Primary Segment Node IP                   Segment ID                 Duplicate Segment node IP
========================================================================================================================
|                   192.168.1.42                   |         1          |                   192.168.1.43                   |
------------------------------------------------------------------------------------------------------------------------
|                   192.168.1.43                   |         2          |                   192.168.1.44                   |
------------------------------------------------------------------------------------------------------------------------
|                   192.168.1.44                   |         3          |                   192.168.1.42                   |
========================================================================================================================

10、初始化新的distribution
gbase账户gccli连接集群,执行:

gbase> use vc vc_fir;
gbase> initnodedatamap;

数据重分布

1、设置重分布参数

根据数据量级及系统资源情况设置重分布参数,下面是3个常用参数:

gbase> set gcluster_rebalancing_step = 1000000000;  --重分布处理单批次记录数,值越大,重分布速度越快
gbase> set global gcluster_rebalancing_parallel_degree = 4; --重分布并行度
gbase> set global gcluster_rebalancing_concurrent_count = 4; --重分布并发任务数

2、启动重分布

gbase> rebalance instance;

3、等待重分布完成
查看gclusterdb.rebalancing_status表,当所有表的status都为COMPLETED,重分布完成:

gbase> select status,count(1) from gclusterdb.rebalancing_status group by status;

删除老的distribution

1、确认老的distribution_id:数字小的distribution_id

gbase> select distinct data_distribution_id from gbase.nodedatamap;

2、更新nodedatamap

gbase> refreshnodedatamap drop [N]; --N为旧distribution_id

3、删除老的distribution

[gbase@node042 gcinstall]$ gcadmin rmdistribution [N] vc vc_fir

4、查看并确认distribution:老distribution已删除

[gbase@node042 gcinstall]$ gcadmin showdistribution vc vc_fir

                                 Distribution ID: 6 | State: new | Total segment num: 5

             Primary Segment Node IP                   Segment ID                 Duplicate Segment node IP
========================================================================================================================
|                   192.168.1.42                   |         1          |                   192.168.1.43                   |
------------------------------------------------------------------------------------------------------------------------
|                   192.168.1.43                   |         2          |                   192.168.1.44                   |
------------------------------------------------------------------------------------------------------------------------
|                   192.168.1.44                   |         3          |                  192.168.1.144                   |
------------------------------------------------------------------------------------------------------------------------
|                  192.168.1.144                   |         4          |                  192.168.1.188                   |
------------------------------------------------------------------------------------------------------------------------
|                  192.168.1.188                   |         5          |                   192.168.1.42                   |
========================================================================================================================
最后修改时间:2020-07-28 10:13:24
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论