名称 | 值 |
---|---|
cpu | Intel® Core™ i5-1035G1 CPU @ 1.00GHz |
操作系统 | CentOS Linux release 7.9.2009 (Core) |
内存 | 4G |
逻辑核数 | 3 |
节点1-IP | 192.168.142.10 |
节点2-IP | 192.168.142.11 |
数据库版本 | 8.6.2.43-R33.132743 |
[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: 4 | 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 | |
========================================================================================================================
我们可以看到没有副本存在。
[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 1
gcadmin generate distribution ...
gcadmin generate distribution successful
[gbase@localhost gcinstall]$ gcadmin showdistribution
Distribution ID: 5 | 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 |
------------------------------------------------------------------------------------------------------------------------
| 192.168.142.10 | 2 | 192.168.142.11 |
========================================================================================================================
Distribution ID: 4 | State: old | Total segment num: 2
Primary Segment Node IP Segment ID Duplicate Segment node IP
========================================================================================================================
| 192.168.142.11 | 1 | |
------------------------------------------------------------------------------------------------------------------------
| 192.168.142.10 | 2 | |
========================================================================================================================
新的分布策略ID:5
老的分布策略ID:4
[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)
重分布支持instance, database、table三种等级。
gbase> rebalance instance;
Query OK, 1 row affected (Elapsed: 00:00:00.25)
gbase> select * from gclusterdb.rebalancing_status;
+------------------------------+------------+-------------------+----------+----------------------------+----------------------------+-----------+------------+----------+-----------------------+-----------------+
| index_name | db_name | table_name | tmptable | start_time | end_time | status | percentage | priority | host | distribution_id |
+------------------------------+------------+-------------------+----------+----------------------------+----------------------------+-----------+------------+----------+-----------------------+-----------------+
| gclusterdb.audit_log_express | gclusterdb | audit_log_express | | 2022-08-12 16:47:08.211000 | 2022-08-12 16:47:09.130000 | COMPLETED | 100 | 5 | ::ffff:192.168.142.10 | 5 |
| czg.czg | czg | czg | | 2022-08-12 16:47:08.207000 | 2022-08-12 16:47:09.162000 | COMPLETED | 100 | 5 | ::ffff:192.168.142.10 | 5 |
+------------------------------+------------+-------------------+----------+----------------------------+----------------------------+-----------+------------+----------+-----------------------+-----------------+
2 rows in set (Elapsed: 00:00:00.01)
gbase> select * from gbase.table_distribution where data_distribution_id=4;
Empty set (Elapsed: 00:00:00.00)
如果有的话,请使用rebalance table 库名.表名,重新分布表。
gbase> refreshnodedatamap drop 4;
Query OK, 0 rows affected (Elapsed: 00:00:00.85)
[gbase@localhost gcinstall]$ gcadmin rmdistribution 4
cluster distribution ID [4]
it will be removed now
please ensure this is ok, input y or n: y
gcadmin remove distribution [4] success
各节点状态正常,分布策略是最新的,有副本信息,说明我们添加数据副本成功啦。
[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: 5 | 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 |
------------------------------------------------------------------------------------------------------------------------
| 192.168.142.10 | 2 | 192.168.142.11 |
========================================================================================================================