【Manager Handbook for Distributed AntDB-T】Node Management Related Commands (5): Promote, Rewind, and Zone
promote
Command function:
Perform a PROMOTE operation on the node to change the read-only state of the standby to a read-write state, and view the result as f by SELECT PG_IS_IN_RECOVERY(). This command is mainly used in the subsequent step-by-step processing of FAILOVER errors. The specific functions can be viewed through the help command\h promote gtmcoord” or \h promote datanode。
Command format:
PROMOTE DATANODE { MASTER | SLAVE } { node_name }
PROMOTE GTMCOORD { MASTER | SLAVE } { node_name }
Command example:
-- Elevate datanode slave datanode1 to read/write state:
PROMOTE DATANODE SLAVE datanode1;
-- Elevate gtmcoord slave gc1 to read/write state:
PROMOTE GTMCOORD SLAVE gc1;
rewind
Command function:
Perform rewind operation on GTMCOORD or DATANODE standby to reestablish the correspondence between the standby and the host.
Both the rewind and append commands can be used to create a standby, but they are used in different scenarios.
The append command executes the pg_basebackup command to synchronize data from the master node, requiring the data directory of the standby node to be empty, i.e., reinitialize a standby node. It is more time consuming if the master node has a large amount of data.
If the data directory of the backup node is not empty, for example, after the failover command is executed, the original master node is demoted to the backup node, but there is already a large amount of data in the data directory, so you can use the existing data in the directory to synchronize a small amount of data, which is less time consuming. This is exactly what rewind can do to quickly restore the backup node.
Command format:
REWIND DATANODE SLAVE { node_name }
REWIND GTMCOORD SLAVE { node_name }
Command example:
-- Rebuild the standby datanode slave datanode1 with master:
REWIND DATANODE SLAVE datanode1;
-- Rebuild the standby gtmcoord slave gc1 with master:
REWIND GTMCOORD SLAVE gc1;
zone
Command function:
zone init initializes the nodes in the secondary center. The prerequisite for executing this command is that all the nodes in the primary center have been init.
zone switchover switches user master and standby center, that is, the secondary center upgraded to the master center, the node upgraded to master node, the node of the master center down to standby. The temporary switch of user master and standby center can also be switched back later.
zone failover backup center upgraded to master, the original master node is no longer working, for the master center down and not recoverable, the vice center needs to replace the master center work scenario.
Command format:
ZONE INIT zone_name #Initialize all nodes in the sub-center
ZONE SWITCHOVER zonename [FORCE] [maxTrys] #primary backup center swap
ZONE FAILOVER zonename [ FORCE ] #Upgrade of the Reserve Center to the Main Center
Command example:
zone init zone2;
zone switchover zone2 force 30;
zone failover zone2;