Updated on 2023-10-23 GMT+08:00

Connection Settings

This section describes parameters related to client-server connection modes.

listen_addresses

Parameter description: Specifies the TCP/IP address of the client for a server to listen on.

This parameter specifies the IP address used by the GaussDB server for listening, for example, IPv4. Multiple NICs may exist on the host and each NIC can be bound to multiple IP addresses. This parameter specifies the IP addresses to which GaussDB is bound. The client can use the IP address specified by this parameter to connect to or send requests to GaussDB.

This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Value range:

  • Host name or IP address. Multiple values are separated with commas (,).
  • Asterisk (*) or 0.0.0.0, indicating that all IP addresses will be listened on, which is not recommended due to potential security risks.
  • If the parameter is not specified, the server does not listen on any IP address. In this case, only Unix domain sockets can be used for database connections.

Default value:

After the cluster is installed, configure different default values based on the IP addresses of different instances in the public_cloud.conf file. The default value of CN is listen_addresses = 'localhost,IP address of the mgr.net NIC,IP address of the data.net NIC,IP address of the virtual.net NIC'. The default value of DN is listen_addresses ='IP address of the data.net NIC'.

localhost indicates that only local loopback is allowed.

The public_cloud.conf file contains the following NIC information: mgr.net (management NIC), data.net (data NIC), and virtual.net (virtual NIC).

local_bind_address

Parameter description: Specifies the host IP address bound to the current node for connecting to other nodes in the cluster.

This parameter is a POSTMASTER parameter.

This parameter is specified in the configuration file during installation. Do not modify this parameter unless absolutely necessary. Otherwise, database communication will be affected.

Default value:

After the cluster is installed, configure different default values based on the IP addresses of different instances in the public_cloud.conf file. The default value of CN/DN is local_bind_address ='IP address of the data.net NIC'.

The public_cloud.conf file contains the following NIC information: mgr.net (management NIC), data.net (data NIC), and virtual.net (virtual NIC).

port

Parameter description: Specifies the TCP port listened on by the GaussDB.

This parameter is specified in the configuration file during installation. Do not modify this parameter unless absolutely necessary. Otherwise, database communication will be affected.

Value range: an integer ranging from 1 to 65535

  • When setting the port number, ensure that the port number is not in use. When setting the port numbers of multiple instances, ensure that the port numbers do not conflict.
  • Ports 1 to 1023 are reserved for the operating system. Do not use them.
  • When the cluster is installed using the configuration file, pay attention to the ports reserved in the communication matrix in the configuration file. For example, dataPortBase + 1 needs to be reserved as the port used by internal tools, and dataPortBase + 6 needs to be reserved as the communication port of the streaming engine message queue. (Due to specification changes, the current version no longer supports the current feature. Do not use this feature.) Therefore, during cluster installation, the maximum value of port is 65532 for CNs, 65529 for DNs, and 65534 for GTMs. Ensure that the port number does not conflict with each other.

Default value: 5432 (The actual value is specified in the configuration file during installation.)

max_connections

Parameter description: Specifies the maximum number of concurrent connections to the database. This parameter influences the concurrent processing capability of the cluster.

This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Value range: an integer. The minimum value is 10 (greater than max_wal_senders). The theoretical maximum value is 262143. The actual maximum value is a dynamic value, which is calculated using the formula: 262143 – job_queue_processesautovacuum_max_workersmax_inner_tool_connectionsAUXILIARY_BACKENDSAV_LAUNCHER_PROCSmin(max(newValue/4,64),1024). The values of job_queue_processes, autovacuum_max_workers, and max_inner_tool_connections depend on the settings of the corresponding GUC parameters. AUXILIARY_BACKENDS indicates the number of reserved auxiliary threads, which is fixed to 20. AV_LAUNCHER_PROCS indicates the number of reserved autovacuum launcher threads, which is fixed to 2. In min(max(newValue/4,64),1024), newValue indicates the new value.

