南大通用GBase 8a 保留IPv6原样功能的安装和扩容记录

GBase 8a从从V82Build43开始支持ipv6,有别于ipv4只有数字和点,ipv6包含字母,且有缩写形式,为了方便客户对IP做字符串对比,所以新版本将【忠实保留】客户填写的ipv6地址原样,除了字母根据linux习惯变成小写。

老版本的ipv6会自动压缩,并且在不足4位的部分补足前面的0, 比如

1:2:0:0::8
会变成
0001:0002::0008

本文目标

1、新建一个ipv6单节点,因为我只有3个虚拟机。

2、扩容2个,变成3节点集群

3、ipv6地址有各种写法,看最终结果是否保留了原样。

ipv6集群安装

过程和参数不再解释,直接提供安装过程记录。 IP是 2cd:2:3:4:5:6:7:102。

[root@localhost gcinstall_952435_p3]# cat demo.options
installPrefix= /opt/gbase
coordinateHost = 2cd:2:3:4:5:6:7:102
coordinateHostNodeID = 102
dataHost = 2cd:2:3:4:5:6:7:102
#existCoordinateHost =
#existDataHost =
dbaUser = gbase
dbaGroup = gbase
dbaPwd = 'gbase1234'
rootPwd = ''
#dbRootPwd = ''
#rootPwdFile = rootPwd.json
[root@localhost gcinstall_952435_p3]#


Do you accept the above licence agreement ([Y,y]/[N,n])? y
*********************************************************************************
                     Welcome to install GBase products
*********************************************************************************
Environmental Checking on gcluster nodes.
CoordinateHost:
2cd:2:3:4:5:6:7:102
DataHost:
2cd:2:3:4:5:6:7:102
Are you sure to install GCluster on these nodes ([Y,y]/[N,n])?

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

======================================================================
|               GBASE COORDINATOR CLUSTER INFORMATION                |
======================================================================
|   NodeName   |      IpAddress      | gcware | gcluster | DataState |
----------------------------------------------------------------------
| coordinator1 | 2cd:2:3:4:5:6:7:102 |  OPEN  |   OPEN   |     0     |
----------------------------------------------------------------------
====================================================================
|             GBASE CLUSTER FREE DATA NODE INFORMATION             |
====================================================================
| NodeName  |      IpAddress      | gnode | syncserver | DataState |
--------------------------------------------------------------------
| FreeNode1 | 2cd:2:3:4:5:6:7:102 | OPEN  |    OPEN    |     0     |
--------------------------------------------------------------------

0 virtual cluster
1 coordinator node
1 free data node



[gbase@localhost gcinstall_952435_p3]$ gcadmin distribution gcChangeInfo.xml p 1 d 0
gcadmin generate distribution ...

[warning]: parameter [d num] is 0, the new distribution will has no segment backup
please ensure this is ok, input [Y,y] or [N,n]: y
NOTE: node [2cd:2:3:4:5:6:7:102] is coordinator node, it shall be data node too
gcadmin generate distribution successful

[gbase@localhost gcinstall_952435_p3]$ gccli

GBase client 9.5.2.43.5_patch.39555014. Copyright (c) 2004-2022, GBase.  All Rights Reserved.

gbase> create database testdb;
ERROR 1707 (HY000): gcluster command error: (GBA-02CO-0003) nodedatamap is not initialized.
gbase> initnodedatamap;
Query OK, 0 rows affected (Elapsed: 00:00:00.23)

gbase> create database testdb;
Query OK, 1 row affected (Elapsed: 00:00:00.00)

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

gbase> create table t as select now() d from dual;
Query OK, 1 row affected (Elapsed: 00:00:00.38)

gbase> select * from t;
+---------------------+
| d                   |
+---------------------+
| 2022-09-27 07:34:02 |
+---------------------+
1 row in set (Elapsed: 00:00:00.01)

gbase> ^CAborted
[gbase@localhost gcinstall_952435_p3]$

ipv6集群扩容记录

新扩容的2个IP分别是

2cd:2:3:4:5:6:7:202
2cd:02:003:0004:5:06:007:203

请注意第二个IP的写法,故意增加了各种前置0

[gbase@localhost gcinstall_952435_p3]$ cat add.option
installPrefix= /opt/gbase
coordinateHost = 2cd:2:3:4:5:6:7:202,2cd:02:003:0004:5:06:007:203
coordinateHostNodeID = 202,203
dataHost = 2cd:2:3:4:5:6:7:202,2cd:02:003:0004:5:06:007:203
existCoordinateHost = 2cd:2:3:4:5:6:7:102
existDataHost = 2cd:2:3:4:5:6:7:102
dbaUser = gbase
dbaGroup = gbase
dbaPwd = 'gbase1234'
rootPwd = ''
#dbRootPwd = ''
#rootPwdFile = rootPwd.json
[gbase@localhost gcinstall_952435_p3]$ ./gcinstall.py --silent=add.option
*********************************************************************************
Do you accept the above licence agreement ([Y,y]/[N,n])? y
*********************************************************************************
                     Welcome to install GBase products
*********************************************************************************
Environmental Checking on gcluster nodes.
CoordinateHost:
2cd:2:3:4:5:6:7:202    2cd:02:003:0004:5:06:007:203
DataHost:
2cd:2:3:4:5:6:7:202    2cd:02:003:0004:5:06:007:203
Are you sure to install GCluster on these nodes ([Y,y]/[N,n])? y


