GBase 8a 虚拟集群缩容

原始集群

vc1 192.168.61.3,192.168.61.4

vc2 192.168.61.5,192.168.61.6

将vc1中的192.168.61.节点删除

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

====================================
| GBASE GCWARE CLUSTER INFORMATION |
====================================
| NodeName |  IpAddress   | gcware |
------------------------------------
| gcware1  | 192.168.61.3 |  OPEN  |
------------------------------------
| gcware2  | 192.168.61.5 |  OPEN  |
------------------------------------
======================================================
|       GBASE COORDINATOR CLUSTER INFORMATION        |
======================================================
|   NodeName   |  IpAddress   | gcluster | DataState |
------------------------------------------------------
| coordinator1 | 192.168.61.3 |   OPEN   |     0     |
------------------------------------------------------
| coordinator2 | 192.168.61.5 |   OPEN   |     0     |
------------------------------------------------------
===============================================
|      GBASE VIRTUAL CLUSTER INFORMATION      |
===============================================
|    VcName    | DistributionId |   comment   |
-----------------------------------------------
|     vc1      |       1        | comment vc1 |
-----------------------------------------------
|     vc2      |       2        | comment vc2 |
-----------------------------------------------

2 virtual cluster: vc1, vc2
2 coordinator node
0 free data node

 配置分布文件

[gbase@localhost gcinstall]$ cp gcChangeInfo_vc1.xml gcS_vc1.xml 
[gbase@localhost gcinstall]$ cat gcS_vc1.xml 
<?xml version="1.0" encoding="utf-8"?>
<servers>
    <rack>
        <node ip="192.168.61.3"/>
    </rack>
    <rack>
        <node ip="192.168.61.4"/>
    </rack>

</servers>
[gbase@localhost gcinstall]$ vi gcS_vc1.xml 
[gbase@localhost gcinstall]$ cat gcS_vc1.xml 
<?xml version="1.0" encoding="utf-8"?>
<servers>
    <rack>
        <node ip="192.168.61.3"/>
    </rack>
</servers>

生成分布方式 

[gbase@localhost gcinstall]$ gcadmin distribution gcS_vc1.xml p 1 d 0 vc vc1

初始化数据

[gbase@localhost gcinstall]$ gccli -uroot -p
Enter password: 

GBase client 9.5.3.27.19_patch.36251615. Copyright (c) 2004-2023, GBase.  All Rights Reserved.

gbase> use vc vc1;
Query OK, 0 rows affected (Elapsed: 00:00:00.00)

gbase> initnodedatamap;
Query OK, 1 row affected, 4 warnings (Elapsed: 00:00:00.27)

数据重分布

gbase> rebalance instance;
Query OK, 2 rows affected (Elapsed: 00:00:00.15)

gbase> select index_name, status, percentage from gclusterdb.rebalancing_status;
+-----------------------------+-----------+------------+
| index_name                  | status    | percentage |
+-----------------------------+-----------+------------+
| zuoye                       | COMPLETED |        100 |
+-----------------------------+-----------+------------+
2 rows in set (Elapsed: 00:00:00.02)

删除旧的分布方式

--确认没有表使用旧的分布方式
gbase> select index_name,tbname,data_distribution_id,vc_id from  gbase.table_distribution;
+-------------------------------+--------------------+----------------------+---------+
| index_name                    | tbname             | data_distribution_id | vc_id   |
+-------------------------------+--------------------+----------------------+---------+
| gclusterdb.dual               | dual               |                    3 | vc00001 |
| gclusterdb.rebalancing_status | rebalancing_status |                    3 | vc00001 |
| gclusterdb.rebalancing_status | rebalancing_status |                    2 | vc00002 |
| gclusterdb.dual               | dual               |                    2 | vc00002 |
| _zuoye                        | ang_zuoye          |                    3 | vc00001 |
| zuoye                         | _zuoye             |                    3 | vc00001 |
+-------------------------------+--------------------+----------------------+---------+
[gbase@localhost gcinstall]$ gcadmin rmdistribution 1 vc vc1

 从集群中删除缩容节点

[gbase@localhost gcinstall]$ cp gcChangeInfo.xml gcRm_vc1.xml 
[gbase@localhost gcinstall]$ cat gcRm_vc1.xml 
<?xml version="1.0" encoding="utf-8"?>
<servers>
    <rack>
        <node ip="192.168.61.5"/>
    </rack>
    <rack>
        <node ip="192.168.61.3"/>
    </rack>
    <rack>
        <node ip="192.168.61.6"/>
    </rack>
    <rack>
        <node ip="192.168.61.4"/>
    </rack>
</servers>
[gbase@localhost gcinstall]$ vi gcRm_vc1.xml 
[gbase@localhost gcinstall]$ cat gcRm_vc1.xml 
<?xml version="1.0" encoding="utf-8"?>
<servers>
    <rack>
        <node ip="192.168.61.4"/>  #这里为要删除的节点
    </rack>
</servers>
[gbase@localhost gcinstall]$ gcadmin rmnodes gcRm_vc1.xml vc1

检查缩容结果

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

====================================
| GBASE GCWARE CLUSTER INFORMATION |
====================================
| NodeName |  IpAddress   | gcware |
------------------------------------
| gcware1  | 192.168.61.3 |  OPEN  |
------------------------------------
| gcware2  | 192.168.61.5 |  OPEN  |
------------------------------------
======================================================
|       GBASE COORDINATOR CLUSTER INFORMATION        |
======================================================
|   NodeName   |  IpAddress   | gcluster | DataState |
------------------------------------------------------
| coordinator1 | 192.168.61.3 |   OPEN   |     0     |
------------------------------------------------------
| coordinator2 | 192.168.61.5 |   OPEN   |     0     |
------------------------------------------------------
===============================================
|      GBASE VIRTUAL CLUSTER INFORMATION      |
===============================================
|    VcName    | DistributionId |   comment   |
-----------------------------------------------
|     vc1      |       3        | comment vc1 |
-----------------------------------------------
|     vc2      |       2        | comment vc2 |
-----------------------------------------------
=============================================================
|         GBASE CLUSTER FREE DATA NODE INFORMATION          |
=============================================================
| NodeName  |  IpAddress   | gnode | syncserver | DataState |
-------------------------------------------------------------
| FreeNode1 | 192.168.61.4 | OPEN  |    OPEN    |     0     |
-------------------------------------------------------------

2 virtual cluster: vc1, vc2
2 coordinator node
1 free data node

[gbase@localhost gcinstall]$ gcadmin showdistribution vc vc1

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

             Primary Segment Node IP                   Segment ID                 Duplicate Segment node IP
========================================================================================================================
|                  192.168.61.3                  |         1          |                                                |
========================================================================================================================
[gbase@localhost gcinstall]$ gcadmin showdistribution vc vc2

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

             Primary Segment Node IP                   Segment ID                 Duplicate Segment node IP
========================================================================================================================
|                  192.168.61.5                  |         1          |                  192.168.61.6                  |
------------------------------------------------------------------------------------------------------------------------
|                  192.168.61.6                  |         2          |                  192.168.61.5                  |
========================================================================================================================

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

===============================================
|      GBASE VIRTUAL CLUSTER INFORMATION      |
===============================================
|    VcName    | DistributionId |   comment   |
-----------------------------------------------
|     vc1      |       3        | comment vc1 |
-----------------------------------------------
=========================================================================================================
|                                 VIRTUAL CLUSTER DATA NODE INFORMATION                                 |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |               192.168.61.3               |       3        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

1 data node

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值