南大通用GBase 8a扩容时从新策略distribution回退到老策略的方案

GBase 8a在扩容时,需要指定新的分布策略distribution,然后做数据重分布操作。如果重分布已经开始,发现策略搞错了,希望回退,可以参考本文介绍的方法。

继续完成后做二次扩容

适合大部分数据已经完成重分布的情况。按照正常流程完成本次扩容,然后发起下一个扩容,包括

  • 因为节点数没有变化。所以不需要安装步骤。
  • 创建新的分布策略,符合要求的。
  • 初始化
  • 重分布,等待完成
  • 完成扩容扫尾工作

通过如上操作,对数据的分布策略做了调整,因为大部分数据在第一轮已经完成,所以这个方案更省时间。

直接回退到老的策略

适合只有少量表参与了重分布的情况,也就是发现的很早。

关闭当前重分布

设置为0,关掉后续的重分布任务。

GBase 8a扩容并行任务参数gcluster_rebalancing_concurrent_count

等待正在运行中的重分布完成

那些RUNNING的是正在运行的。

select status,count(*) from gclusterdb.rebalancing_status group by status;

清空重分布任务列表

直接清掉rebalancing_status表

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

gbase> truncate table rebalancing_status;
Query OK, 1 row affected, 1 warning (Elapsed: 00:00:00.12)

反向重分布

此处重分布增加了to 参数,值为老的distributionID, 请根据现场实际情况修改。

gbase> rebalance instance to 1;
Query OK, 1 row affected (Elapsed: 00:00:00.58)

等待重分布完成

全部COMPLETED就行了

select status,count(*) from gclusterdb.rebalancing_status group by status;

清理新的信息,保留老的

gbase> refreshnodedatamap drop 2;
Query OK, 0 rows affected, 5 warnings (Elapsed: 00:00:00.68)

gbase> ^CAborted
[gbase@gbase_rh7_003 gcinstall]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

====================================
| GBASE GCWARE CLUSTER INFORMATION |
====================================
| NodeName |  IpAddress   | gcware |
------------------------------------
| gcware1  |  10.0.2.103  |  OPEN  |
------------------------------------
====================================================
|      GBASE COORDINATOR CLUSTER INFORMATION       |
====================================================
|   NodeName   | IpAddress  | gcluster | DataState |
----------------------------------------------------
| coordinator1 | 10.0.2.103 |   OPEN   |     0     |
----------------------------------------------------
===============================================================================================================
|                                       GBASE DATA CLUSTER INFORMATION                                        |
===============================================================================================================
| NodeName |                IpAddress                 | DistributionId |    gnode    | syncserver | DataState |
---------------------------------------------------------------------------------------------------------------
|  node1   |                10.0.2.103                |      1,2       |    OPEN     |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------------
|  node2   |                10.0.2.104                |       1        | UNAVAILABLE |            |           |
---------------------------------------------------------------------------------------------------------------
|  node3   |                10.0.2.105                |      1,2       |    OPEN     |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------------
|  node4   |                10.0.2.106                |                |    OPEN     |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------------

[gbase@gbase_rh7_003 gcinstall]$ gcadmin rmdistribution 2
distribution: id [2] is current distribution
it will be removed now
please ensure this is ok, input [Y,y] or [N,n]: y
gcadmin remove distribution [2] success
[gbase@gbase_rh7_003 gcinstall]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

====================================
| GBASE GCWARE CLUSTER INFORMATION |
====================================
| NodeName |  IpAddress   | gcware |
------------------------------------
| gcware1  |  10.0.2.103  |  OPEN  |
------------------------------------
====================================================
|      GBASE COORDINATOR CLUSTER INFORMATION       |
====================================================
|   NodeName   | IpAddress  | gcluster | DataState |
----------------------------------------------------
| coordinator1 | 10.0.2.103 |   OPEN   |     0     |
----------------------------------------------------
===============================================================================================================
|                                       GBASE DATA CLUSTER INFORMATION                                        |
===============================================================================================================
| NodeName |                IpAddress                 | DistributionId |    gnode    | syncserver | DataState |
---------------------------------------------------------------------------------------------------------------
|  node1   |                10.0.2.103                |       1        |    OPEN     |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------------
|  node2   |                10.0.2.104                |       1        | UNAVAILABLE |            |           |
---------------------------------------------------------------------------------------------------------------
|  node3   |                10.0.2.105                |       1        |    OPEN     |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------------
|  node4   |                10.0.2.106                |                |    OPEN     |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------------

[gbase@gbase_rh7_003 gcinstall]$