gpconfig

1 Description

The gpconfig tool allows users to set, restore, or view configuration parameters in the postgresql.conf file of all node instances in the YMatrix cluster (Master, Data Node, and Mirror). When setting parameters, you can also specify a different value for Master if needed. For example, the max_connections parameter requires that the setting of Master is different from that of Segment. If you want to set or restore global parameters or only parameters that can be set for Master, use the --masteronly option.

Not all parameters can be configured using gpconfig. For example, users cannot use it to set the port parameter, which is different for each Segment instance. The -l option can view the complete list of configuration parameters supported by gpconfig.

After setting configuration parameters using gpconfig, the parameter value appears at the bottom of the postgresql.conf file. When using gpconfig to remove configuration parameters, the configuration parameters are commented out in the postgresql.conf file, thus restoring the default settings. If you use gpconfig to delete a parameter and add it back later (set a new value), then there will be two instances of the parameter, one commented out and the other enabled and added to the bottom of the postgresql.conf file.

After setting parameters, the user may need to restart the cluster, or reload the postgresql.conf file for the changes to take effect. Whether a restart is required depends on the parameters being set.

To display the setting values ​​for the current parameters in the system, use the -s option.

If you receive the following error when modifying parameters using gpconfig:

GUC Validation Failed: mars3.degrade_min_run_size cannot be changed under normal conditions. Please refer to gpconfig documentation.

This means that this parameter is protected and requires adding the --skipvalidation parameter to make the modification take effect, for example:

gpconfig -c optimizer_force_multistage_agg -v false --skipvalidation

gpconfig uses the following environment variables to connect to the Master instance of the YMatrix cluster and get system configuration information:

  • PGHOST
  • PGPORT
  • PGUSER
  • PGPASSWORD
  • PGDATABASE

2. Parameter options

Parameter name Description
-c param_name or --change param_name Change configuration parameters settings by adding new settings at the bottom of the postgresql.conf file
-v value or --value value value is used for the value of the configuration parameter specified by the -c option. By default, this value applies to all Segments and their Mirror, Master, and Standby.
Arguments that are not single characters or numbers must be wrapped in single quotes ('). For example, a string that includes spaces or special characters. If you want to embed single quotes into a string parameter, you need to transfer it with 2 single quotes or backslashes ('' or \')
-m master_value or --mastervalue master_value is used to set the configuration of the Master and Standby nodes separately to make it different from the configuration of the Segment node when setting parameters
--masteronly When specified, gpconfig will edit only the postgresql.conf file of Master
-r param_name or --remove param_name Remove configuration parameters by commenting out configuration items in postgresql.conf file
-l or --list List all configuration parameters modified by gpconfig tools available
-s param_name or --show param_name Displays the configuration parameter values ​​used on all instances (Master and Segment) in the YMatrix cluster. The displayed value is the current value of the cluster. If the modification has not been restarted, the old value is still seen
--file Displays the values ​​in the postgresql.conf configuration file for all instances (Master and Segment) in the YMatrix cluster. Values ​​in the configuration file may not take effect because the cluster has not been restarted
Cannot be used with the --file-compare option
--file-compare For configuration parameters, compare the effective values ​​in the current YMatrix cluster (Master and Segment) with the values ​​in the configuration file postgresql.conf.
If the values ​​are different, the values ​​from all hosts are displayed; if the values ​​are the same, the summary report is displayed.
Not used with the --file option
--skipvalidation Skip validity checks when setting parameters
Be extra careful when setting configuration parameters with this option
--verbose Show additional log information during command execution
--debug Set log output level to debug level
? or -h or --help Show help information

3. Example

View shared_buffers configuration information:

gpconfig -s shared_buffers

Set gp_resource_manager to queue:

gpconfig -c gp_resource_manager -v queue

Set the Segment node max_connections value to 180 and the Master node value to 60

gpconfig -c max_connections -v 180 -m 60