【Manager Handbook for Distributed AntDB-T】Node Management Related Commands (2): Stop and Append
stop
Command function:
This command is the opposite of the start command and stops the node with the specified name or stops all cluster nodes of the specified node type. The stop command uses the smart mode by default if no MODE is specified. There are three stop modes: smart, fast and intermediate.
• Smart: rejects new connections and waits for old connections to finish executing.
• Fast: rejects new connections and disconnects old ones, which is a safer mode to stop nodes.
• Immediate: All database connections are interrupted, used to stop the node in case of emergency.
The specific functions can be viewed through the help command \h stop.
Command format:
STOP ALL [ stop_mode ]
STOP AGENT { ALL | host_name [, ...] }
STOP COORDINATOR [ MASTER | SLAVE ] ALL [ stop_mode ]
STOP COORDINATOR { MASTER | SLAVE } { node_name [, ...] } [ stop_mode ]
STOP DATANODE ALL [ stop_mode ]
STOP DATANODE { MASTER | SLAVE } { ALL | node_name [, ...] } [ stop_mode ]
STOP GTMCOORD ALL [ stop_mode ]
STOP GTMCOORD { MASTER | SLAVE } node_name [ stop_mode ]
STOP ZONE zonename [ stop_mode ]
where stop_mode can be one of:
MODE SMART | MODE S
MODE FAST | MODE F
MODE IMMEDIATE | MODE I
Command example:
-- Use fast mode to stop all nodes in the cluster:
STOP ALL MODE FAST;
-- Use IMMEDIATE mode to stop all coordinator nodes:
STOP COORDINATOR ALL MODE IMMEDIATE;
-- Use smart mode to stop the nodes in the current cluster whose node type is datanode master and whose names are db1 and db2:
STOP DATANODE MASTER db1,db2; or
STOP DATANODE MASTER db1,db2 MODE SMART;
-- Stop the agent on the host in the cluster:
STOP AGENT all;
append
Command function:
Append command is used to append cluster nodes to AntDB cluster for cluster expansion. Gtmcoord master is the core of the cluster, the append command does not include appending gtmcoord master command. Before executing the append command, you need to perform the following steps (assuming append coordinator to a new machine).
1. Add the host information of the new machine to the host table.
2. Add the coordinator information to be appended to the node table.
3. Create the user and password on the new machine.
4. Execute the deploy command to distribute the cluster executable files to the new machine.
5. Modify the hidden file .bashrc under the current user on the new machine by appending the following content and executing source ~/.bashrc to make it effective.
export ADBHOME=/opt/antdb/app (modify according to the actual situation)
export PATH=$ADBHOME/bin:$PATH
export LD_LIBRARY_PATH=$ADBHOME/lib:$LD_LIBRARY_PATH
1. Execute start agent to start the agent process on the new machine.
2. Execute the append command. The specific functions can be viewed through the help command \h append.
Command format:
APPEND GTMCOORD SLAVE node_name
APPEND DATANODE { MASTER | SLAVE } node_name
APPEND COORDINATOR MASTER node_name
-- Accelerate append coordinator with stream replication
APPEND COORDINATOR dest_coordinator_name FOR source_coordinator_name
APPEND ACTIVATE COORDINATOR node_name
Command example:
-- Append a coordinator node named coord4 to the AntDB cluster:
APPEND COORDINATOR master coord4;
-- Append a datanode master node named db4 to the AntDB cluster:
APPEND DATANODE MASTER db4;
-- Append a datanode slave node named db4 to the AntDB cluster:
APPEND DATANODE SLAVE db4;
-- Append a coordinator master node to the AntDB cluster with stream replication:
APPEND COORDINATOR coord5 FOR coord1;
APPEND ACTIVATE COORDINATOR coord5;