南大通用8a数据库 – gcadmin命令详解

90次阅读
没有评论

南大通用 8a 数据库 - gcadmin 命令详解

1、获取帮助

执行 gcadmin -h

会返回一个帮助页面

 

Usage: gcadmin <command> [arg1[, arg2...]]

1. gcadmin distribution <gcChangeInfo.xml> <p num> [d num] [extension] [pattern 1|2]
[db_user user_name] [db_pwd password] [dba_os_password password]
[vc vc_name] : generate distribution, db_user and db_pwd shall input
if database password changed and new distribution data nodes
more than old distribution
2. gcadmin rmdistribution [ID] [vc vc_name] : remove distribution from vc
3. gcadmin addnodes gcChangeInfo.xml [vc_name | single_vc_add_to_rc] : add nodes to cluster or vc, parameter [single_vc_add_to_rc] used for single vc mode add nodes to root cluster
4. gcadmin rmnodes gcChangeInfo.xml [vc_name | single_vc_rm_to_rc] : remove nodes from cluster or vc, parameter [single_vc_rm_to_rc] used for single vc mode remove nodes from default vc to root cluster
5. gcadmin showdistribution [node | f] [vc vc_name] : show cluster distribution, or segments on nodes when
use parameter [node],
[vc vc_name] is unnecessary if only one vc
6. gcadmin switchmode <mode> [vc vc_name | coordinator] : switch cluster mode, mode take value in
[normal | readonly | recovery],
[vc vc_name] is unnecessary if only one vc
7. gcadmin showlock [f] : show current cluster lock information,
include lock name, lock owner ip address, etc
8. gcadmin showddlevent [detail] [<tablename segname nodeip> | <tablename nodeip> | <max_fevent_num>]
[f] [vc vc_name] : show cluster ddl fail event,
replicated table segname is [n0],
[vc vc_name] is unnecessary if only one vc
9. gcadmin showdmlevent [detail] [<tablename segname nodeip> | <max_fevent_num>] [f] [vc vc_name] : show current cluster dml fail event, replicated table segname is [n0],
[vc vc_name] is unnecessary if only one vc
10. gcadmin showdmlstorageevent [detail] [[table_id segname nodeip] | <max_fevent_num>] [f] [vc vc_name] : show current cluster dml storage fail event,
replicated table segname is [n0],
[vc vc_name] is unnecessary if only one vc
11. gcadmin showcluster [c | vc vcname] [d] [g] [f] [nrt] : show vc or cluster information, include all nodes,
cluster state and cluster node information
12. gcadmin getdistribution <ID> <distribution_info.xml> [vc vc_name] : get distribution information
13. gcadmin setnodestate ip <state> : set one node state,state take value in: failure unavailable normal
14. gcadmin showfailover [f] : show failover information
15. gcadmin showfailoverdetail <commitId> [xml_file_name] : write failover information to file [xml_file_name]
16. gcadmin createvc <create_vc.xml | e example_file_name> : create virtual cluster
17. gcadmin rmvc <vc_name> : remove virtual cluster
18. gcadmin importvc <import_vc.xml | e example_file_name> : import vc_name corresponding vc to current vc
19. gcadmin startvc <vc_name1 vc_name2 ...> <os_dba_user_name> <os_dba_password> : start virtual cluster
20. gcadmin stopvc <vc_name1 vc_name2 ...> <os_dba_user_name> <os_dba_password> : stop virtual cluster
21. gcadmin renamevc <old_vc_name> <new_vc_name> : rename virtual cluster
22. gcadmin rmfeventlog ip : remove all feventlog about ip
23. gcadmin --help : show help info
24. gcadmin -V,--version : show version info

 

2、查看集群

gcadmin showcluster [c] [d] [g] [f] [nrt]参数:
c:显示节点时仅显示 gcluster 节点;

d: 显示节点时仅显示相应的 gnode 节点;

g: 显示节点时仅显示 gcware 节点;

f:指明按 xml 格式显示信息;

nrt: no-real time 显示上一次 gcadmin 的结果;

 

可以执行 gcadmin showcluster 或者 gcadmin showcluster node 对当前集群进行查看

 

$ gcadmin showdistribution

Distribution ID: 1 | State: new | Total segment num: 2

Primary Segment Node IP Segment ID Duplicate Segment node IP
========================================================================================================================
| 172.27.78.79 | 1 | 172.27.78.78 |
------------------------------------------------------------------------------------------------------------------------
| 172.27.78.78 | 2 | 172.27.78.79 |
========================================================================================================================
$ gcadmin showdistribution node
Distribution ID: 1 | State: new | Total segment num: 2

============================================================================================
| nodes | 172.27.78.79 | 172.27.78.78 |
--------------------------------------------------------------------------------------------
| primary | 1 | 2 |
| segments | | |
--------------------------------------------------------------------------------------------
|duplicate | 2 | 1 |
|segments 1| | |
============================================================================================

 

3、查看集群状态

可以直接执行

gcadmin 即可,效果图可以见安装时的 帖子

 

另外 gcadmin 命令后出现 state 和 mode

state 包含 Active(正常模式)和 shrinkOnly(空间快满了)

mode 包括 nomal、readonly、recovery 模式,可以手动进行切换。

 

4、查看各种错误

4.1DDL 数据出现不一致

gcadmin showddlevent  #可以查看 ddl 的事件

 

4.2 DML 数据不一致

同上,执行

gcadmin showdmlevent #查看 dml 的事件

 

4.3 故障节点元数据损坏

gcadmin showdmlstorageevent #查看故障节点元数据事件

 

4.4. 查看故障回退日志

gcadmin showfailover #节点可以根据此日志回退

 

5、创建分布信息表

此处在集成 Gbase 8a 的时候使用过,可以参考此 教程

 

6、导出分布信息表

gcadmin getdistribution  <id>  xmlinfoName.xml  #会按照 id 号导出一个 xml 文件

该操作可以用于导出一个 xml 信息表,可以用作后期的节点替换,扩容等操作。

 

7、删除分布信息表

gcadmin rmdistribution [ID]  #危险操作,至今没有操作过
正文完
 
评论(没有评论)
验证码