remove node
Command function:
Modify the node's initialized and field values to false in the node table and delete the node from the pgxc_node table, but keep the information in mgr's node table.
Note:
There are currently four types of nodes that can only be removed, coordiantor master and slave, datanode slave, and gtmcoord slave, and it requires the node to be in not running state.
Command format:
REMOVE COORDINATOR SLAVE node_name
REMOVE COORDINATOR MASTER node_name
REMOVE DATANODE SLAVE node_name
REMOVE GTMCOORD SLAVE node_name
Command example:
-- Remove coordinator node from the cluster
remove coordinator master cd2;
-- Remove datanode slave node from the cluster
remove datanode slave db1_2;
-- Remove gtmcoord slave node from the cluster
remove datanode slave gc2;
drop node
Command function:
Delete the node information in the node table. The specific function can be viewed by the help command \h drop gtmcoord, \h drop coordinator and \h drop datanode.
Note: Before cluster initialization, you can delete the node information by drop node, but in the presence of a backup, you need to delete the backup node before you can delete the master node. After cluster initialization, no drop node operation is allowed to be executed.
Command format:
DROP GTMCOORD { MASTER | SLAVE } node_name
DROP COORDINATOR MASTER node_name [, ...]
DROP DATANODE { MASTER | SLAVE } node_name [, ...]
DROP ZONE zonename # Delete all nodes in the same zone
Command example:
-- Delete datanode slave db1s before cluster initialization:
DROP DATANODE SLAVE db1s;
-- Delete coordinator coord1 before cluster initialization:
DROP COORDINATOR master coord1;
-- Delete gtmcoord slave gc before cluster initialization:
DROP GTMCOORD SLAVE gcs;
-- Delete gtmcoord master gc before cluster initialization:
DROP GTMCOORD MASTER gc;
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:
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:
-- 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;