2cd:2:3:4:5:6:7:102     install cluster on host 2cd:2:3:4:5:6:7:102 successfully.
2cd:02:003:0004:5:06:007:203    install cluster on host 2cd:02:003:0004:5:06:007:203 successfully.
2cd:2:3:4:5:6:7:202     install cluster on host 2cd:2:3:4:5:6:7:202 successfully.
update and sync configuration file...
Starting all gcluster nodes...
sync coordinator system tables ...
check database user and password ...
check database user and password successful
check rsync command status on available coordinator and new coordinator
use rsync command sync metadata
adding new datanodes to gcware...
ExtendCluster Successfully.
[gbase@localhost gcinstall_952435_p3]$




[gbase@localhost gcinstall_952435_p3]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

===============================================================================
|                    GBASE COORDINATOR CLUSTER INFORMATION                    |
===============================================================================
|   NodeName   |          IpAddress           | gcware | gcluster | DataState |
-------------------------------------------------------------------------------
| coordinator1 |     2cd:2:3:4:5:6:7:102      |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------------------------
| coordinator2 |     2cd:2:3:4:5:6:7:202      |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------------------------
| coordinator3 | 2cd:02:003:0004:5:06:007:203 |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |           2cd:2:3:4:5:6:7:102            |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |           2cd:2:3:4:5:6:7:202            |                | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |       2cd:02:003:0004:5:06:007:203       |                | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

[gbase@localhost gcinstall_952435_p3]$
[gbase@localhost gcinstall_952435_p3]$ cat gcChangeInfo.xml
<?xml version="1.0" encoding="utf-8"?>
<servers>
 <rack>
  <node ip="2cd:2:3:4:5:6:7:202"/>
  <node ip="2cd:02:003:0004:5:06:007:203"/>
  <node ip="2cd:2:3:4:5:6:7:102"/>
 </rack>
</servers>
[gbase@localhost gcinstall_952435_p3]$ gcadmin distribution gcChangeInfo.xml  p 1 d 1
gcadmin generate distribution ...

NOTE: node [2cd:2:3:4:5:6:7:202] is coordinator node, it shall be data node too
NOTE: node [2cd:02:003:0004:5:06:007:203] is coordinator node, it shall be data node too
copy system table to 2cd:2:3:4:5:6:7:202
copy system table to 2cd:02:003:0004:5:06:007:203
gcadmin generate distribution successful

[gbase@localhost gcinstall_952435_p3]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

===============================================================================
|                    GBASE COORDINATOR CLUSTER INFORMATION                    |
===============================================================================
|   NodeName   |          IpAddress           | gcware | gcluster | DataState |
-------------------------------------------------------------------------------
| coordinator1 |     2cd:2:3:4:5:6:7:102      |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------------------------
| coordinator2 |     2cd:2:3:4:5:6:7:202      |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------------------------
| coordinator3 | 2cd:02:003:0004:5:06:007:203 |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |           2cd:2:3:4:5:6:7:102            |      1,2       | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |           2cd:2:3:4:5:6:7:202            |       2        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |       2cd:02:003:0004:5:06:007:203       |       2        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

[gbase@localhost gcinstall_952435_p3]$


[gbase@localhost gcinstall_952435_p3]$ gccli

GBase client 9.5.2.43.5_patch.39555014. Copyright (c) 2004-2022, GBase.  All Rights Reserved.

gbase> initnodedatamap;
Query OK, 0 rows affected, 4 warnings (Elapsed: 00:00:00.83)

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

gbase> refreshnodedatamap drop 1;
Query OK, 0 rows affected, 6 warnings (Elapsed: 00:00:01.38)

gbase> exit
Bye
[gbase@localhost gcinstall_952435_p3]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

===============================================================================
|                    GBASE COORDINATOR CLUSTER INFORMATION                    |
===============================================================================
|   NodeName   |          IpAddress           | gcware | gcluster | DataState |
-------------------------------------------------------------------------------
| coordinator1 |     2cd:2:3:4:5:6:7:102      |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------------------------
| coordinator2 |     2cd:2:3:4:5:6:7:202      |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------------------------
| coordinator3 | 2cd:02:003:0004:5:06:007:203 |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |           2cd:2:3:4:5:6:7:102            |      1,2       | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |           2cd:2:3:4:5:6:7:202            |       2        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |       2cd:02:003:0004:5:06:007:203       |       2        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

[gbase@localhost gcinstall_952435_p3]$ gcadmin rmdistribution 1
cluster distribution ID [1]
it will be removed now
please ensure this is ok, input [Y,y] or [N,n]: y
gcadmin remove distribution [1] success
[gbase@localhost gcinstall_952435_p3]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

===============================================================================
|                    GBASE COORDINATOR CLUSTER INFORMATION                    |
===============================================================================
|   NodeName   |          IpAddress           | gcware | gcluster | DataState |
-------------------------------------------------------------------------------
| coordinator1 |     2cd:2:3:4:5:6:7:102      |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------------------------
| coordinator2 |     2cd:2:3:4:5:6:7:202      |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------------------------
| coordinator3 | 2cd:02:003:0004:5:06:007:203 |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |           2cd:2:3:4:5:6:7:102            |       2        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |           2cd:2:3:4:5:6:7:202            |       2        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |       2cd:02:003:0004:5:06:007:203       |       2        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

[gbase@localhost gcinstall_952435_p3]$
[gbase@localhost gcinstall_952435_p3]$ gccli

GBase client 9.5.2.43.5_patch.39555014. Copyright (c) 2004-2022, GBase.  All Rights Reserved.

gbase> seelct * from testdb.t;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your GBase server version for the right syntax to use near 'seelct * from testdb.t' at line 1
gbase> select * from testdb.t;
+---------------------+
| d                   |
+---------------------+
| 2022-09-27 07:34:02 |
+---------------------+
1 row in set (Elapsed: 00:00:00.09)

总结

GBase 8a考虑到了ipv6包含字母的特殊性,将完整保留客户输入的地址,方便应用做对比和判断。

注意:该ipv6的功能需要新的版本,请提前和厂商确认。