Manager Handbook for Distributed AntDB-T - P1
Tags: database
Published: 2023-07-25 09:14:02

## Reading Instructions

This document is a general guidance document, users may need to replace and modify it according to the actual situation when referring to the following.

- IP address
- Directory name, directory path
- User name

Special reminder.

**In the psql client, you can quickly get help information for this command via`\h cmd`.**

## Manage AntDB Cluster

The content in this chapter is aimed for AntDB cluster version.

In order to facilitate the management of AntDB clusters, adbmgr provides a series of operation commands. The commands can be divided into the following six categories according to their functions: 

- agent-related commands
- host table related commands
- node table related commands
- param table related commands
- hba table related commands
- Cluster management related commands

The following describes the function and format of each of these commands.

### help command

In the process of managing AntDB cluster, if you don't understand the format or function of a command, you can check the function description and command format by help command.

You can view the list of all commands currently supported by adbmgr by simply executing the command `\h` in psql client, as follows: 

```sql
postgres=# \h 
Available help: 
  ADBMGR PROMOTE              ALTER ITEM                  CLEAN GTMCOORD              DROP USER                   LIST PARAM                  RESET COORDINATOR           START ALL 
  ADD COORDINATOR             ALTER JOB                   CLEAN MONITOR               FAILOVER DATANODE           MONITOR AGENT               RESET DATANODE              START COORDINATOR 
  ADD DATANODE                ALTER USER                  CONFIG DATANODE             FAILOVER GTMCOORD           MONITOR ALL                 RESET GTMCOORD              START DATANODE 
  ADD GTMCOORD                APPEND ACTIVATE COORDINATOR CREATE USER                 FLUSH HOST                  MONITOR COORDINATOR         REVOKE                      START GTMCOORD 
  ADD HBA                     APPEND COORDINATOR          DEPLOY                      GRANT                       MONITOR DATANODE            REWIND DATANODE             STOP AGENT 
  ADD HOST                    APPEND COORDINATOR FOR      DROP COORDINATOR            INIT ALL                    MONITOR GTMCOORD            REWIND GTMCOORD             STOP ALL 
  ADD ITEM                    APPEND DATANODE             DROP DATANODE               LIST ACL                    MONITOR HA                  SET CLUSTER INIT            STOP COORDINATOR 
  ADD JOB                     APPEND GTMCOORD             DROP GTMCOORD               LIST HBA                    PROMOTE DATANODE            SET COORDINATOR             STOP DATANODE 
  ALTER COORDINATOR           CHECKOUT DN SLAVE STATUS    DROP HBA                    LIST HOST                   PROMOTE GTMCOORD            SET DATANODE                STOP GTMCOORD 
  ALTER DATANODE              CLEAN ALL                   DROP HOST                   LIST ITEM                   REMOVE COORDINATOR          SET GTMCOORD                SWITCHOVER DATANODE 
  ALTER GTMCOORD              CLEAN COORDINATOR           DROP ITEM                   LIST JOB                    REMOVE DATANODE             SHOW                        SWITCHOVER GTMCOORD 
  ALTER HOST                  CLEAN DATANODE              DROP JOB                    LIST NODE                   REMOVE GTMCOORD             START AGENT                  
postgres=#   
```

You can also view the function and format of a specified command by adding a specific command name after `\h`. The following `\h start` shows the start-related commands: 

```sql
postgres=# \h start 
Command:     START AGENT 
Description: start the agent process on the ADB cluster 
Syntax: 
START AGENT { ALL | host_name [, ...] } [ PASSWORD passwd ] 
 
Command:     START ALL 
Description: start all the nodes on the ADB cluster 
Syntax: 
START ALL 
 
Command:     START COORDINATOR 
Description: start the coordinator node type on the ADB cluster 
Syntax: 
START COORDINATOR [ MASTER | SLAVE ] ALL 
START COORDINATOR { MASTER | SLAVE } node_name [, ...] 
 
Command:     START DATANODE 
Description: start the datanode node type on the ADB cluster 
Syntax: 
START DATANODE ALL 
START DATANODE { MASTER | SLAVE } { ALL | node_name [, ...] } 
 
Command:     START GTMCOORD 
Description: start the gtmcoord node type on the ADB cluster 
Syntax: 
START GTMCOORD ALL 
START GTMCOORD { MASTER | SLAVE } node_name 
```

All the commands in the following sections can be viewed with the above help information.

### agent-related commands

---


The agent process is the key to adbmgr's implementation of managing AntDB clusters. It is the intermediate agent that transfers commands between adbmgr and the AntDB cluster and returns command execution results. So to manage the AntDB cluster, you need the agent process to run properly. There are three commands to manage the agent process, and they are described below.

#### start agent

---


**Command function:**

Start the agent process on the specified host. The specified host must be in the host table, and the specific function can be viewed by the help command: \\h start agent. 

**Command format:**

```
START AGENT { ALL | host_name [, ...] } [ PASSWORD passwd ]
```

**Command example:**

```sql
-- Start the agent process on all hosts in the host table (no mutual trust is configured between hosts and the user password is 'sdg3565' on all hosts): 
START AGENT ALL PASSWORD 'sdg3565'; 
-- Start the agent process on all hosts in the host table, (hosts have been configured for mutual trust): 
START AGENT ALL ; 
-- Start the agent process on host1, host2 in the host table (no mutual trust is configured between the hosts, and the user password is 'sdg3565' on both host1, host2): 
START AGENT host1, host2 PASSWORD 'sdg3565'; 
-- Start the agent process on host1, host2 in the host table (mutual trust has been configured between the hosts): 
START AGENT host1, host2 ; 
```

#### stop agent

---