node table related commands
The Node table is used to store information about each node in the deployed AntDB cluster, including the same/asynchronous relationship between slave and master nodes, etc. The commands to manage the node table are:
• add node(including ADD GTMCOORD、ADD COORDINATOR、ADD DATANODE)
• alter node(including ALTER GTMCOORD、ALTER COORDINATOR、ALTER DATANODE)
• remove node ( including DROP GTMCOORD、DROP COORDINATOR、DROP DATANODE)
• drop node(including DROP GTMCOORD、DROP COORDINATOR、DROP DATANODE)
• list node
These five commands are described below.
add node
Command function:
Add node information in node table. The specific function can be viewed by the help command \h add gtmcoord, \h add coordinator and \h add datanode.
Note: Both gtmcoord and datanode can exist multiple standy machines, and nodetype is slave. The first added slave node is synchronous slave by default, and the subsequent ones are potentially synchronous by default, and the sync_state field value is potential
The specified node data storage path needs to be an empty directory, otherwise report an error when executing the initialization.
Command format:
ADD COORDINATOR MASTER master_name ( option )
ADD DATANODE MASTER master_name ( option )
ADD DATANODE SLAVE slave_name FOR master_name ( option )
ADD GTMCOORD MASTER master_name ( option )
ADD GTMCOORD SLAVE slave_name FOR master_name ( option )
where option must be the following:
HOST = host_name,
PORT = port_number,
SYNC_STATE = sync_mode,
PATH = pg_data
ZONE = zone_name
READONLY = readonly_type (valid only when adding coordinator)
Parameter Description:
node_name:Node name, corresponding to the name column of the node table.
host_name:The hostname, corresponding to the hostname in the host table.
port_number:The port number that the node listens on
Sync_mode:The synchronous/asynchronous relationship between the standby and the host, "on", "t", "true" all mean synchronous setting, "off", "f", "false" all mean asynchronous setting.
pg_data:Node data path, you need to ensure that the directory is empty.
zone_name:The name of the center to which the node belongs, the default is local, used in dual-center scenarios.
readonly_type:Whether or not the coordinator is a read-only node
Note: datanode and gtmcoord nodes support cascading, i.e. slave node can hang under slave node, so for can be followed by the name of slave node.
Command example:
-- Add a gtmcoord master node, host is localhost1, port is 6768, data path is "/home/antdb/data/gc":
ADD GTMCOORD MASTER gc (HOST=localhost1, PORT=6768, PATH='/home/antdb/data/gc');
-- Add a gtmcoord slave node with host localhost2, port 6768 and data path "/home/antdb/data/gc":
ADD GTMCOORD SLAVE gcs for gc (HOST=localhost2, PORT=6768, SYNC=t, PATH='/home/antdb/data/gc');
-- Add information about coord1 of coordinator node, host is localhost1, port is 5532, data path "/home/antdb/data/coord1":
ADD COORDINATOR master coord1(HOST=localhost1, PORT=5532,PATH='/home/antdb/data/coord1');
-- Add db1 of datanode master node, host is localhost1, port is 15533, data path is "/home/antdb/data/db1":
ADD DATANODE MASTER db1(HOST=localhost1, PORT=15533,PATH='/home/antdb/data/db1');
-- Add db1 of datanode slave node with host localhost2, port 15533 and data path "/home/antdb/data/db1":
ADD DATANODE SLAVE db1s for db1(HOST=localhost1, PORT=15533, SYNC=t, PATH= '/home/antdb/data/db1');
-- Add cascade slave db11s of db1s of datanode slave node
ADD DATANODE SLAVE db11s for db1s(HOST=localhost1, PORT=15543, SYNC=t, PATH= '/home/antdb/data/db11');