alter node
Command function:
Modify the node information in the node table. The specific function can be viewed by the help command “\h alter gtmcoord” , ”\h alter coordinator” and ”\h alter datanode”.
Note: Before cluster initialization, you can update the node information by alter node; after cluster initialization, only the backup slave is allowed to update the sync_state column with the asynchronous relationship.
Command format:
ALTER GTMCOORD { MASTER | SLAVE } node_name ( option )
ALTER COORDINATOR MASTER node_name ( option )
ALTER DATANODE { MASTER | SLAVE } node_name ( option )
where option can be one of:
HOST =host_name,
PORT = port_number,
SYNC_STATE = sync_mode,
PATH = pg_data
ZONE = zone_name
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 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.
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.
Command example:
-- Before cluster initialization, update the port number of gtmcoord master to 6666:
ALTER GTMCOORD MASTER gtmcoord (PORT=6666);
-- Update the gtmcoord slave to be in a synchronous relationship with the gtmcoord master:
ALTER GTMCOORD SLAVE gcs (SYNC_STATE='sync');
-- Update gtmcoord extra to have an asynchronous relationship with gtmcoord master:
ALTER GTMCOORD SLAVE gtms (SYNC_STATE='async');
-- Before cluster initialization, update the port of coordinator coord1 to 5532 and the data path is”/home/antdb/data/coord1”:
ALTER COORDINATOR master coord1 (PORT=5532, PATH=’/home/antdb/data/coord1’);
-- Before cluster initialization, update the host of datanode master db1 to localhost5, the data path is ”/home/antdb/data/db1”:
ALTER DATANODE MASTER db1 (HOST=localhost5, PATH=’/home/antdb/data/coord1’);
-- Update datanode slave db1 to be in a synchronous relationship with host datanode master:
ALTER DATANODE SLAVE db1s (SYNC_STATE='sync');
-- Update datanode extra db1 to have an asynchronous relationship with host datanode master:
ALTER DATANODE SLAVE db1s (SYNC_STATE='async');