Manager Handbook for Distributed AntDB-T - P4
Tags: database
Published: 2023-07-28 08:00:23

#### list node

---


**Command function:**

Display the node information in the node table. The specific function can be viewed by the help command “\\h list node”.

**Command format:**

```sql
LIST NODE COORDINATOR [ MASTER | SLAVE ] 
LIST NODE DATANODE [ MASTER | SLAVE ] 
LIST NODE DATANODE MASTER node_name 
LIST NODE HOST host_name [, ...] 
LIST NODE  [ ( option ) ] [ node_name [, ...] ] 
LIST NODE ZONE zonename 
where option can be one of: 
 
    NAME 
    HOST 
    TYPE 
    MASTERNAME 
    PORT 
    SYNC_STATE 
    PATH 
    INITIALIZED 
    INCLUSTER 
 
Parameter Description: 
NAME：Node name, corresponding to the name column of the node table. 
HOST：The hostname, corresponding to the hostname in the host table. 
TYPE：Node type, including: GTMCOORD MASTER， GTMCOORD SLAVE，COORDINATOR MASTER，DATANODE 	MASTER，DATANODE SLAVE 
MASTERNAME：The hostname corresponding to the standby machine; the non-standby machine corresponds to null. 
PORT：The port number that the agent process listens on.  
sync_state：The synchronous/asynchronous relationship between slave node and master node. Only valid for slave nodes. The value "sync" means that the slave node is a synchronous slave, "potential" means that the slave node is a potentially synchronous node, and "async" means that the slave node async" means the slave is an asynchronous slave. 
PATH：node data path, you need to ensure that the directory is empty. 
INITIALIZED：Identifies whether the node is initialized. 
INCLUSTER：Identifies whether the node is in the cluster. 
```

**Command example:**

```sql
-- Displays node information in node table: 
LIST NODE; 
-- Displays information about the node with the node name "db1": 
LIST NODE db1; 
-- Display master/slave node information for db1_2: 
list node datanode master db1_2; 
-- Displays node information on host localhost1: 
list node host localhost1; 
-- Displays all nodes under the local zone. There will be 2 zones in the dual-center scenario:
list node zone local;
```

### param table related commands

---


The param table is used to manage the parameters in the postgresql.conf file that holds all the nodes in the AntDB cluster. When a parameter is modified, it is added to this table and used to identify it. For querying the modified configuration parameters, you can use the list param command.

#### set param

---


**Command function:**

Change the parameter in the postgresql.conf node configuration file. If the parameter is valid, the system will perform the relevant operation internally to make the change effective. This operation only applies to those parameter types that do not require restarting the cluster (such as sighup, user, superuser), while for modifying other types of parameters, the corresponding prompt will be given. If force is added at the end of the command, the validity of the parameter is not checked, but forced to be written to a file, and the system does not perform any operation, but only serves as a record.

**Command format:**

```sql
SET COORDINATOR [ MASTER | SLAVE ] ALL ( { parameter = value } [, ...] ) [ FORCE ] 
SET COORDINATOR { MASTER | SLAVE} node_name ( { parameter = value } [, ...] ) [ FORCE ] 
SET DATANODE [ MASTER | SLAVE ] ALL ( { parameter = value } [, ...] ) [ FORCE ] 
SET DATANODE { MASTER | SLAVE } node_name ( { parameter = value } [, ...] ) [ FORCE ] 
SET GTMCOORD ALL ( { parameter = value } [, ...] ) [ FORCE ] 
SET GTMCOORD { MASTER | SLAVE } node_name ( { parameter = value } [, ...] ) [ FORCE ] 
```

**Command example:**

```sql
-- Modify deadlock time on coord1 
SET  COORDINATOR  MASTER coord1(deadlock_timeout = '1000ms'); 
-- Modify the checkpoint_timeout parameter in the configuration file on all datanodes. 
SET  DATANODE  all(checkpoint_timeout = '1000s'); 
-- Modify a non-existent parameter in the configuration file on all datanodes 
SET  DATANODE  all(checkpoint = '10s')  FORCE; 
```

#### reset param

---


**Command function:**

Change the parameters in the postgresql.conf file to default values.

**Command format:**

```sql
RESET COORDINATOR [ MASTER | SLAVE ] ALL ( parameter [, ...] ) [ FORCE ] 
RESET COORDINATOR { MASTER | SLAVE } node_name ( parameter [, ...] ) [ FORCE ] 
RESET DATANODE [ MASTER | SLAVE ] ALL ( parameter [, ...] ) [ FORCE ]  
RESET DATANODE { MASTER | SLAVE } node_name ( parameter [, ...] ) [ FORCE ] 
RESET GTMCOORD ALL ( parameter [, ...] ) [ FORCE ]  
RESET GTMCOORD { MASTER | SLAVE } node_name ( parameter [, ...] ) [ FORCE ] 
```

**Command example:**

```sql
-- Change the configuration parameter checkpoint_timeout of datanode master db1 to its default value. Where the * sign in the query result is an adaptor indicating all node names that meet the condition. 
RESET  DATANODE  MASTER  db1 (checkpoint_timeout); 
-- Change all configuration parameters checkpoint_timeout in datanode to default values 
RESET  DATANODE  all (checkpoint_timeout); 
```

#### list param

---


**Command function:**

Query the list of modified parameters in the node's postgresql.conf configuration file.

**Command format:**

```sql
LIST PARAM 
LIST PARAM node_type node_name [ sub_like_string ] 
LIST PARAM cluster_type ALL [ sub_like_string ] 
 
where node_type can be one of: 
 
    GTMCOORD MASTER 
    GTMCOORD SLAVE 
    COORDINATOR MASTER 
    COORDINATOR SLAVE 
    DATANODE MASTER 
    DATANODE SLAVE 
 
where cluster_type can be one of: 
 
    GTMCOORD 
    COORDINATOR 
    DATANODE 
    DATANODE MASTER 
    DATANODE SLAVE 
```

**Command example:**

```sql
--Query the modified parameter in the configuration file with the node type of datanode master and the node name of db1 
LIST  param  DATANODE  MASTER  db1; 
--Query the modified parameter in the configuration file in all nodes with the node type of coordinator
LIST  param  COORDINATOR  all; 
```