Default value:

  • Independent deployment:

    CN: 8000 (60-core CPU/480-GB memory); 4000 (32-core CPU/256-GB memory); 2000 (16-core CPU/128-GB memory); 1000 (8-core CPU/64-GB memory); 100 (4-core CPU/32-GB memory and 4-core CPU/16-GB memory)

    DN: 24000 (60-core CPU/480-GB memory); 12000 (32-core CPU/256-GB memory); 6000 (16-core CPU/128-GB memory); 2500 (8-core CPU/64-GB memory); 100 (4-core CPU/32-GB memory and 4-core CPU/16-GB memory)

  • Finance edition (standard):

    CN: 6000 (128-core CPU/1024-GB memory, 104-core CPU/1024-GB memory, and 96-core CPU/1024-GB memory); 4000 (96-core CPU/768-GB memory); 3500 (80-core CPU/640-GB memory); 3000 (72-core CPU/576-GB memory); 2500 (64-core CPU/512-GB memory); 2250 (60-core CPU/480-GB memory); 1000 (32-core CPU/256-GB memory); 500 (16-core CPU/128-GB memory); 200 (8-core CPU/64-GB memory)

    DN: 21000 (128-core CPU/1024-GB memory, 104-core CPU/1024-GB memory, and 96-core CPU/1024-GB memory); 16000 (96-core CPU/768-GB memory); 14000 (80-core CPU/640-GB memory); 12000 (72-core CPU/576-GB memory); 11000 (64-core CPU/512-GB memory); 9000 (60-core CPU/480-GB memory); 4000 (32-core CPU/256-GB memory); 2000 (16-core CPU/128-GB memory); 1000 (8-core CPU/64-GB memory)

  • Enterprise edition:

    CN: 4000 (128-core CPU/1024-GB memory, 104-core CPU/1024-GB memory, 96-core CPU/1024-GB memory); 3000 (96-core CPU/768-GB memory); 2500 (80-core CPU/640-GB memory); 2000 (80-core CPU/512-GB memory, 72-core CPU/576-GB memory, and 64-core CPU/512-GB memory); 1800 (60-core CPU/480-GB memory); 900 (32-core CPU/256-GB memory); 350 (16-core CPU/128-GB memory); 200 (8-core CPU/64-GB memory)

    DN: 15000 (128-core CPU/1024-GB memory, 104-core CPU/1024-GB memory, and 96-core CPU/1024-GB memory); 11000 (96-core CPU/768-GB memory); 10000 (80-core CPU/640-GB memory); 8500 (72-core CPU/576-GB memory); 7500 (80-core CPU/512-GB memory and 64-core CPU/512-GB memory); 7000 (60-core CPU/480-GB memory); 3500 (32-core CPU/256-GB memory); 1500 (16-core CPU/128-GB memory); 900 (8-core CPU/64-GB memory)

  • Finance edition (data computing):

    CN: 2500 (96-core CPU/768-GB memory); 1000 (72-core CPU/576-GB memory); 500 (64-core CPU/512-GB memory); 200 (32-core CPU/256-GB memory)

    DN: 8000 (96-core CPU/768-GB memory); 5000 (72-core CPU/576-GB memory); 4000 (64-core CPU/512-GB memory); 1000 (32-core CPU/256-GB memory)

Impact of incorrect configuration:

If the value of max_connections exceeds the maximum dynamic value, the node fails to be started and the following error message is displayed: "invalid value for parameter "max_connections"". Alternatively, the memory fails to be allocated during the node startup and the following error message is displayed: "Cannot allocate memory".

If the value of max_connections is not increased based on the external egress specifications and the memory parameter is not adjusted in proportion, when the service pressure is high, the memory may be insufficient, and the error message "memory is temporarily unavailable" is displayed.

In the hybrid deployment scenario, if the value of max_connections on the CN is greater than the value of max_connections divided by the number of CNs on the DN and the total pressure on the client exceeds the value of max_connections on the DN, the CN may fail to connect to the DN, and the error message "pooler... Too many clients already" is displayed.

  • If the number of connections of the administrator exceeds the value of max_connections, the administrator can still connect to the database after the connections are used up by common users. If the number of connections exceeds the value of sysadmin_reserved_connections, an error is reported. That is, the maximum number of connections of the administrator is equal to the value of max_connections + sysadmin_reserved_connections.
  • For common users, internal jobs use some connections. Therefore, the value of this parameter is slightly less than that of max_connections. The value depends on the number of internal connections.
  • After the thread pool is enabled, the maximum number of stream threads is the value of max_connections. If the number of stream threads reaches the upper limit, the error is reported: "Exceed stream thread pool limitation...". In this case, you can increase the value of max_connections to increase the upper limit. This parameter is a POSTMASTER parameter. Therefore, you can estimate the number of stream threads based on service requirements. Total number of stream threads = Number of concurrent services x Number of stream threads consumed by each concurrently executed statement (which can be viewed in the execution plan).

max_inner_tool_connections

Parameter description: Specifies the maximum number of concurrent connections of a tool which is allowed to connect to the database. This parameter influences the concurrent connection capability of the GaussDB tool.

