GBase 8s Connection Manager (CM) Configuration Parameters Explained

Cong Li - Aug 19 - - Dev Community

In the stable operation of a database, the Connection Manager (CM) plays a crucial role. It not only monitors and maintains client connections but also ensures efficient management and load balancing through a series of fine-tuned configuration parameters. This article will guide you through the various parameters in the GBase database CM configuration file, including basic settings and options, providing you with a comprehensive CM configuration guide.

The CM configuration file is divided into two main sections: HEADER and BODY. This section details the structure of the CM configuration file and explains the role of each part.

CM Configuration File Parameters - HEADER Section

  • NAME Parameter: Defines the name of the CM instance and is a mandatory parameter.
  • MACRO Parameter: Simplifies the management of server lists through macro definitions and supports load balancing.
  • LOCAL_IP Parameter: Specifies the IP address of the machine where the CM is monitored.
  • LOG Parameter: Sets the CM log level, ranging from 0 to 3.
  • LOGFILE Parameter: Specifies the storage path for log files.
  • DEBUG Parameter: Enables or disables debug mode to log SQL error messages.
# *** HEADER ***
# Mandatory Parameter
# Defines the name of the CM instance
NAME cm1 

# Optional Parameters
# Defines a name for a server list using macro definitions; multiple names can be configured
MACRO name_1=server1,server2 
# Load balancing based on CPU usage of the listed database servers
MACRO name_2=(server3,server4)
# Specifies the IP address of the machine running the connection manager
LOCAL_IP 192.168.x.x,172.16.x.x
# CM log level, configurable from 0 to 3; 0 disables logging, while 3 provides the most detailed logs    
LOG 1
# Log file path                                   
LOGFILE ${GBASEDBTDIR}/tmp/cm.log
# Enables or disables debug mode; 1 to enable, 0 to disable, default is 0; in debug mode, SQL error messages are logged    
DEBUG 0
# CM timeout in seconds, default is 60 seconds                               
CM_TIMEOUT 60
# Primary node event timeout in seconds, default is 60; configurable from -1 to 60; -1 means waiting indefinitely for the primary node event, or until notified by the secondary node that the primary node is offline; values from 0 to 30 are considered as 30 seconds                               
EVENT_TIMEOUT 60
# Secondary node event timeout, with the same parameter range as above                        
SECONDARY_EVENT_TIMEOUT 60 
# Configurable as LOCAL|REMOTE|LOCAL+REMOTE       
SQLHOSTS LOCAL                       
Enter fullscreen mode Exit fullscreen mode

CM Configuration File Parameters - BODY Section

  • unit_type and unit_name Parameters: Define the type and name of the connection unit.
  • GBASEDBTSERVER Parameter: Specifies the database servers the CM connects to during initialization.
  • SLA Parameter: Configures the Service Level Agreement, including sub-parameters like DBSERVERS, MODE, USEALIASES, POLICY, WORKERS, etc.
  • HOST, NETTYPE, SERVICE Parameters: Provide network configuration options for the connection.
  • SQLHOSTSOPT Parameter: Equivalent to the options in the sqlhosts file.
# *** BODY ***
# Configuration of connection units
unit_type unit_name_1                # unit_type can be configured as CLUSTER|REPLSET|GRID|SERVERSET 
{
GBASEDBTSERVER server_list        # Specifies the database servers the CM connects to during initialization; one or more servers or groups can be configured
    SLA sla_name_1 DBSERVERS=value \    # Mandatory parameter, configurable as ANY|PRI|primary|SDS|HDR|RSS|${marco_name}
                MODE=value \        # Optional parameter, configurable as REDIRECT|PROXY; default is REDIRECT, indicating whether to use redirection or proxy mode to connect to the server
                USEALIASES=value \    # Optional parameter, configurable as ON|OFF; default is ON, indicating whether client requests can be redirected to server aliases
                POLICY=value \        # Optional parameter, configurable as LATENCY|FAILURE|WORKLOAD; supports weight configuration, e.g., 10*LATENCY+FAILURE; default is WORKLOAD; this parameter specifies how to direct client connection requests based on specific rules or criteria: LATENCY (lowest latency), FAILURE (fewest failures), WORKLOAD (lowest workload)
                WORKERS=number_of_threads \ # Optional parameter, the number of working threads allocated to the current SLA; default is 4, used to handle client requests connecting to this SLA
                HOST=host_name \    # Can be configured as hostname or IP address; if configured, it overrides the value defined in the sqlhosts file, equivalent to hostname in the sqlhosts file
                NETTYPE=network_protocol \    # Configurable as onsoctcp|drsoctcp|onsocssl, equivalent to nettype in the sqlhosts file
                SERVICE=service_name \    # Configurable as port number or service name, equivalent to servicename in the sqlhosts file
                SQLHOSTSOPT=options    # Equivalent to options in the sqlhosts file, e.g., SQLHOSTSOPT="cms=path"
    SLA sla_name_2 DBSERVERS=value ...
    SLA sla_name_n DBSERVERS=value ...
     # Optional failover parameters
    FOC ORDER=value \    # Configurable as ENABLED|DISABLED|SDS,HDR,RSS; ENABLED - CM participates in failover and uses the HA_FOC_ORDER configuration parameter of the primary node to determine the failover order; DISABLED - disables CM failover processing; if PRIORITY is set to a positive number, ORDER must be set to ENABLED
        PRIORITY=value \    # Configurable as >=0; this value must be unique; 0: disables failover; greater than 0: when a CM with PRIORITY=n fails over, if it causes a CM with PRIORITY<n to lose connection to the primary node, the failover will be prevented
        TIMEOUT=seconds \    # Timeout in seconds, default is 0; after waiting for EVENT_TIMEOUT, additional TIMEOUT time is waited before failover begins if there is no event from the primary node
        RETRY=attempts        # Configurable as >=0; the number of failover attempts, 0: infinite attempts
    # Optional failover alarm parameters
    CMALARMPROGRAM path_and_filename    # Specifies the path to the program or script executed when a failover error occurs
}
# Connection Unit 2
unit_type unit_name_2
{
...
}
Enter fullscreen mode Exit fullscreen mode

With the explanations provided in this article, you should now have a thorough understanding of how to configure the CM parameters. Properly configuring the CM can not only enhance database connection performance but also improve system stability and reliability.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player