Unified Database Management Tool

The cluster manager (CM) is a database management module. It supports customized resource monitoring and provides capabilities such as monitoring of the primary/standby database status, network communication faults, file system faults, and automatic primary/standby switchover upon faults. It also provides various database management capabilities, such as starting and stopping nodes and instances, querying database instance status, performing primary/standby switchover, and managing logs. The capability of remotely querying and receiving cluster status through REST interfaces is also provided.

Note that in a scenario where there are one primary node and one standby node, the CM supports only basic capabilities, such as installation, startup, stop, and detection.

Features

cm_agent

cm_agent is a database management component deployed on each database host. It is used to start, stop, and monitor database instance processes.

The main functions are as follows:

  • It starts and stops the instance processes deployed on the local host when the database instance is started or stopped.
  • It monitors the instance status on the local host and sends the status to the CM server.
  • It runs the commands delivered by the CM server after arbitration.

Command description:

  • Common options:

    • -V, --version

      Prints the cm_agent version information and exits.

    • -?, -h,--help

      Displays help information about cm_agent command parameters and exits.

  • Locations where the log information is recorded:

    • 0

      Recorded in specified log files.

    • 1

      Recorded in the syslog file.

    • 2

      Recorded in specified log files.

    • 3

      Empty file, that is, no log information is recorded.

  • Startup modes:

    • normal

      Startup in normal mode.

    • abnormal

      Startup in abnormal mode.

cm_server

cm_server is a component used for managing database instances and arbitrating instances. The main functions are as follows:

  • Receives the status of each database instance from cm_agent on each node.
  • Allows you to query the overall status of the database instances.
  • Monitors instance status changes and delivers arbitration commands.

Command description:

  • Common options:

    • -V, --version

      Prints the cm_server version information and exits.

    • -?, -h,--help

      Displays help information about cm_server command parameters and exits.

  • Locations where the log information is recorded:

    • 0

      Recorded in specified log files.

    • 1

      Recorded in the syslog file.

    • 2

      Recorded in specified log files.

    • 3

      Empty file, that is, no log information is recorded.

Customized Resource Monitoring

Currently, CM can monitor stateless resources. That is, each resource instance has the same role and does not distinguish between primary and standby resources, or resources can perform primary/standby quorum by themselves. CM provides the following functions:

  • Start and stop resources.
  • Monitor resource processes and restart processes when exceptions occur.
  • Query the resource process status.
  • Detect and recover stopped processes (resource scripts required).

Configuration method: After customized resources are installed, you need to configure the following files to use the customized resource monitoring function:

  1. Resource script. It is used to start or stop a resource and check the resource status. An example is as follows:
#!/bin/bash
#set -ex  # Uncomment this line to help debug the script.
#Resource name
resName=sharding
#Resource binpath
shardingPath=/home/test/home/apache-shardingsphere-5.1.1-shardingsphere-proxy-bin/bin
#Command keyword used to filter resource instances
cmdKey=org.apache.shardingsphere.proxy.Bootstrap
#File that records the time when the stopped resource is detected for the first time
phony_dead_time_file=.sharding_phony_dead_time
#Maximum stopping time, in seconds
PHONY_MAX_TIME=20

function exec_start
{
  #Command for starting resources
  sh ${shardingPath}/start.sh; exit $?
}

function exec_stop
{
  #Command for stopping resources
  sh ${shardingPath}/stop.sh; exit $?
}

function exec_check
{
  #Query the PID of a resource instance.
  pid=`ps x | grep "$cmdKey" | grep -v grep | awk '{print $1}'`
  if [ "${pid}" == "" ]; then
    echo "$resName is not running."
    exit 1
  fi
  #Query the status of the resource instance process.
  state=`cat /proc/$pid/status | grep "State" | awk '{print $2}'`
  if [ "$state" == "T" ]; then
    #Detect and handle stopped resources.
    if [ ! -f $phony_dead_time_file ]; then
      touch ./${phony_dead_time_file}
      echo "export firstphonytime=''" > ./${phony_dead_time_file}
    fi
    source ./$phony_dead_time_file;
    curtime=$(date +%s);
    if [ "$firstphonytime" == "" ]; then
      #If a stopped resource is detected for the first time, the timestamp is written into the stopping time storage file.
      #firstphonytime is the name of the variable used to store the stopping time of the current resource instance.
      #If the current node has multiple customized resource instances, set this parameter to different names.
      echo "export firstphonytime=$curtime" > ./$phony_dead_time_file;
      exit 0;
    fi
    dead_time=$(( $curtime - $firstphonytime ));
    #If the stopping time is greater than or equal to the maximum stopping time set by the user, the resource instance is killed immediately. Otherwise, the resource instance exits normally.
    if [ $dead_time -ge $PHONY_MAX_TIME ]; then
      echo "$resName is detected in a state of phony dead(T) and will be forcibly killed!"
      kill -9 $pid
      rm ./${phony_dead_time_file} -f
      sh ${shardingPath}/start.sh; exit $?
    else
      exit 0
    fi
  elif [ "$state" == "S" ]; then
    #The system is not stopped. After the environment is cleared, the system exits normally.
    rm ./${phony_dead_time_file} -f
    exit 0
  fi
}

#The following APIs are fixed and do not need to be modified. They correspond to the preceding three functions and must be implemented.
if [ $1 == '-start' ]; then
  exec_start $2
elif [ $1 == '-stop' ]; then
    exec_stop $2
elif [ $1 == '-check' ]; then
  exec_check $2
fi

The preceding example can be used as a template. You need to modify the following information: Resource name, resource binPath, command keywords used to filter resource instances, file used to save the first resource stopping time (optional), longest stopping time, and variable name used to record the first stopping time (if multiple user-defined resource instances exist on the same node)

  1. Customized resource configuration file cm_resource.json The file is stored in cmdir/cm_agent/cm_resource.json. After configuring the file, restart the cluster.
{
  "resources": [
    {
      "name": "sharding",
      "instances": [
        {
          "node_id": 1,
          "res_instance_id": 1
        },
        {
          "node_id": 2,
          "res_instance_id": 2
        }
      ],
      "script": "/usr2/omm/install/cm/cm_agent/sharding.sh",
      "check_interval": 1,
      "time_out": 5,
      "restart_delay":3,
      "restart_period":5,
      "restart_times":10
    },
    {
      "name": "test",
      "instances": [
        {
          "node_id": 1,
          "res_instance_id": 1
        },
        {
          "node_id": 2,
          "res_instance_id": 2
        }
      ],
      "script": "/usr2/omm/install/cm/cm_agent/test.sh",
      "check_interval": 1,
      "time_out": 5,
      "restart_delay":0,
      "restart_period":0,
      "restart_times":1000
    }
  ]
}

Configuration description:

  • resources: customized resource object list. The name is fixed and cannot be changed.
  • name: name of a customized resource object. The value is a string of a maximum of 32 characters (including the end '\0').
  • instances: list of nodes where customized resources are located.
  • node_id: ID of the node where the resource instance is located.
  • res_instance_id: resource instance ID. The value is greater than or equal to 0. Different instances of the same resource have different IDs.
  • script: location of the resource script.
  • check_interval: interval for reporting the resource status, in seconds. The value is greater than or equal to 0.
  • time_out: script execution timeout interval, in seconds. The value is greater than or equal to 0.
  • restart_delay: restart delay after a fault occurs, in seconds. The value range is [0,1800].
  • restart_period: If the difference between the current time and the latest restart time is greater than the value of restart_period, the number of resource restart times increases by 1.
  • restart_times: maximum number of restart times in a period. If the number of restart times exceeds the value of restart_times, the system does not restart the resource and marks the resource as unavailable. The value range is [0,9999]. The value 0 indicates unlimited restart.

