南大通用GBase 8a多实例9.5.3版本扩容实例操作手顺

本文测试,在GBase 8a 9.5.3多实例版本,增加IP后扩容实例操作受训,不是扩容节点。

环境

单节点,3 IP,安装过程请参考 GBase 8a多实例版本9.5.3安装实例和运维常用命令

[gbase@gbase_rh7_003 ~]$ 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        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |                10.0.2.105                |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

扩容方案

增加一个实例,IP为10.0.2.106

增加IP

在网卡配置文件里增加新的IP即可。

[gbase@gbase_rh7_003 ~]$ vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
[gbase@gbase_rh7_003 ~]$ exit
logout
[root@gbase_rh7_003 ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
[root@gbase_rh7_003 ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s3
UUID=054d2f84-2976-45a6-baa2-1420019b55f5
DEVICE=enp0s3
ONBOOT=yes
DNS1=114.114.114.114
IPADDR1=10.0.2.105
PREFIX1=24
IPADDR=10.0.2.103
PREFIX=24
IPADDR2=10.0.2.104
PREFIX2=24

IPADDR3=10.0.2.106
PREFIX3=24

GATEWAY=10.0.2.2
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
[root@gbase_rh7_003 ~]#
[root@gbase_rh7_003 ~]# service network restart
Shutting down interface enp0s3:  Device 'enp0s3' successfully disconnected.
                                                           [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface enp0s3:  Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)
                                                           [  OK  ]
[root@gbase_rh7_003 ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:8e:d9:28 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.103/24 brd 10.0.2.255 scope global enp0s3
       valid_lft forever preferred_lft forever
    inet 10.0.2.104/24 brd 10.0.2.255 scope global secondary enp0s3
       valid_lft forever preferred_lft forever
    inet 10.0.2.105/24 brd 10.0.2.255 scope global secondary enp0s3
       valid_lft forever preferred_lft forever
    inet 10.0.2.106/24 brd 10.0.2.255 scope global secondary enp0s3
       valid_lft forever preferred_lft forever
    inet6 fe80::ab19:72ea:2472:cc28/64 scope link
       valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
    link/ether 52:54:00:4a:d6:8a brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 1000
    link/ether 52:54:00:4a:d6:8a brd ff:ff:ff:ff:ff:ff
[root@gbase_rh7_003 ~]#

修改配置文件

在新增dataHost里,添加新的IP. 后面exists的各个参数,按照现有情况填写。

[gbase@gbase_rh7_003 gcinstall]$ cp demo.options  demo_2.options
[gbase@gbase_rh7_003 gcinstall]$ vi demo_2.options
[gbase@gbase_rh7_003 gcinstall]$ cat demo_2.options
installPrefix= /opt/gbase
coordinateHost =
coordinateHostNodeID =
dataHost = 10.0.2.106
existCoordinateHost =10.0.2.103
existDataHost =10.0.2.103,10.0.2.104,10.0.2.105
existGcwareHost=10.0.2.103
gcwareHost =
gcwareHostNodeID =
dbaUser = gbase
dbaGroup = gbase
dbaPwd = 'gbase1234'
rootPwd = ''
#rootPwdFile = rootPwd.json
#characterSet = utf8
#dbPort = 5258
#sshPort = 22
[gbase@gbase_rh7_003 gcinstall]$

扩容安装

这部分的操作,和安装是一样的。

[gbase@gbase_rh7_003 gcinstall]$ ./gcinstall.py --silent=demo_2.options
*********************************************************************************
Thank you for choosing GBase product!
。。。。。
*********************************************************************************
Do you accept the above licence agreement ([Y,y]/[N,n])? y
*********************************************************************************
                     Welcome to install GBase products
*********************************************************************************
Environmental Checking on cluster nodes.
checking rpms ...
checking gconfig service
CoordinateHost:
DataHost:
10.0.2.106
Are you sure to install GCluster on these nodes ([Y,y]/[N,n])?
 y
。。。。。。
10.0.2.106              install cluster on host 10.0.2.106 successfully.
update and sync configuration file...
sync cluster conf file ...
Starting all gcluster nodes ...
adding new datanodes to gcware ...
[gbase@gbase_rh7_003 gcinstall]$

完成后可以看到新增加的node节点信息。

[gbase@gbase_rh7_003 ~]$ 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        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |                10.0.2.105                |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node4   |                10.0.2.106                |                | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

[gbase@gbase_rh7_003 ~]$ 

扩容和重分布

新增加一个分布策略

[gbase@gbase_rh7_003 gcinstall]$ cat gcChangeInfo.xml
<?xml version="1.0" encoding="utf-8"?>
<servers>
    <rack>
        <node ip="10.0.2.103"/>
        <node ip="10.0.2.104"/>
        <node ip="10.0.2.105"/>
        <node ip="10.0.2.106"/>
    </rack>
</servers>
[gbase@gbase_rh7_003 gcinstall]$ gcadmin distribution gcChangeInfo.xml p 1 d 1
gcadmin generate distribution ...

copy system table to 10.0.2.106
gcadmin generate distribution successful

[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,2       | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |                10.0.2.105                |      1,2       | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node4   |                10.0.2.106                |       2        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

[gbase@gbase_rh7_003 gcinstall]$

初始化和重分布

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

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

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

gbase> show tables;
+----------------------+
| Tables_in_gclusterdb |
+----------------------+
| dual                 |
| rebalancing_status   |
+----------------------+
2 rows in set (Elapsed: 00:00:00.00)

gbase> desc rebalancing_status;
+-----------------+--------------+------+-----+---------+-------+
| Field           | Type         | Null | Key | Default | Extra |
+-----------------+--------------+------+-----+---------+-------+
| index_name      | varchar(129) | YES  |     | NULL    |       |
| db_name         | varchar(64)  | YES  |     | NULL    |       |
| table_name      | varchar(64)  | YES  |     | NULL    |       |
| tmptable        | varchar(129) | YES  |     | NULL    |       |
| start_time      | datetime     | YES  |     | NULL    |       |
| end_time        | datetime     | YES  |     | NULL    |       |
| status          | varchar(32)  | YES  |     | NULL    |       |
| percentage      | int(11)      | YES  |     | NULL    |       |
| priority        | int(11)      | YES  |     | NULL    |       |
| host            | varchar(60)  | YES  |     | NULL    |       |
| distribution_id | bigint(8)    | YES  |     | NULL    |       |
+-----------------+--------------+------+-----+---------+-------+
11 rows in set (Elapsed: 00:00:00.00)

gbase> select status,count(*) from gclusterdb.rebalancing_status group by status;
+-----------+----------+
| status    | count(*) |
+-----------+----------+
| COMPLETED |        1 |
+-----------+----------+
1 row in set (Elapsed: 00:00:00.11)

等待重分布完成。

gbase> select status,count(*) from gclusterdb.rebalancing_status group by status;
+-----------+----------+
| status    | count(*) |
+-----------+----------+
| COMPLETED |        1 |
+-----------+----------+
1 row in set (Elapsed: 00:00:00.11)

清理

等待重分布完成后,清理不再使用的分布策略。

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

gbase> ^CAborted
[gbase@gbase_rh7_003 gcinstall]$ 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@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                |       2        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |                10.0.2.104                |       2        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |                10.0.2.105                |       2        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node4   |                10.0.2.106                |       2        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

[gbase@gbase_rh7_003 gcinstall]$

参考

GBase 8a多实例版本9.5.3安装实例和运维常用命令

GBase 8a多实例9.5.3版本扩容实例操作手顺

GBase 8a多实例版本9.5.3变动介绍