cm_ctl
cm_ctl is a tool provided by openGauss to control database instance services. This tool is called by O&M personnel for automatic database instance service restoration. cm_ctl provides the following functions:
- Starts database instance services, all the instances in an AZ, all instances on a single host, or a single instance process.
- Stops database instance services, all instances in an AZ, all instances on a single host, or instance processes on a single node.
- Restarts the logical database instance service.
- Queries the database instance status or the status of a single host.
- Switches over the primary and standby instances or resets the instance status.
- Rebuilds the standby node.
- Views the database instance configuration file.
- Sets the log level, the arbitration mode of cm_server when one primary and multiple standby database instances are deployed, and the switchover mode between AZs.
- Obtains the log level, the arbitration mode of cm_server when one primary and multiple standby database instances are deployed, and the switchover mode between AZs.
- Checks the status of an instance process.
Files related to the cm_ctl tool:
cluster_manual_start
This is a flag file for starting and stopping a database instance. The file is stored in $GAUSSHOME/bin, where GAUSSHOME is an environment variable. When the database instance is started, the cm_ctl tool deletes the file. When the database instance is stopped, the cm_ctl tool generates the file and writes the stop mode to the file.
instance_manual_start_X (X indicates the instance ID.)
This is a flag file of starting and stopping a single instance. The file is stored in $GAUSSHOME/bin, where GAUSSHOME is an environment variable. When starting the instance, cm_ctl deletes the file. When stopping the instance, cm_ctl generates the file and writes the stop mode to the file.
cm_ctl constraints:
- In cluster mode, the cm_ctl tool instead of the gs_ctl tool is used to switch the database role.
Command Description
cm_ctl uses the following options:
- Commands of options
- Common options
- Options of start
- Options of switchover
- Options of build
- Options of check
- Options of stop
- Options of query
- Options of view
- Options of set and Options of set cm
- Options of get
- Options of setrunmode
- Options of changerole
- Options of changemember
- Options of reload
- Options of list
- Options of encrypt
- Options of ddb
- Options of switch
- Options of res
Usage:
cm_ctl start [-z AVAILABILITY_ZONE [--cm_arbitration_mode=ARBITRATION_MODE]] | [-n NODEID [-D DATADIR]] [-t SECS]
cm_ctl switchover [-z AVAILABILITY_ZONE] | [-n NODEID -D DATADIR [-f]] | [-a] | [-A] [-t SECS]
cm_ctl finishredo
cm_ctl build [-c] [-n NODEID] [-D DATADIR [-t SECS] [-f] [-b full] [-j NUM]]
cm_ctl check -B BINNAME -T DATAPATH
cm_ctl stop [[-z AVAILABILITY_ZONE] | [-n NODEID [-D DATADIR]]] [-t SECS] [-m SHUTDOWN-MODE]
cm_ctl query [-z ALL] [-l FILENAME] [-v [-C [-w] [-s] [-S] [-d] [-i] [-F] [-x] [-p]] | [-r]] [-t SECS] [--minorityAz=AZ_NAME]
cm_ctl view [-v | -N | -n NODEID] [-l FILENAME]
cm_ctl set [--log_level=LOG_LEVEL] [--cm_arbitration_mode=ARBITRATION_MODE] [--cm_switchover_az_mode=SWITCHOVER_AZ_MODE] [--cmsPromoteMode=CMS_PROMOTE_MODE -I INSTANCEID]
cm_ctl set --param --agent | --server [-n [NODEID]] -k [PARAMETER]="[value]"
cm_ctl get [--log_level] [--cm_arbitration_mode] [--cm_switchover_az_mode]
cm_ctl setrunmode -n NODEID -D DATADIR [[--xmode=normal] | [--xmode=minority --votenum=NUM]]
cm_ctl changerole [--role=PASSIVE | --role=FOLLOWER] -n NODEID -D DATADIR [-t SECS]
cm_ctl changemember [--role=PASSIVE | --role=FOLLOWER] [--group=xx] [--priority=xx] -n NODEID -D DATADIR [-t SECS]
cm_ctl reload --param [--agent | --server]
cm_ctl list --param --agent | --server
cm_ctl encrypt [-M MODE] -D DATADIR
cm_ctl ddb DCC_CMD
cm_ctl switch [--ddb_type=[DDB]] [--commit] [--rollback]Table 1 Commands of options
Table 2 Common options
NOTE
- The common options listed here may not be applicable to all commands. For details about how to use the common options, see the preceding description. You can also run the cm_ctl --help command to query the common options.
Table 3 Options of switchover
Table 4 Options of build
Table 5 Options of check
Specifies the name of a process, which can be cm_agent, gaussdb, or cm_server. | |
Table 6 Options of stop
Table 7 Options of query
Table 8 Options of set
Table 9 Options of set cm
Table 10 Options of get
Table 11 Options of view
Table 12 Options of setrunmode
Table 13 Options of changerole
Changes the primary role to passive or follower in the DCF mode. |
|
Table 14 Options of changemember
Changes the primary role to passive or follower in the DCF mode. |
| |
Table 15 Options of start
Table 16 Options of reload
Specifies the CM parameters to be loaded. If this parameter is not specified, the CM parameters cannot be loaded. | |
Specifies whether to dynamically load cm_server or cm_agent parameters. |
Table 17 Options of list
Specifies the CM parameters to be listed. This is mandatory. | |
Specifies the cm_server or cm_agent parameters to be listed. This is mandatory. |
Table 18 Options of encrypt
Specifies the encryption type. The value can be server or client. The default value is server. | |
Table 19 Options of switch
Table 20 Options of ddb
Table 21 Options of res
Command Reference
Start an instance.
cm_ctl start [-z AVAILABILITY_ZONE [--cm_arbitration_mode=ARBITRATION_MODE]] | [-n NODEID [-D DATADIR]] [-t SECS]Perform a switchover between primary and standby databases.
cm_ctl switchover [-z AVAILABILITY_ZONE] | [-n NODEID -D DATADIR [-f]] | [-a] | [-A] [-t SECS]Stop the playback on all standby nodes, and forcibly promote one of the shards to primary.
cm_ctl finishredoRebuild the standby node.
cm_ctl build -n NODEID -D DATADIR [-t SECS] [-f] [-b full]Check the running status of an instance process.
cm_ctl check -B BINNAME -T DATAPATHStop an instance.
cm_ctl stop [[-z AVAILABILITY_ZONE] | [-n NODEID [-D DATADIR [-R]]]] [-t SECS] [-m SHUTDOWN-MODE]Query the cluster status.
cm_ctl query [-z ALL] [-l FILENAME] [-v [-C [-s] [-S] [-d] [-i] [-F] [-x] [-p]] | [-r]] [-t SECS] [--minorityAz=AZ_NAME]View the cluster configuration file.
cm_ctl view [-v | -N | -n NODEID] [-l FILENAME]Set parameters.
cm_ctl set [--log_level=LOG_LEVEL] [--cm_arbitration_mode=ARBITRATION_MODE] [--cm_switchover_az_mode=SWITCHOVER_AZ_MODE]Set CM parameters.
cm_ctl set --param --agent | --server [-n NODEID] -k "PARAMETER='value'"Obtain parameters.
cm_ctl get [--log_level] [--cm_arbitration_mode] [--cm_switchover_az_mode]Set the number of DCF votes.
cm_ctl setrunmode -n NODEID -D DATADIR [[--xmode=normal] | [--xmode=minority --votenum=NUM]]Change the DCF role information.
cm_ctl changerole [--role=PASSIVE | --role=FOLLOWER] -n NODEID -D DATADIR [-t SECS]Change the attributes of the DCF node.
cm_ctl changemember [--role=PASSIVE | --role=FOLLOWER] [--group=xx] [--priority=xx] -n NODEID -D DATADIR [-t SECS]Dynamically load CM parameters.
cm_ctl reload --param [--agent | --server]List all CM parameters.
cm_ctl list --param [--agent | --server]Perform encryption.
cm_ctl encrypt [-M MODE] -D DATADIRRun the DCC command.
cm_ctl ddb DCC_CMD Set: cm\_ctl ddb --put [key] [value] Delete: cm\_ctl ddb --delete [key] View DCC command help information: cm\_ctl ddb --helpRun the switch ddb command.
cm_ctl switch [--ddb_type=[DDB]] [--commit] [--rollback]Run the res command.
Add a resource: cm_ctl res --add --res_name=[name] --res_attr=[res_info] Delete a resource: cm_ctl res --del --res_name=[name] Modify a resource: cm_ctl res --edit --res_name=[name] --res_attr=[res_info] Add a resource instance: cm_ctl res --edit --res_name=[name] --add_inst=[inst_info] Delete a resource instance: cm_ctl res --edit --res_name=[name] --del_inst=[inst_info] Check resources: cm_ctl res --check