ITPub博客

首页 > 数据库 > 国内数据库 > 实战GBase 8a MPP Cluster 节点替换 (二)

实战GBase 8a MPP Cluster 节点替换 (二)

原创 国内数据库 作者:Miaomiao_Shui 时间:2020-09-27 14:59:31 0 删除 编辑

步骤5 、执行节点替换命令


操作 步骤

步骤1 :执行 replace.py 替换安装。

$ ./replace.py --host=172.168.83.15 --freenode=172.168.83.16  --type=data --dbaUser=gbase --dbaUserPwd=gbasedba --overwrite --vcname=vc1

172.168.83.15

Are you sure to replace install these nodes ([Y,y]/[N,n])? y

check ip start ......

check ip end ......

 

switch cluster mode into READONLY start ......

wait all ddl statement stop ......

 

all ddl statement stoped

switch cluster mode into READONLY end ......

 

delete all fevent log on replace nodes start ......

delete ddl event log on node 172.168.83.15 start

delete ddl event log on node 172.168.83.15 end

delete dml event log on node 172.168.83.15 start

delete dml event log on node 172.168.83.15 end

delete dml storage event log on node 172.168.83.15 start

delete dml storage event log on node 172.168.83.15 end

delete all fevent log on replace nodes end ......

 

sync dataserver metedata begin ......

copy script to data node begin

copy script to data node end

build data packet begin

build data packet end

copy data packet to target node begin

copy data packet to target node end

extract data packet begin

extract data packet end

sync dataserver metedata end, spend time 38370 ms ......

 

create distribution begin ......

create distribution end

 

replace nodes spend time: 75255 ms

 

synchronize data node metadata success

please rebalance instance then remove old distribution after rebalance complete success

Replace gcluster nodes successfully.

 

完成后的集群信息如下:

$ gcadmin showdistribution vc vc1

 

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

 

   Primary Segment Node IP  Segment ID   Duplicate Segment node IP

===================================================================

|       172.168.83.11     |     1      |       172.168.83.12      |

-------------------------------------------------------------------

|       172.168.83.12     |     2      |       172.168.83.16      |

-------------------------------------------------------------------

|       172.168.83.16     |     3      |       172.168.83.11      |

===================================================================

 

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

 

   Primary Segment Node IP  Segment ID   Duplicate Segment node IP

====================================================================

|       172.168.83.11     |     1     |        172.168.83.12       |

--------------------------------------------------------------------

|       172.168.83.12     |     2     |                            |

--------------------------------------------------------------------

|       172.168.83.11     |     3     |                            |

====================================================================

$ gcadmin showdistribution vc vc1 node

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

 

==============================================================

|  nodes   | 172.168.83.11 | 172.168.83.12  |  172.168.83.16 |

--------------------------------------------------------------

| primary  |      1        |      2         |       3        |

| segments |               |                |                |

--------------------------------------------------------------

|duplicate |      3        |      1         |       2        |

|segments 1|               |                |                |

==============================================================

 

 

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

 

=====================================================

|  nodes   | 172.168.83.11  |     172.168.83.12     |

-----------------------------------------------------

| primary  |      1         |          2            |

| segments |      3         |                       |

-----------------------------------------------------

|duplicate |                |          1            |

|segments 1|                |                       |

=====================================================

步骤6 、进行数据重分布

执行rebalance instance 命令,将数据重分布到使用 freenode 新建的 distribution 上。


操作 步骤

步骤1 :执行 rebalance instance 命令, 将数据重分布到新建的distribution ( Distribution=4 )上。

$ gccli

 

GBase client 9.5.2.20.117651 . Copyright (c) 2004-2020, GBase.  All Rights Reserved.

 

gbase> use vc vc1;

Query OK, 0 rows affected (Elapsed: 00:00:00.00)

 

gbase> rebalance instance;

Query OK, 3 rows affected (Elapsed: 00:00:01.20)

 

gbase> select * from gclusterdb.rebalancing_status;

