GBase Database (GBase数据库) is a high-performance, scalable, and distributed relational database designed to meet the demands of large-scale data processing and complex analytics.
Overview
gcadmin is a Linux command-line tool designed specifically for DBAs to manage and operate database clusters. By using the gcadmin <command> [parameter1[, parameter2...]] command, users can manage clusters, virtual clusters (VCs), nodes, distribution information, and synchronization logs, among other functions.
This article provides a detailed introduction to the main features and usage of the GBase 8a Cluster Management Tool, helping users understand the basic operations and scenarios where the tool can be applied.
Cluster Management
Cluster Status
GBase 8a supports using the cluster management tool to view the cluster status, displaying information such as the name, ID, distribution, remarks, coordinator node, and data node for all VCs in the current cluster.
Syntax:
gcadmin showcluster [c | vc vcname] [d] [g] [f]
Parameters:
c: Only display coordinator nodes when showing nodes.
vc_name: Specify the VC name to display; only one VC can be specified. If no VC is specified, information for all VCs will be shown.
d: Only display the corresponding data nodes. If no VC is specified, it shows the free nodes of the VC; if a VC is specified, it shows that VC’s data nodes.
f: Display the information in XML format.
Note:
- In multi-VC mode, executing
gcadmin showcluster vcis required to show the corresponding VC’s cluster mode information. If no VC is specified, the cluster mode will not be shown. - This requirement does not apply in compatibility mode.
The cluster status command provides the following information:
DDL is used to recover metadata. After recovery, gcrecover notifies gcware, which deletes the corresponding DDLEVENT.
Command to view DDLEvent error logs:
gcadmin showddlevent [<table_name segment_name node_ip>|<max_return_count>]
Parameters:
table_name: In the formatdbname.tablename.
segment_name: The segment name of the table partition. For example, for a distributed table namedt, the partition name on the first node isn1, on the second node it isn2, and so on.
node_ip: The IP of the node machine.
max_return_count: If not specified, the default is 16 rows. Additional events will not be shown.
2. DML & DMLEVENT Execution Mechanism
When a partition experiences physical damage or is lost, it is marked as a STORAGEEVENT. GBase 8a first sets a DMLEvent to attempt recovery. If recovery fails (e.g., due to missing tables or unreadable metadata), the event is upgraded to DMLStorageEvent.
The recovery process involves first using DDLEvent recovery, followed by DMLEvent recovery.
Command to view DMLStorageEvent logs:
gcadmin showdmlevent [<table_name segment_name node_ip>|<max_return_count>]
Parameters: Same as for DDLEvent logs.
4. Deleting FEVENT Logs
Before performing a node replacement, use this command to delete all FEVENT logs for nodes marked as unavailable (including DDL, DML, and DMLStorage FEVENT logs).
Syntax:
gcadmin rmfeventlog <ip>
Parameter:
ip: The IP of the node to delete FEVENT logs.
Note:
Be cautious when using this command. It should only be used during node replacement operations.
5. FAILOVER Mechanism
When the managing node fails and cannot complete an SQL operation, the takeover node will read the SQL execution information recorded in gcware and continue execution. This process is known as the failover mechanism for the managing node.
Command to display failover information:
gcadmin showfailover
The failover information contains the following fields: Commit ID, Database name, Table name, SCN number, Type, Create time, State, Original node, Takeover node, and Takeover count.
Parameters:
Lock name: The lock name in the formatdbname.tablename.lock_name.
Owner: The IP of the lock owner.
Content: A remark describing the lock.
Create time: The time the lock was created.
Locked:True/False.
Type: Shared or exclusive lock.
Other
- View running threads:
show processlist
Kill thread:
KILL [CONNECTION | QUERY] thread_id
CONNECTION: Default, used to terminate the specifiedthread_idthread.
QUERY: Abort the currently executing statement, but do not terminate the connection itself.
Virtual Cluster (VC) Management
1. Create VC
Syntax:
gcadmin createvc <create_vc.xml | e example_file_name>
Parameters:
create_vc.xml: Configuration file used to create the VC, including data node IP, VC name, and comment.
e example_file_name: Generate an example configuration file without creating a VC.
Note:
Before creating a VC, ensure the cluster is running normally, that free data nodes exist in the root cluster, and that multiple VCs cannot share GNODE nodes.
2. Delete VC
Syntax:
gcadmin rmvc <vc_name>
Note:
Before deleting a VC, manually delete its resource management information from the GBase database. The following tables store this information:
consumer_group,consumer_group_user,resource_plan,resource_pool,resource_plan_directive,resource_config,resource_pool_events,cluster_resource_pool_usage_history.
3. Start VC
Syntax:
gcadmin startvc <vc_name1 vc_name2 ...> <os_dba_user_name os_dba_password>
Note:
Multiple virtual clusters can be started simultaneously. The command must be executed using the dbaUser specified in the demo.options file, and the VC names must be provided when executing the command.
4. Stop VC
Syntax:
gcadmin stopvc <vc_name1 vc_name2 ...> <os_dba_user_name os_dba_password>
Note:
Multiple virtual clusters can be stopped simultaneously. The command must be executed using the dbaUser specified in the demo.options file, and the VC names must be provided when executing the command.
5. Import VC
This command imports another cluster into the current cluster, adding a new VC and several physical nodes for unified management.
Syntax:
gcadmin importvc [e] <config_file_name>
Parameters:
config_file_name: Command configuration file for importing the VC
e example_file_name: Generate a sample configuration file. If this parameter is used, the import will not be executed.
Note:
- The imported cluster must be a virtual cluster version, and only one VC can be imported at a time.
- The coordinator and data mixed nodes from the original cluster will become data nodes in the current cluster. All data nodes will join the new VC and generate the same shard distribution information as the original cluster.
- Pure coordinator nodes from the original cluster will not be imported into the root cluster.
If you have any further questions or need additional assistance about GBase Database (GBase数据库), feel free to reach out!
SOCIAL SHARE CARD GENERATOR