gpconfig

1. Description

The gpconfig utility allows users to set, reset, or view configuration parameters in the postgresql.conf files of all instances (Master, Segments, and mirrors) in a MatrixDB cluster. When setting a parameter, you can optionally specify a different value for the Master. For example, the max_connections parameter typically requires a different setting on the Master than on Segments. Use the --masteronly option to set or reset global parameters or parameters that apply only to the Master.

Not all parameters can be configured using gpconfig. For instance, you cannot use it to set the port parameter, which varies across Segment instances. Use the --list option to display the complete list of configuration parameters supported by gpconfig.

When a parameter is set using gpconfig, the value is added to the bottom of the postgresql.conf file. When a parameter is removed with gpconfig, it is commented out in the postgresql.conf file, restoring the default value. If you remove a parameter and later re-add it (with a new value), two entries will exist: one commented out and one active at the end of the file.

After setting a parameter, you may need to restart the cluster or reload the postgresql.conf file for changes to take effect. Whether a restart is required depends on the specific parameter.

To display the current effective values of parameters in the system, use the --show option.

gpconfig uses the following environment variables to connect to the MatrixDB Master instance and retrieve system configuration:

  • PGHOST
  • PGPORT
  • PGUSER
  • PGPASSWORD
  • PGDATABASE

2. Options

Option Description
-c param_name or --change param_name Changes a configuration parameter by adding a new entry at the bottom of the postgresql.conf file.
-v value or --value value Specifies the value for the configuration parameter given by the -c option. By default, this value applies to all Segments and their mirrors, the Master, and the Standby.
Parameter values that are not single characters or digits must be enclosed in single quotes (''). For example, strings containing spaces or special characters. To include a single quote within a string, escape it with two single quotes or a backslash ('' or \').
-m master_value or --mastervalue master_value Sets a separate value for the Master and Standby when configuring a parameter, allowing it to differ from the Segment value.
--masteronly When specified, gpconfig modifies only the Master's postgresql.conf file.
-r param_name or --remove param_name Removes a configuration parameter by commenting it out in the postgresql.conf file.
-l or --list Lists all configuration parameters that can be modified using gpconfig.
-s param_name or --show param_name Displays the current value of the specified configuration parameter across all instances (Master and Segments) in the MatrixDB cluster. The displayed value reflects the currently running configuration; if changes have not been applied due to lack of restart, the old value will still appear.
--file Displays the value of the configuration parameter as written in the postgresql.conf file on each instance (Master and Segments). These values may not yet be active if the cluster has not been restarted.
Cannot be used with the --file-compare option.
--file-compare Compares the currently active value of the configuration parameter in the running MatrixDB cluster (Master and Segments) with the value in the postgresql.conf file.
If values differ, displays values from all hosts; if they match, shows a summary report.
Cannot be used with the --file option.
--skipvalidation Skips validation checks when setting a parameter.
Use this option with caution.
--verbose Displays additional log information during command execution.
--debug Sets the logging level to debug.
? or -h or --help Displays help information.

3. Examples

View the setting of shared_buffers:

gpconfig -s shared_buffers

Set gp_resource_manager to queue:

gpconfig -c gp_resource_manager -v queue

Set max_connections to 180 on Segments and 60 on the Master:

gpconfig -c max_connections -v 180 -m 60