This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Value range: an integer ranging from 1 to MIN (which takes the smaller value between 262143 and max_connections). For details about how to calculate the value of max_connections, see the preceding description.

Default value: 50 If the default value is greater than the maximum value supported by the kernel (determined when the gs_initdb command is executed), an error message is displayed.

Setting suggestions:

You are advised to use the default value for this parameter in the primary database node.

sysadmin_reserved_connections

Parameter description: Specifies the minimum number of connections reserved for administrators. You are advised not to set this parameter to a large value. This parameter is used together with the max_connections parameter. The maximum number of connections of the administrator is equal to the value of max_connections + sysadmin_reserved_connections.

This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Value range: an integer ranging from 0 to MIN (which takes the smaller value between 262143 and max_connections). For details about how to calculate the value of max_connections, see the preceding description.

Default value: 3

Note: When the thread pool function is enabled, if the thread pool is fully occupied, a processing bottleneck occurs. As a result, connections reserved by the administrator cannot be established. In this case, you can use gsql to establish connections through the primary port number + 1 to clear useless sessions.

unix_socket_directory

Parameter description: Specifies the Unix domain socket directory that the GaussDB server listens to for connections from the client. Only the sysadmin user can access this parameter.

This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

The parameter length limit varies by OS. In the Linux OS, the length of a socket path name (combination of a socket directory and a socket file name) cannot exceed 107 bytes, and the length of a directory cannot exceed 92 bytes. If the upper limit is exceeded, the error "Unix-domain socket path xxx is too long" will be reported and the process cannot be started properly. You can retrieve the system_call log in the cm_agent directory to locate configuration issues.

Value range: a string

Default value: empty. The actual value is specified by tmpMppdbPath in the configuration file during installation.

unix_socket_group

Parameter description: Specifies the group of the Unix domain socket (the user of a socket is the user that starts the server). This parameter can work with unix_socket_permissions to control socket access.

This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Value range: a string. If this parameter is set to an empty string, the default group of the current user is used.

Default value: an empty string

unix_socket_permissions

Parameter description: Specifies access permissions for the Unix domain socket.

The Unix domain socket uses the usual permission set of the Unix file system. The value of this parameter should be a number (acceptable for the chmod and umask commands). If a user-defined octal format is used, the number must start with 0.

You are advised to set it to 0770 (only allowing access from users connecting to the database and users in the same group as them) or 0700 (only allowing access from users connecting to the database).

This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Value range: 0000 to 0777

Default value: 0700

In the Linux OS, a document has one document attribute and nine permission attributes which consist of the read (r), write (w), and execute (x) permissions of the Owner, Group, and Others groups.

The r, w, and x permissions are represented by the following numbers:

r: 4

w: 2

x: 1

-: 0

The three attributes in a group are accumulative.

For example, -rwxrwx--- indicates the following permissions:

owner = rwx = 4+2+1 = 7

group = rwx = 4+2+1 = 7

others = --- = 0+0+0 = 0

The permission of the file is 0770.

application_name

Parameter description: Specifies the client name used in the current connection request.

This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.

When a standby node requests to replicate logs on the primary node, if this parameter is not an empty string, it is used as the name of the streaming replication slot of the standby node on the primary node. In this case, if the length of this parameter exceeds 61 bytes, only the first 61 bytes are used as the streaming replication slot name.

Value range: a string. The actual query result depends on the client used for queries or user configurations.

Default value: an empty string

connection_info

Parameter description: Specifies the database connection information, including the driver type, driver version, driver deployment path, and process owner.

This parameter is a USERSET parameter used for O&M. You are advised not to change the parameter value.

Value range: a string

Default value: empty

  • An empty string indicates that the driver connected to the database does not support automatic setting of the connection_info parameter or the parameter is not set by users in applications.
  • The following is an example of the concatenated value of connection_info:
    1
    {"driver_name":"ODBC","driver_version": "(GaussDB VxxxRxxxCxx build 290d125f) compiled at 2020-05-08 02:59:43 commit 2143 last mr 131 release","driver_path":"/usr/local/lib/psqlodbcw.so","os_user":"omm"}
    

    driver_name and driver_version are displayed by default. Whether driver_path and os_user are displayed is determined by users. For details, see Connecting to a Database and Configuring a Data Source in the Linux OS.

backend_version

Parameter description: Specifies the version number of the synchronous connection between CNs or between a CN and a DN. This parameter involves the version number and cannot be set randomly.

This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.

Value range: an integer ranging from 0 to 100000