CAUTION:
The resource configuration file must exist on all nodes and be consistent. Ensure that the resource script can run properly.

Cluster Information Query and Push

Functions: By running the CMRestAPI component, the CM supports:

  1. The HTTP/HTTPS service is used to remotely query the cluster status, helping management personnel and O&M platforms monitor the cluster status.
  2. When an primary/standby switchover occurs in the database cluster, the latest primary/standby information of the cluster is pushed to the receiving address registered by the application through the HTTP/HTTPS service in time. In this way, the application can detect the primary/standby change of the cluster in time and quickly connect to the new primary and standby nodes.

Parameter description: -e indicates the database environment variable file, which must be specified. -w indicates the whitelist of source IP addresses. If the whitelist is not required, you do not need to specify it. Startup command: java -jar cmrestapi-xxx.jar -e envFile [-w appWhiteList]

API description:

  1. Query the cluster or node status. This API uses the GET method. The format is **http://ip:port/****CMRestAPI/**keyword. Where: ip indicates the IP address of the node where CMRestAPI is running. port indicates the listening port of the CMRestAPI service. keyword indicates the keyword of the information to be queried. Currently, the following information can be queried: Cluster status. The format is **http://ip:port/**CMRestAPI/ClusterStatus. Node status. The format is http://ip:port/****CMRestAPI/NodeStatus[?nodeId=n]. If nodeId is set to n, the status of node n can be queried. If nodeId is not specified, the status of the node that provides services (that is, the status of the node specified by the IP address) is returned by default.

  2. Register and update the addresses for receiving information about the primary and standby nodes. If the application wants to receive the latest primary/standby information pushed by the CMRestAPI, the application needs to register an information receiving address with the CMRestAPI and listen on the address. After receiving the request, the CMRestAPI saves the registered receiving address to the environment where the cluster is located through DCC. DCC stores data in the key-value format. The key is **/CMRestAPI/RecvAddrList/ip/**app, where ip indicates the IP address of the host where the application is located and app indicates the user-defined application name. It is used to distinguish the receiving addresses registered by multiple applications in the same environment. If the key already exists, that is, the source IP address and application name are the same, the address for receiving active and standby information corresponding to the key is updated. This API uses the PUT method. The format is http://ip:port/CMRestAPI/RecvAddr. The following two parameters need to be provided: url: receiving address to be registered. app: application name. If this parameter is not provided, the key is in the format of Prefix + Application IP address.

  3. Delete the addresses for receiving information about the primary and standby nodes. This API uses the DELETE method. The format is http://ip:port/CMRestAPI/RecvAddr. The following parameter needs to be provided: app: application name. If this parameter is not provided, the key is in the format of Prefix + Application IP address.

  4. Description of the address for receiving information. Example of the information receiving address: http://ip:port/CMRestAPI The CMRestAPI uses the PUT method to push host information. The context is MasterInfo, that is, the link format is http://ip:port/CMRestAPI/MasterInfo. The object type is String. The host information format is ip**:**port. The context of the pushed standby node is StanbyInfo, the type of the sent object is String, and the format of the standby node information is ip1:port1,ip2:port2, …,ipn:portn. For details about an application demo, see applicationdemo in the CMRestAPI repository.

Other description:

  1. Security-related description. (1) By default, the CMRestAPI uses the HTTP service and supports the configuration of the access whitelist. You can use the startup parameter -w to configure the whitelist file of the access source IP address. Each line in the whitelist file contains one IP address. (2) To use the HTTPS service, you can specify the system parameter server.ssl in the JAR package during startup to enable the CMRestAPI to start the HTTPS service, or write related parameters into the application.properties file and specify the configuration file in the startup command, or configure the application.properties file in the resource directory of the source code and compile the file. The following is an example of customized configuration parameters:
-Dserver.port=*Service listening port* -Dserver.ssl.key-store=*Key file path* -Dserver.ssl.key-store-password= *Key file password* -Dserver.ssl.key-store-type= *Key type* 
Example: 
Specify system parameters.
java -jar -Dserver.port=8443 -Dserver.ssl.key-store=/home/omm/keystore.p12 -Dserver.ssl.key-store-password=Abcdef@123 -Dserver.ssl.key-store-type=PKCS12 cmrestapi-xxx.jar -e envFile  
Specify a configuration file. 
java -jar -Dspring.config.location=/configpath/application.properties cmrestapi-xxx.jar -e envFile

You can search for and configure more parameters.

  1. Memory-related parameters. This program uses the Spring Boot framework. By default, the startup occupies a large amount of memory (about 1 GB). If the number of concurrent requests is small and you do not want the program to occupy a large amount of memory, you can specify some system parameters during startup to reduce the memory usage. The following is an example of the startup parameters:
-XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=56m -Xms128m -Xmx128m -Xmn32m -Xss328k -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC  
Example: java -jar -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=56m -Xms128m -Xmx128m -Xmn32m -Xss328k -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC cmrestapi-xxx.jar -e envFile

You can search for and configure more parameters.

  1. Customized resource configuration file. This program depends on CM-related processes and instructions. Therefore, this program must run with CM at the same time. You need to configure the customized resource configuration file. For details about the configuration method, see the content related to the customized resource monitoring feature.

Operation Procedure

  1. Install the database cluster containing a CM, and configure the resource script and customized resource file. The following is an example of the resource script: cmrestapi.sh
#!/bin/bash
#set -ex
#Resource name
resName=CM-RestAPI
#Resource binpath
cmrestapiPath=/home/cmrestapi/cmrestapi-3.1.0-RELEASE.jar
#Keyword of the resource startup command
cmdKey=cmrestapi-3.1.0-RELEASE.jar
#File that records the time when the stopped resource is detected for the first time
phony_dead_time_file=.cmrestapi_phony_dead_time
#Maximum stopping time, in seconds
PHONY_MAX_TIME=20
envFile=/home/cmrestapi/envfile
#appWhiteListFile=/home/cmrestapi/appWhiteListFile
source $envFile

function exec_start
{
    nohup java -jar -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=56m -Xms128m -Xmx128m -Xmn32m -Xss328k -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC -Dserver.port=8080 $cmrestapiPath -e $envFile >> $GAUSSLOG/cm/cmrestapi/cmrestapi.log 2>&1 &
    exit $?
}

function exec_stop
{
    ps x | grep "$cmdKey" | grep -v grep | awk '{print $1}' | xargs kill -9; exit $?
}

function exec_check
{
    pid=`ps x | grep "$cmdKey" | grep -v grep | awk '{print $1}'`
    if [ "${pid}" == "" ]; then
        echo "$resName is not running."
        exit 1
    fi
    state=`cat /proc/$pid/status | grep "State" | awk '{print $2}'`
    if [ "$state" == "T" ]; then
        if [ ! -f $phony_dead_time_file ]; then
            touch ./${phony_dead_time_file}
            echo "export firstphonytime=''" > ./${phony_dead_time_file}
        fi
        source ./$phony_dead_time_file;
        curtime=$(date +%s);
        if [ "$firstphonytime" == "" ]; then
            echo "export firstphonytime=$curtime" > ./$phony_dead_time_file;
            exit 0;
        fi
        dead_time=$(( $curtime - $firstphonytime ));
        if [ $dead_time -ge $PHONY_MAX_TIME ]; then
            echo "$resName is detected in a state of phony dead(T) and will be forcibly killed!"
            kill -9 $pid
            rm ./${phony_dead_time_file} -f
            exec_start
        else
            exit 0
        fi
    elif [ "$state" == "S" ]; then
        rm ./${phony_dead_time_file} -f
        echo "$resName is running normally."
        exit 0
    fi
}

if [ $1 == '-start' ]; then
    exec_start $2
elif [ $1 == '-stop' ]; then
    exec_stop $2
elif [ $1 == '-check' ]; then
    exec_check $2
fi

The following is an example of the customized resource file cm_resource.json:

{
  "resources": [
    {
      "name": "CM-RestAPI",
      "instances": [
        {
          "node_id": 1,
          "res_instance_id": 1
        },
        {
          "node_id": 2,
          "res_instance_id": 2
        },
        {
          "node_id": 3,
          "res_instance_id": 3
        }
      ],
      "script": "/home/cmrestapi/install/cm/cm_agent/cmrestapi.sh",
      "check_interval": 1,
      "time_out": 10,
      "restart_delay":0,
      "restart_period":0,
      "restart_times":1000
    }
  ]
}

CAUTION:
To use the customized resource management function of CM, the process needs to be executed in the backend. Therefore, you need to redirect the log output to the log file or configure the log output options, and use nohup and & to run the program in the backend. This program must run on a node where a database is deployed. If the primary/standby information push function is required during a cluster switchover, this program must run on all database nodes in the cluster.

  1. Start the cluster. You can use a browser to access the cluster or node information query interface to query the corresponding information.
  2. Develop the application (for details, see the demo of the source code repository) and start the application.
  3. Register an address for receiving information.

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:

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 [-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

Command

Description

start

Starts the database instance service, all instances on a single host, instance processes on a single node, or the entire AZ when one primary database and multiple standby databases are deployed.

switchover

Switches over the primary and standby database instances when one primary database and multiple standby databases are deployed. In DCF mode, the -n NODEID and -D DATADIR parameters are not supported.

finishredo

Stops the playback on all standby nodes, and forcibly promotes one of the shards to primary.

Note:

Setting this parameter is a high-risk operation. Exercise caution when performing this operation.

build

Rebuilds a standby instance.

check

Checks the running status of an instance process. You are not advised to use this one.

stop

Stops the database instance service, all instances on a single host, or the instance processes on a single node when one primary database and multiple standby databases are deployed.

query

Queries the database instance status or the status of a single host when one primary database and multiple standby databases are deployed.

view

Views the database instance configuration file.

set

Sets the log level, the arbitration mode of cm_server when one primary database and multiple standby databases are deployed, the switchover mode between AZs, and the promotion mode to primary of cm_server.

set --param

Sets CM parameters. By default, parameters on all nodes are set. You can also use the -n option to set parameters on a node. For details about the parameters, see CM Parameters.

get

Obtains the log level, the arbitration mode of cm_server when one primary database and multiple standby databases are deployed, and the switchover mode between AZs.

setrunmode

Sets the number of DCF votes in DCF deployment mode. This is used for forcible DCF startup.

changerole

Changes the primary role to passive or follower in the DCF mode.

changemember

Changes the attributes of a DCF node in DCF mode, including the role, logical group, and election priority of the node.

reload

Loads the static configuration file of a database instance online. You are not advised to use this one.

reload --param

Loads CM parameters that can take effect dynamically. Some parameters cannot be reloaded and can take effect only after the CM is restarted.

list

Lists all parameters of cm_agent or cm_server.

encrypt

Encrypts an entered password. The password can contain 8 to 15 characters and must contain at least three types of the following characters: digits, letters, and symbols.

ddb

Runs the DCC command in DCC mode.

switch

Switches to the DDB mode.

Note:

Currently, openGauss can be switched only to the DCC mode.

Table 2 Common options

Option

Description

-D DATADIR

Specifies the instance data directory. This is used only to perform operations on database nodes, such as start, stop, switchover, build, setrunmode, changerole, changemember and encrypt.

-l FILENAME

Outputs the result to a specified file. This is used only for query, such as query and view.

-n NODEID

Specifies a node.

-z AVAILABILITY_ZONE

Specifies the AZ name.

-t SECS

Specifies the timeout period.

-V, --version

Prints the cm_ctl version and exits.

-?, -h,--help

Displays help information about cm_ctl command-line options and exits.

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

Option

Description

-a

Restores nodes to their initial status.

Note:

Switchover is performed for maintenance. Before a switchover, ensure that the cluster is running properly, all services are stopped, and the pgxc_get_senders_catchup_time() view shows no ongoing catchup between the primary and standby nodes.

-A

Switches all node instances from primary to standby.

-f

Specifies a type of switchover.

Note:
  • Switchover is performed for maintenance. Before a switchover, ensure that the cluster is running properly, all services are stopped, and the pgxc_get_senders_catchup_time() view shows no ongoing catchup between the primary and standby nodes.
  • Usage: cm\_ctl switchover -n NODEID -D DATADIR -f.

Table 4 Options of build

Option

Description

-f

Forcibly rebuilds a standby node.

-b full

Performs a full build. If this parameter is not specified, automatic build is performed for the deployment mode of one primary database instance and multiple standby database instances. auto build: calls the incremental build first and calls the full build after the incremental build fails.

-c

Rebuilds cm_server (by copying the DCC data directory on the primary node to the specified node. This method is applicable only to the scenario where there are one primary node and one standby node.)

Table 5 Options of check

Option

Description

-B BINNAME

Specifies the name of a process, which can be cm_agent, gaussdb, or cm_server.

-T DATAPATH

Specifies the instance data directory.

Table 6 Options of stop

Option

Description

-m SHUTDOWN-MODE

Specifies the stop mode. The values are as follows:

  • smart (s): All database instances exit after user services end.
  • fast (f): The specified database instance exits without waiting for the user service to end.
  • immediate (i): The specified database instance is forced to exit without waiting for the user service to end.

Table 7 Options of query

Option

Description

-s

Displays instances that result in unbalanced primary and standby instance quantity on each host.

Note:

The -s option must be used together with -v and -C so that instances that result in unbalanced primary and standby instance quantity on each host can be displayed in pairs. When -s is used, -C and -v must be specified.

-C

Displays the database instance status in pairs based on the primary and standby relationship.

Note:

The -C option must be used together with -v to display detailed database instance status information in pairs based on the primary and standby relationship. When -C is used, -v must be specified.

-v

Displays the detailed database instance status.

Note:

A database instance can be in any of the following states:

  • Normal: indicates that the database instance is available and data is backed up. All the processes are running and the primary-standby relationship is normal.
  • Degraded: The database instance is available, but data is not backed up.
  • Degraded: The database instance is unavailable.

-d

Displays the instance data directory.

Note:

The -d option must be used together with -v and -C.

-i

Displays the IP address of the physical node.

Note:

The -i option must be used together with -v and -C.

-F

Displays the Fenced UDF status of each node.

Note:

The -F option must be used together with -v and -C to display the fenced UDF status of each node. When -F is used, -C and -v must be specified.

-z ALL

Displays the name of the AZ where the database instance is located.

Note:

The -z option must be used together with -v and -C, and must be followed by ALL.

-r

Displays the redo status of the standby node.

Note:

When -r is used, the -v must be specified.

-g

Displays information about cluster backup and restoration.

-x

Displays all abnormal database instances.

Note:

The -x option must be used together with -v and -C.

-S

Displays the status check result when the database instance is started.

Note:
The -S option must be used together with -v and -C to display the database instance status check result. The values are as follows:
  • Normal: The database instance is available and data is backed up. All the processes are running and the primary-standby relationship is normal.
  • Degraded: The database instance is available, but data is not backed up.
  • Degraded: The database instance is unavailable.

--minorityAz

Queries the CMS in a specified AZ.

description:

This ignores the CMS nodes in non-specified AZs and can improve the query speed in few scenarios.

-p

Displays the ports of all database instance nodes.

Note:

The -p option must be used together with -v and -C.

Table 8 Options of set

Option

Description

--log_level=LOG_LEVEL

Sets the log level of the primary cm_server. Six log levels are included: DEBUG5, DEBUG1, WARNING, LOG, ERROR, and FATAL, in an ascending order in terms of log print level. The higher the log level, the less the output log information.

--cm_arbitration_mode=ARBITRATION_MODE

Sets the arbitration mode of cm_server when one primary node and multiple standby nodes are deployed. There are two modes: MAJORITY and MINORITY. MAJORITY indicates the majority mode, and MINORITY indicates the minority mode. openGauss does not support the MINORITY mode. This parameter can be set to MINORITY but it does not take effect.

--cm_switchover_az_mode=

SWITCHOVER_AZ_MODE

Specifies whether to enable automatic switchover between AZs when one primary node and multiple standby nodes are deployed. There are two modes: NON_AUTO and AUTO. NON_AUTO indicates the non-automatic switchover mode, and AUTO indicates the automatic switchover mode. In AUTO mode, the primary cm_server automatically controls the node instance switchover between AZ1 and AZ2.

--cmsPromoteMode=CMS_PROMOTE_MODE -I INSTANCEID

Sets the promotion mode to primary of cm_server. There are two modes: AUTO and PRIMARY_F. AUTO indicates that the promotion mode to primary is automatically selected. PRIMARY_F indicates that the node specified by -I is forcibly promoted to primary, regardless of whether there is a primary node. Therefore, multiple primary cm_server may exist.

Table 9 Options of set cm

Option

Description

--param

Specifies the CM parameters to be set. If this option is not specified, the CM parameters cannot be set.

--agent | --server

Specifies whether to set the cm_server or cm_agent parameters. This option is mandatory.

-k parameter="value"

Specifies the parameters and parameter values to be set. Only existing parameters can be set. Parameters cannot be added or deleted.

Table 10 Options of get

Option

Description

--log_level=LOG_LEVEL

Obtains the log level of the primary cm_server. Six log levels are included: DEBUG5, DEBUG1, WARNING, LOG, ERROR, and FATAL, in an ascending order in terms of log print level. The higher the log level, the less the output log information.

--cm_arbitration_mode=ARBITRATION_MODE

Obtains the arbitration mode of cm_server when one primary node and multiple standby nodes are deployed. There are two modes: MAJORITY and MINORITY. MAJORITY indicates the majority mode, and MINORITY indicates the minority mode. The MINORITY mode is applicable to the scenario where one primary database and multiple standby databases are deployed and only AZ3 is alive. In this case, cm_server can perform arbitration properly. In other modes, after the arbitration mode is set to MINORITY, the CM automatically changes the arbitration mode to MAJORITY to ensure the normal running of the cluster. The MAJORITY mode is applicable to the scenario where one primary database and multiple standby databases are deployed and the number of alive components (cm_server and nodes) is greater than half of the total. In normal cases, the database instance is in MAJORITY mode by default.

Note:

openGauss does not support the MINORITY mode.

--cm_switchover_az_mode

=SWITCHOVER_AZ_MODE

Obtains the automatic switchover between AZs when one primary node and multiple standby nodes are deployed. There are two modes: NON_AUTO and AUTO. NON_AUTO indicates the non-automatic switchover mode, and AUTO indicates the automatic switchover mode. In AUTO mode, the primary cm_server automatically controls the node instance switchover between AZ1 and AZ2.

Table 11 Options of view

Option

Description

-v

Displays the static configuration details of all nodes in the database instance.

description:

Compared with the cm_ctl view command, cm-server and node component IDs (for example, cmseverInstanceID and datanodeInstanceID) are added to the output of -v.

-N

Displays only the static configuration of the local node, that is, information about the node where the cm_ctl view command is executed. N indicates native.

Table 12 Options of setrunmode

Option

Description

Value Range

--xmode

Specifies the DCF running mode.

  • normal: normal mode.
  • minority: minority mode. The --votenum option is required to specify the number of votes.

--votenum

Specifies the number of votes for a DCF minority run.

The value is a positive integer and cannot be greater than the total number of DCF copies.

Table 13 Options of changerole

Option

Description

Value Range

--role

Changes the primary role to passive or follower in the DCF mode.

  • passive: passive role
  • follower: follower role

Table 14 Options of changemember

Option

Description

Value Range

--role

Changes the primary role to passive or follower in the DCF mode.

  • passive: passive role
  • follower: follower role

--group

Changes the value of group in DCF mode.

0~2147483647

--priority

Changes the value of priority in DCF mode.

0~2147483647

Table 15 Options of start

Option

Description

--cm_arbitration_mode=ARBITRATION_MODE

Obtains the arbitration mode of cm_server when one primary node and multiple standby nodes are deployed. There are two modes: MAJORITY and MINORITY. MAJORITY indicates the majority mode, and MINORITY indicates the minority mode. The MINORITY mode is applicable to the scenario where one primary database and multiple standby databases are deployed and only AZ3 is alive. In this case, cm_server can perform arbitration properly. In other modes, after the arbitration mode is set to MINORITY, the CM automatically changes the arbitration mode to MAJORITY to ensure the normal running of the cluster. The MAJORITY mode is applicable to the scenario where one primary database and multiple standby databases are deployed and the number of alive components (cm_server and nodes) is greater than half of the total. In normal cases, the database instance is in MAJORITY mode by default.

Note:

openGauss does not support the MINORITY mode.

Table 16 Options of reload

Option

Description

--param

Specifies the CM parameters to be loaded. If this parameter is not specified, the CM parameters cannot be loaded.

--agent | --server

Specifies whether to dynamically load cm_server or cm_agent parameters.

Table 17 Options of list

Option

Description

--param

Specifies the CM parameters to be listed. This is mandatory.

--agent | --server

Specifies the cm_server or cm_agent parameters to be listed. This is mandatory.

Table 18 Options of encrypt

Option

Description

-M

Specifies the encryption type. The value can be server or client. The default value is server.

-D

Specifies the path of the encrypted password file.

Table 19 Options of switch

Option

Description

--ddb_type=[DDB]

Select the DDB mode to be switched to. (openGauss supports only the DCC mode.)

--commit

After the switchover, the database instance cannot be promoted to primary. You need to run the commit command to restore the database instance.

--rollback

Rolls back the switchover that fails.

Table 20 Options of ddb

Option

Description

--put [key] [value]

Inserts a key-value pair to DCC. If the key-value pair already exists, the value corresponding to the key is changed.

--get [key]

Queries the value corresponding to the key in DCC.

--delete [key]

Deletes a specified key-value pair from DCC.

--prefix

You can add the prefix option after the get or delete operation to implement fuzzy query and deletion.

--cluster_info

Obtains the database instance information.

--leader_info

Obtains information about the primary node.

--help, -h

Displays the DCC command help information.

--version, -v

Displays the DCC version information.

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 finishredo
    
  • Rebuild 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 DATAPATH
    
  • Stop 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 DATADIR
    
  • Run 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 --help
    
  • Run the switch ddb command.

    cm_ctl switch [--ddb_type=[DDB]] [--commit] [--rollback]
    

cm_install and cm_uninstall Tools

The cm_install tool can be used to deploy CMs in the openGauss database cluster. The cm_uninstall tool can be used to uninstall CMs from the openGauss database cluster without affecting the DN cluster.

Precautions

  • After cm_install is executed, the cluster is started by default.
  • This tool must be used as an individual user.

Prerequisites

  • The OM tool is required for installing the openGauss cluster.
  • Generally, the cluster installed using the OM tool can ensure that mutual trust exists between nodes in the cluster.
  • The version of the openGauss cluster to be installed is the same as that of the CM to be installed.

Usage

Installation

cm_install -? | --help
cm_install -X XMLFILE [-e envFile] --cmpkg=cmpkgPath

Uninstallation

cm_uninstall -? | --help
cm_uninstall -X XMLFILE [-e envFile] [--deleteData] [--deleteBinary]

Description:

  • -X

    Specifies the path of the XML file. The value must be an absolute path.

  • -e

    Specifies the path of the environment variable file. The value must be an absolute path. The default value is ~/.bashrc.

  • --cmpkg

    Specifies the path of the CM package. The value must be an absolute path.

  • --deleteData

    Deletes the CM data directory. By default, the CM data directory is not deleted.

  • --deleteBinary

    Delete CM-related binary files, including om_monitor, cm_agent, cm_server, and cm_ctl. By default, the binary files are not deleted.

  • -?, --help

    Displays help information.

Security Design

Procedure for Manually Replacing Certificates

  • Create a self-signed certificate.

    For details about how to create a self-signed certificate, seeGenerating Certificates.

    To protect the private key password, use the cm encrypt tool. For details, see cm_ctl.

    cm_ctl encrypt [-M MODE] -D DATADIR
    
    1. Generate the server key factors server.key.cipher and server.key.rand.

      cm_ctl encrypt -M server -D DATADIR
      please enter the password: (The password must be the same as the protection password of the server private key.)
      
    2. Generate the client key factors client.key.cipher and client.key.rand.

      cm_ctl encrypt -M client -D DATADIR
      please enter the password: (The password must be the same as the protection password of the client private key.)
      

Certificate Usage Guide

  1. To use the certificate, you need to set the cm_server parameter to on (The default value is off).

    cm_ctl set --param --server -k enable_ssl="on"
    
  2. The certificate file must exist in $GAUSSHOME**/share/sslcert/cm** on all nodes. After the certificate is replaced, restart the cluster for the certificate to take effect.

    Required certificate files include server.crt, server.key, client.crt, client.key, cacert.pem, server.key.cipher, server.key.rand, client.key.cipher, and client.key.rand.

    The permission on the root certificate, key, certificate, and encrypted key file should be 400. If the permission does not meet the requirements, SSL cannot be used.

    • chmod 400 cacert.pem
    • chmod 400 server.crt
    • chmod 400 server.key
    • chmod 400 server.key.cipher
    • chmod 400 server.key.rand
    • chmod 400 client.crt
    • chmod 400 client.key
    • chmod 400 client.key.cipher
    • chmod 400 client.key.rand
  3. The certificate validity period is checked every day, which can be set by running the ssl_cert_expire_check_interval command. An alarm is generated when the certificate is about to expire in 90 days, which can be set by running the [ssl_cert_expire_alert_threshold](#ssl_cert_expire_alert_threshold) command.

CM Parameters

You can view cm_agent parameters in the cm_agent.conf file in the cm_agent data directory and cm_server parameters in the cm_server.conf file in the cm_server data directory.

log_dir

Parameter description: Specifies the directory where cm_agent logs are stored. It can be specified as an absolute path, or a path relative to $GAUSSLOG. When you set an absolute path using cm_ctl, the path must be included in quotation marks (""), for example, cm_ctl set --param --agent -k log_dir="'/log/dir'".

Value range: a string of up to 1024 characters. Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

Default value: log, indicating that the cm_agent log is generated in the CM directory in $GAUSSLOG.

log_file_size

Parameter description: Specifies the size of a log file. If the size of the cm_agent-xx-current.log file exceeds the specified size, a new log file is created to record log information.

Value range: an integer ranging from 0 to 2047. The actual value range that takes effect is from 1 to 2047 (MB). Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

Default value: 16 MB

log_min_messages

Parameter description: Specifies which message levels are written to the cm_agent log. A higher level covers the messages of all the lower levels. The lower the level is, the fewer messages will be written into the log.

Value range: enumerated type. Valid values are debug5, debug1, warning, error, log, and fatal (case-insensitive). Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

Default value: warning

incremental_build

Parameter description: Specifies whether a standby node is incrementally built. If this parameter is enabled, a standby node is incrementally rebuilt. Otherwise, a standby node is fully rebuilt.

Value range: Boolean Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

  • on, yes, true, or 1: A standby node is incrementally rebuilt.

  • off, no, false, or 0: A standby node is fully rebuilt.

Default value: on

security_mode

Parameter description: Specifies whether nodes are started in secure mode. If this parameter is enabled, nodes are started in secure mode. Otherwise, nodes are started in non-secure mode.

Value range: Boolean The modification of this parameter takes effect dynamically. For details, see Options of set cm.

  • on, yes, true, or 1: Nodes are started in secure mode.

  • off, no, false, or 0: Nodes are started in non-secure mode.

Default value: off

upgrade_from

Parameter description: Specifies the internal version number of the database before an in-place upgrade. Do not modify the value of this parameter.

Value range: a non-negative integer, in the range [0,4294967295]. Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

Default value: 0

alarm_component

Parameter description: Sets the position of the alarm component that handles alarms if the first mode is used. When you set an absolute path using cm_ctl, the path must be included in quotation marks (""), for example, cm_ctl set --param --agent -k alarm_component="'/alarm/dir'".

Value range: a string of up to 1024 characters. Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

Default value: /opt/huawei/snas/bin/snas_cm_cmd

alarm_report_interval

Parameter description: specifies the interval at which an alarm is reported.

Value range: a non-negative integer, in the range [0,2147483647] (unit: second). The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 1

agent_heartbeat_timeout

Parameter description: Specifies the time to wait before the cm_server heartbeat times out.

Value range: an integer, in the range [2,2147483647] (unit: second). Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

Default value: 5

agent_connect_timeout

Parameter description: Specifies the time to wait before the attempt of cm_agent to connect to cm_server times out.

Value range: an integer, in the range [0,2147483647] (unit: second). Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

Default value: 1

agent_connect_retries

Parameter description: Specifies the number of times cm_agent tries to connect to the cm_server.

Value range: an integer, in the range [0,2147483647]. Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

Default value: 15

agent_kill_instance_timeout

Parameter description: Specifies the interval from the time when cm_agent fails to connect to the primary cm_server to the time when cm_agent kills all instances on the node.

Value range: an integer, in the range [0,2147483647]. Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

Default value: 0, indicating that the operation of killing all instances on the node is not initiated.

agent_report_interval

Parameter description: Specifies the interval at which cm_agent reports the instance status.

Value range: an integer, in the range [0,2147483647]. Unit: second. Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

Default value: 1

alarm_report_max_count

Parameter description: Specifies the maximum number of times an alarm is reported.

Value range: a non-negative integer, in the range [1,2592000]. The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 1

agent_check_interval

Parameter description: Specifies the interval at which cm_agent queries for the status of instances.

Value range: an integer, in the range [0,2147483647] (unit: second). Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

Default value: 2

enable_log_compress

Parameter description: Specifies whether to enable log compression.

Value range: Boolean Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

  • on, yes, true, or 1: Log compression is allowed.
  • off, no, false, or 0: Log compression is not allowed.

Default value: on

process_cpu_affinity

Parameter description: Specifies whether to bind a primary node process to a CPU core before starting the process. If this parameter is set to 0, core binding is not performed. If it is set to another value, core binding is performed, and the number of physical CPU cores is 2n. Restart the database and cm_agent for the modification to take effect. Only ARM is supported. For details, see Options of set cm.

Value range: an integer, in the range [0,2].

Default value: 0

enable_xc_maintenance_mode

Parameter description: Specifies whether the pgxc_node system catalog can be modified when the database is in read-only mode.

Value range: Boolean The modification of this parameter takes effect after reloading. For details, see Options of set cm.

  • on, yes, true, or 1: The function of modifying the pgxc_node system catalog is enabled.

  • off, no, false, or 0: disables the function of modifying the pgxc_node system catalog.

Default value: on

log_threshold_check_interval

Parameter description: Specifies the interval for compressing and clearing CM logs. Typically, this interval is set to 1800s.

Application scope: Files in the $GAUSSLOG/cm/cm_ctl, $GAUSSLOG/cm/cm_server, and $GAUSSLOG/cm/om_monitor directories and log files prefixed with cm_agent-, system_call-, and system_alarm- in the $GAUSSLOG/cm/cm_agent directory.

Value range: an integer, in the range [0,2147483647] (unit: second). Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

Default value: 1800

log_max_size

Parameter description: Specifies the maximum size of CM logs. When the total size of CM logs exceeds (log_max_size x 95/100) MB, historical compressed logs are deleted in sequence based on the log generation time until the total size is less than (log_max_size x 95/100) MB.

Application scope: Files in the $GAUSSLOG/cm/cm_ctl, $GAUSSLOG/cm/cm_server, and $GAUSSLOG/cm/om_monitor directories and log files prefixed with cm_agent-, system_call-, and system_alarm- in the $GAUSSLOG/cm/cm_agent directory.

Value range: an integer, in the range [0,2147483647] (unit: MB). Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

Default value: 10240

log_max_count

Parameter description: Specifies the maximum number of CM logs that can be stored. When the total number of CM logs exceeds the value of this parameter, historical compressed logs that have been stored for more than the value of log_saved_days based on the generation time in the log file name.

Application scope: Files in the $GAUSSLOG/cm/cm_ctl, $GAUSSLOG/cm/cm_server, and $GAUSSLOG/cm/om_monitor directories and log files prefixed with cm_agent-, system_call-, and system_alarm- in the $GAUSSLOG/cm/cm_agent directory.

Value range: an integer, in the range [0,10000]. Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

Default value: 10000

log_saved_days

Parameter description: Specifies the number of days for storing compressed CM logs. If the number of compressed logs exceeds the value of this parameter and the total number of CM logs exceeds the value of log_max_count, the compressed logs are deleted.

Application scope: Files in the $GAUSSLOG/cm/cm_ctl, $GAUSSLOG/cm/cm_server, and $GAUSSLOG/cm/om_monitor directories and log files prefixed with cm_agent-, system_call-, and system_alarm- in the $GAUSSLOG/cm/cm_agent directory.

Value range: an integer, in the range [0,1000] (unit: day). Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

Default value: 90

agent_phony_dead_check_interval

Parameter description: Specifies the interval at which cm_agent checks whether the process is suspended.

Value range: an integer, in the range [0,2147483647] (unit: second). Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

Default value: 10

unix_socket_directory

Parameter description: Specifies the directory location of the Unix socket. When you set an absolute path using cm_ctl, the path must be included in quotation marks (""), for example, cm_ctl set --param --agent -k unix_socket_directory="'/unix/dir'".

Value range: a string of up to 1024 characters. Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

Default value: ''

dilatation_shard_count_for_disk_capacity_alarm

Parameter description: Specifies the number of shards to be added in the scale-out scenario. This parameter is used to calculate the threshold for reporting a disk capacity alarm.

Value range: an integer, in the range [0,2147483647]. If this parameter is set to 0, the disk scale-out alarm is not reported. If this parameter is set to a value greater than 0, the disk scale-out alarm is reported and the threshold is calculated based on the number of shards specified by this parameter. Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

Default value: 1

enable_dcf

Parameter description: Specifies the status of the DCF mode.

Value range: Boolean Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

  • on, yes, true, or 1: The DCF function is enabled.
  • off, no, false, or 0: The DCF function is disabled.

Default value: off

disaster_recovery_type

Parameter description: Specifies the type of the DR relationship between primary and standby databases.

Value range: an integer, in the range [0,2]. Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

  • 0 indicates that no DR relationship is established.
  • 1 indicates that the OBS DR relationship is established.
  • 2 indicates that the streaming DR relationship is established.

Default value: 0

agent_backup_open

Parameter description: Specifies whether to enable the DR mode. After the DR mode is enabled, the CM runs in DR mode.

Value range: an integer, in the range [0,2]. Any modification of this parameter takes effect only after cm_agent is restarted. For details, see Options of set cm.

  • 0 indicates that no DR relationship is established.
  • 1 indicates that the OBS DR relationship is established (not supported later versions).
  • 2 indicates that the streaming DR relationship is established.

Default value: 0

enable_fence_dn

Parameter description: Specifies whether to restart the DN process when cm_agent cannot connect to any CMS except its own CMS which is not primary.

Value range: Boolean The modification of this parameter takes effect after reloading. For details, see Options of set cm.

  • on, yes, true, or 1: The DN process is restarted.

  • off, no, false, or 0: The DN process is not restarted.

Default value:

log_dir

Parameter description: Specifies the directory where cm_server logs are stored. It can be specified as an absolute path, or a path relative to $GAUSSLOG. When you set an absolute path using cm_ctl, the path must be included in quotation marks (""), for example, cm_ctl set --param --server -k log_dir="'/log/dir'".

Value range: a string of up to 1024 characters. You need to restart cm_server for the modification to take effect. For details, see Options of set cm.

Default value: log, indicating that the cm_server log is generated in the CM directory in $GAUSSLOG.

log_file_size

Parameter description: Specifies the size of a log file. If the size of the cm_server-xx-current.log file exceeds the specified size, a new log file is created to record log information.

Value range: an integer ranging from 0 to 2047. The actual value range that takes effect is from 1 to 2047 (MB). You need to restart cm_server for the modification to take effect. For details, see Options of set cm.

Default value: 16MB

log_min_messages

Parameter description: Specifies which message levels are written to the cm_server log. A higher level covers the messages of all the lower levels. The lower the level is, the fewer messages will be written into the log.

Value range: enumerated type. Valid values are debug5, debug1, warning, error, log, and fatal, which are case-insensitive. You need to restart cm_server for the modification to take effect. For details, see Options of set cm.

Default value: warning

thread_count

Parameter description: Specifies the number of threads in the cm_server thread pool.

Value range: an integer, in the range [2,1000]. You need to restart cm_server for the modification to take effect. For details, see Options of set cm.

Default value: 1000

instance_heartbeat_timeout

Parameter description: Specifies the time to wait before the instance heartbeat times out.

Value range: an integer, in the range [1,2147483647] (unit: second). You need to restart cm_server for the modification to take effect. For details, see Options of set cm.

Default value: 6

instance_failover_delay_timeout

Parameter description: Specifies the delay in cm_server failover after the primary cm_server breakdown is detected.

Value range: an integer, in the range [0,2147483647] (unit: second). You need to restart cm_server for the modification to take effect. For details, see Options of set cm.

Default value: 0

cmserver_ha_connect_timeout

Parameter description: Specifies the time to wait before the connection between the primary and standby cm_servers times out.

Value range: an integer, in the range [0,2147483647] (unit: second). You need to restart cm_server for the modification to take effect. For details, see Options of set cm.

Default value: 2

cmserver_ha_heartbeat_timeout

Parameter description: Specifies the time to wait before the heartbeat between the primary and standby cm_server times out.

Value range: an integer, in the range [1,2147483647] (unit: second). You need to restart cm_server for the modification to take effect. For details, see Options of set cm.

Default value: 6

cmserver_ha_status_interval

Parameter description: Specifies the interval between synchronizations of primary and standby CM Server status.

Value range: an integer, in the range [1,2147483647] (unit: second). You need to restart cm_server for the modification to take effect. For details, see Options of set cm.

Default value: 1

cmserver_self_vote_timeout

Parameter description: Specifies the timeout interval for cm_server to vote for each other. This parameter is a legacy parameter and does not take effect.

Value range: an integer, in the range [0,2147483647] (unit: second). The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 6

phony_dead_effective_time

Parameter description: Specifies the maximum number of times a database node is detected as a zombie. If the number of times the node is detected as a zombie is greater than the specified value, a process on the node is considered to be a zombie and will be restarted.

Value range: an integer, in the range [1,2147483647]. You need to restart cm_server for the modification to take effect. For details, see Options of set cm.

Default value: 5

cm_server_arbitrate_delay_base_time_out

Parameter description: Specifies the basic duration of cm_server arbitration delay. If the primary cm_server is disconnected, the arbitration starts to be timed. If the disconnection duration exceeds the arbitration delay duration, a new primary cm_server will be selected. The arbitration delay duration is determined by the basic delay duration, the node index (server ID), and the incremental delay duration. The formula is as follows: Arbitration delay duration = Basic delay duration + Node index x Incremental delay duration

Value range: an integer, in the range [0,2147483647] (unit: second). You need to restart cm_server for the modification to take effect. For details, see Options of set cm.

Default value: 10

cm_server_arbitrate_delay_incrememtal_time_out

Parameter description: Specifies the incremental delay duration for cm_server arbitration. If the primary cm_server is disconnected, the arbitration starts to be timed. If the disconnection duration exceeds the arbitration delay duration, a new primary cm_server will be selected. The arbitration delay duration is determined by the basic delay duration, the node index (server ID), and the incremental delay duration. The formula is as follows: Arbitration delay duration = Basic delay duration + Node index x Incremental delay duration

Value range: an integer, in the range [0,2147483647] (unit: second). You need to restart cm_server for the modification to take effect. For details, see Options of set cm.

Default value: 3

alarm_component

Parameter description: Specifies the position of the alarm component that handles alarms if the first mode is used. For details, see Options of set cm. When you set an absolute path using cm_ctl, the path must be included in quotation marks (""), for example, cm_ctl set --param --server -k alarm_component="'/alarm/dir'".

Value range: a string of up to 1024 characters. You need to restart cm_server for the modification to take effect.

Default value: /opt/huawei/snas/bin/snas_cm_cmd

alarm_report_interval

Parameter description: specifies the interval at which an alarm is reported.

Value range: a non-negative integer, in the range [0,2147483647] (unit: second). The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 3

alarm_report_max_count

Parameter description: Specifies the maximum number of times an alarm is reported.

Value range: a non-negative integer, in the range [1,2592000]. The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 1

instance_keep_heartbeat_timeout

Parameter description: cm_agent periodically checks the instance status and reports the status to cm_server. If the instance status cannot be detected for a long time and the accumulated number of times exceeds the value of this parameter, cm_server delivers a command to cm_agent to restart the instance.

Value range: an integer, in the range [0,2147483647] (unit: second). The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 40

az_switchover_threshold

Parameter description: If the failure rate of a node shard in an AZ (Number of faulty node shards/Total number of node shards x 100%) exceeds the specified value, automatic AZ switchover is triggered.

Value range: an integer ranging from 1 to 100. The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 100

az_check_and_arbitrate_interval

Parameter description: Specifies the interval for checking the AZ status. If the status of an AZ is abnormal, automatic AZ switchover is triggered.

Value range: an integer, in the range [1,2147483647] (unit: second). The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 2

az_connect_check_interval

Parameter description: Specifies the interval at which the network connection between AZs is checked.

Value range: an integer, in the range [1,2147483647] (unit: second). The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 60

az_connect_check_delay_time

Parameter description: Specifies the delay between two retries to check the network connection between AZs.

Value range: an integer, in the range [1,2147483647] (unit: second). The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 150

cmserver_demote_delay_on_etcd_fault

Parameter description: Specifies the interval at which cm_server switches from the primary state to the standby state due to unhealthy etcd.

Value range: an integer, in the range [1,2147483647] (unit: second). The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 8

instance_phony_dead_restart_interval

Parameter description: Specifies the interval at which cm_agent restarts and kills a zombie database instance. The interval between two consecutive kill operations cannot be less than the value of this parameter. Otherwise, cm_agent does not deliver commands.

Value range: an integer, in the range [1800,2147483647] (unit: second). The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 21600

enable_transaction_read_only

Parameter description: Specifies whether the database is in read-only mode.

Value range: Boolean values on, off, true, false, yes, no, 1, and 0 The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: on

datastorage_threshold_check_interval

Parameter description: Specifies the interval for checking the disk usage. This interval is specified by the user.

Value range: an integer, in the range [1,2592000] (unit: second). The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 10

datastorage_threshold_value_check

Parameter description: Specifies the usage threshold of a read-only disk in a database. When the disk usage of the data directory exceeds the specified value, the database is automatically set to read-only.

Value range: an integer, in the range [1,99]. The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 85

max_datastorage_threshold_check

Parameter description: Specifies the maximum interval for checking the disk usage. After you modify the enable_transaction_read_only parameter, the system automatically checks whether the disk usage reaches the threshold at the specified interval.

Value range: an integer, in the range [1,2592000] (unit: second). The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 43200

enable_az_auto_switchover

Parameter description: Specifies whether to enable automatic AZ switchover. If it is set to 1, cm_server automatically switches over services among AZs. Otherwise, when a node is faulty, services will not be automatically switched to another AZ even if the current AZ is unavailable. You can run the switchover command to manually switch services to another AZ.

Value range: a non-negative integer. The value 0 indicates that automatic AZ switchover is disabled, and the value 1 indicates that automatic AZ switchover is enabled. The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 1

cm_krb_server_keyfile

Parameter description: Specifies the location of the key file on the Kerberos server. The value must be an absolute path. The file is usually stored in the ${GAUSSHOME}/kerberos directory and the file name extension is keytab. The file name is the same as the name of the user who runs the cluster. This parameter is used together with cm_auth_method. If the value of the cm_auth_method parameter is changed to gss, cm_krb_server_keyfile must also be set to the corresponding path correctly. Otherwise, the cluster status will be affected. When you set an absolute path using cm_ctl, the path must be included in quotation marks (""), for example, cm_ctl set --param --server -k cm_krb_server_keyfile="'/krb/dir'".

Value range: a string. Any modification of this parameter takes effect only after cm_server is restarted. For details, see Options of set cm.

Default value: ${GAUSSHOME}/kerberos/{Username}.keytab. The default value does not take effect and is used only for reference.

switch_rto

Parameter description: Specifies the delay for the forcible startup of cm_server. When force_promote is set to 1 and a shard in the cluster does not have primary CM Server, the system starts timing. After the delay, the forcible startup logic starts to be executed.

Value range: an integer, in the range [60,2147483647] (unit: second). You need to restart cm_server for the modification to take effect. For details, see Options of set cm.

Default value: 600

force_promote

Parameter description: Specifies whether cm_server enables the forcible startup logic (that is, when the cluster status is unknown, ensure that the basic functions of the cluster are available at the cost of data loss). The value 0indicates that the function is disabled, and the value 1 indicates that the function is enabled.

Value range: an integer, 0 or 1. You need to restart cm_server for the modification to take effect. For details, see Options of set cm.

Default value: 0

backup_open

Parameter description: Specifies whether to enable the DR cluster. After the DR cluster is enabled, the CM runs in DR cluster mode.

Value range: an integer, 0 or 1. You need to restart cm_server for the modification to take effect. This parameter cannot be enabled for non-DR clusters. For details, see Options of set cm.

  • 0: The DR cluster is disabled.
  • 1: The DR cluster is enabled.

Default value: 0

enable_dcf

Parameter description: Specifies the status of the DCF mode.

Value range: Boolean You need to restart cm_server for the modification to take effect. For details, see Options of set cm.

  • on, yes, true, or 1: The DCF function is enabled.
  • off, no, false, or 0: The DCF function is disabled.

Default value: off

ddb_type

Parameter description: Specifies whether to switch between ETCD and DCC modes.

Value range: an integer. 0: specifies the ETCD mode; 1: specifies the DCC mode. You need to restart cm_server for the modification to take effect. For details, see Options of set cm.

Default value: 1

NOTE:

The openGauss supports only the DCC mode.

enable_ssl

Parameter description: Specifies whether to enable SSL.

Value range: Boolean After this function is enabled, the SSL certificate is used to encrypt communication. You need to restart cm_server for the modification to take effect. For details, see Options of set cm.

Default value:

  • on, yes, true, or 1: SSL is enabled.

  • off, no, false, or 0: SSL is disabled.

  • Default value: off

    NOTICE: To ensure security, you are advised not to disable it. After this function is disabled, the CM does not use encrypted communication and all information is transmitted in plaintext, which may bring security risks such as eavesdropping, tampering, and spoofing.

ssl_cert_expire_alert_threshold

Parameter description: Specifies the SSL certificate expiration alarm time.

Value range: an integer, in the range [7,180] (unit: day). If the certificate expiration time is less than the value of this parameter, an alarm indicating that the certificate is about to expire is reported. The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 90

ssl_cert_expire_check_interval

Parameter description: Specifies the period for checking whether the SSL certificate expires.

Value range: an integer, in the range [0,2147483647] (unit: second). The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 86400

ddb_log_level

Parameter description: Sets the DDB log level.

To disable the log function, set this parameter to NONE, which cannot be used together with the following log levels:

To enable the log function, set this parameter to one or a combination of the following log levels: RUN_ERR|RUN_WAR|RUN_INF|DEBUG_ERR|DEBUG_WAR|DEBUG_INF|TRACE|PROFILE|OPER. If two or more log levels are used together, separate them with vertical bars (|). The log level cannot be set to an empty string.

Value range: a string containing one or a combination of the following log levels: RUN_ERR|RUN_WAR|RUN_INF|DEBUG_ERR|DEBUG_WAR|DEBUG_INF|TRACE|PROFILE|OPER. The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: RUN_ERR|RUN_WAR|DEBUG_ERR|OPER|RUN_INF|PROFILE

ddb_log_backup_file_count

Parameter description: Specifies the maximum number of log files that can be saved.

Value range: an integer ranging from 1 to 100. The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 10

ddb_max_log_file_size

Parameter description: Specifies the maximum number of bytes in a log.

Value range: a string with up to 1024 characters, in the range [1M,1000M]. The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 10M

ddb_log_suppress_enable

Parameter description: Specifies whether to enable the log suppression function.

Value range: an integer. 0: disabled; 1: enabled. The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 1

ddb_election_timeout

Parameter description: Specifies the DCC election timeout period.

Value range: an integer, in the range [1,600], in seconds. The modification of this parameter takes effect after reloading. For details, see Options of set cm.

Default value: 3

delay_arbitrate_timeout

Parameter description: Specifies the time for waiting for the redo log replay of a node in the same AZ as the primary DN. The node in the same AZ as the primary DN is preferentially promoted to primary.

Value range: an integer, in the range [0,2147483647] (unit: second). For details, see Options of set cm.

Default value: 0

cm_auth_method

Parameter description: Specifies the port authentication mode of the CM. trust indicates that port authentication is not configured. gss indicates that Kerberos port authentication is used. Note that you can change the value to gss only after the Kerberos server and client are successfully installed. Otherwise, the CM cannot communicate properly, affecting the database status.

Value range: gss or trust. You need to restart cm_server for the modification to take effect. For details, see Options of set cm.

Default value: trust

dn_arbitrate_mode

Parameter description: Specifies the DN arbitration mode.

Value range: a string. The modification of this parameter takes effect after reloading. For details about how to modify parameters, see Parameters for set cm. In share_disk mode, you are not advised to change the arbitration mode.

  • quorum
  • paxos
  • share_disk

Default value: quorum

Feedback
编组 3备份
    openGauss 2024-05-20 00:47:31
    cancel