南大通用GBase 8a V95版本更改VC名字的方法renamevc

GBase 8a数据库从V95版本开始支持虚拟集群(VC)以实现统一管理多个物理资源隔离的集群,其中带来的改动就是增加了VC名字这一层。本文介绍如何修改VC的名字。

语法

gcadmin renamevc <old_vc_name> <new_vc_name> 

说明

通过集群命令行管理工具gcadmin 的renamevc命令,进行重命名。其中old_vc_name是现有vc的名字, new_vc_name是改名后的新名字。

查看当前vc列表,可以用过gcadmin输出。如下是1个vc,名字分别是vc01和vc02。

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

=============================================================
|           GBASE COORDINATOR CLUSTER INFORMATION           |
=============================================================
|   NodeName   | IpAddress  | gcware | gcluster | DataState |
-------------------------------------------------------------
| coordinator1 | 10.0.2.101 |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------
===========================================================
|            GBASE VIRTUAL CLUSTER INFORMATION            |
===========================================================
|    VcName    | DistributionId |         comment         |
-----------------------------------------------------------
|     vc01     |       1        | first vc with one node  |
-----------------------------------------------------------
|     vc02     |       2        | second vc with one node |
-----------------------------------------------------------

2 virtual cluster: vc01, vc02
1 coordinator node
0 free data node

样例

如下样例,将名字为vc01的改名为vc1。通过gcadnin查看,名字确实已经改变。

[gbase@gbase_rh7_001 ~]$ gcadmin renamevc vc01 vc1
gcadmin rename vc [vc01] to [vc1] successful

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

=============================================================
|           GBASE COORDINATOR CLUSTER INFORMATION           |
=============================================================
|   NodeName   | IpAddress  | gcware | gcluster | DataState |
-------------------------------------------------------------
| coordinator1 | 10.0.2.101 |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------
===========================================================
|            GBASE VIRTUAL CLUSTER INFORMATION            |
===========================================================
|    VcName    | DistributionId |         comment         |
-----------------------------------------------------------
|     vc1      |       1        | first vc with one node  |
-----------------------------------------------------------
|     vc02     |       2        | second vc with one node |
-----------------------------------------------------------

2 virtual cluster: vc1, vc02
1 coordinator node
0 free data node

总结

虽然renamevc可以很方便的修改vc名字,但因为涉及到业务,特别是跨vc的,需要慎重,避免修改后业务都无法运行了。

另外,数据库内部权限是用过vcid而不是vcname进行控制,修改名字并不会导致安全问题。

查看vcid的方法,请参考 GBase 8a的show命令列表和使用 里的show vcs命令