+------------+---------+------------+----------+----------------------------+----------------------------+-----------+------------+----------+---------------+-----------------+

| index_name | db_name | table_name | tmptable | start_time                 | end_time                   | status    | percentage | priority | host          | distribution_id |

+------------+---------+------------+----------+----------------------------+----------------------------+-----------+------------+----------+---------------+-----------------+

| demo.t     | demo    | t          |          | 2020-07-29 18:31:39.332000 | 2020-07-29 18:31:41.392000 | COMPLETED |        100 |        5 | 172.168.83.11 |               4 |

| demo.ttt   | demo    | ttt        |          | 2020-07-29 18:31:39.336000 | 2020-07-29 18:31:41.389000 | COMPLETED |        100 |        5 | 172.168.83.11 |               4 |

| demo.tt    | demo    | tt         |          | 2020-07-29 18:31:39.336000 | 2020-07-29 18:31:41.430000 | COMPLETED |        100 |        5 | 172.168.83.11 |               4 |

+------------+---------+------------+----------+----------------------------+----------------------------+-----------+------------+----------+---------------+-----------------+

3 rows in set (Elapsed: 00:00:00.03)

 

gbase> quit

Bye

 

步骤7 、删除旧的 distribution

确保所有数据 rebalance 完成后 , 可以将旧的 distribution 删掉 , 将被替换节点从虚拟集群中移除。

操作 步骤

步骤1 : 将旧的 distribution ( Distribution ID 3 ) 删掉 , 将被替换节点从虚拟集群中移除。

$ gcadmin rmdistribution 3 vc vc1

cluster distribution ID [3]

it will be removed now

please ensure this is ok, input [Y,y] or [N,n]: y

select count(*) from gbase.nodedatamap where data_distribution_id=3 result is not 0

refreshnodedatamap drop 3 success

gcadmin remove distribution [3] success

 

完成后的集群信息如下:

$ gcadmin

CLUSTER STATE:         ACTIVE

 

================================================================

|            GBASE COORDINATOR CLUSTER INFORMATION             |

================================================================

|   NodeName   |   IpAddress   | gcware | gcluster | DataState |

----------------------------------------------------------------

| coordinator1 | 172.168.83.11 |  OPEN  |   OPEN   |     0     |

----------------------------------------------------------------

| coordinator2 | 172.168.83.12 |  OPEN  |   OPEN   |     0     |

----------------------------------------------------------------

| coordinator3 | 172.168.83.13 |  OPEN  |   OPEN   |     0     |

----------------------------------------------------------------

=======================================================

|          GBASE VIRTUAL CLUSTER INFORMATION          |

=======================================================

|    VcName    | DistributionId |       comment       |

-------------------------------------------------------

|     vc1      |       4        | comment message vc1 |

-------------------------------------------------------

|     vc2      |       2        | comment message vc2 |

-------------------------------------------------------

 

2 virtual cluster: vc1, vc2

3 coordinator node

0 free data node

 

$ gcadmin showdistribution vc vc1

 

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

 

     Primary Segment Node IP     Segment ID   Duplicate Segment node IP

=========================================================================

|         172.168.83.11       |      1      |        172.168.83.12      |

-------------------------------------------------------------------------

|         172.168.83.12       |      2      |        172.168.83.16      |

-------------------------------------------------------------------------

|         172.168.83.16       |      3      |        172.168.83.11      |

=========================================================================

[gbase@gba01 gcinstall]$ gcadmin showdistribution vc vc1 node

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

 

=======================================================================

|  nodes   |   172.168.83.11  |   172.168.83.12  |   172.168.83.16    |

-----------------------------------------------------------------------

| primary  |        1         |        2         |        3           |

| segments |                  |                  |                    |

-----------------------------------------------------------------------

|duplicate |        3         |        1         |        2           |

|segments 1|                  |                  |                    |

=======================================================================

 


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69980090/viewspace-2724502/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2020-09-27

  • 博文量
    2
  • 访问量
    784