Parameter Templates

As of version 1.3.0, the PolarDB-X Operator supports the functionality of parameter templates. When initializing an instance, you can specify a parameter template file to set a series of required template parameters for both CN (Compute Node) and DN (Data Node). The parameter templates must be configured via a yaml file. Note: The parameter template must be configured within the same namespace as the PolarDBXCluster.

kubectl apply -f {parameter template filename}.yaml --namespace={namespace where PolarDBXCluster is located}

Parameter Template Details

Note: In the parameter list, each parameter needs to specify seven different attributes, including:

  • name
    • The name of the parameter
  • defaultValue
    • The default value of the parameter, formatted as a string
  • mode
    • The mode of the parameter, including read-only and read-write
  • restart
    • Whether restarting the instance is required after modifying the parameter
  • unit
    • The unit of the parameter, including INT, DOUBLE, STRING, TZ (Time Zone), HOUR_RANGE
  • divisibilityFactor
    • For parameters with unit INT, a divisibility factor needs to be set; for other units, the default is 0
  • optional
    • For INT, DOUBLE, HOUR_RANGE units, the optional range is a range, e.g.: "[1000-60000]"
    • For STRING or TZ units, the optional range is a set of selectable options, e.g.: "[ON|OFF]"

Example of a parameter template is as follows:

## Example of a Parameter Template
kind: PolarDBXParameterTemplate
   name: parameterTemplate
         # Parameter list
            - name: CONN_POOL_BLOCK_TIMEOUT
              defaultValue: "5000"
              mode: read-write
              restart: false
              unit: INT
              divisibilityFactor: 1
              optional: "[1000-60000]"
            - ...
         name: dnTemplate
            - name: innodb_use_native_aio
              defaultValue: "OFF"
              mode: readonly
              restart: false
              unit: STRING
              divisibilityFactor: 0
              optional: "[ON|OFF]"
            - ...
      gms: ...

Viewing Parameter Templates

Instances by default apply the version 8.0 parameter template in the polardbx-operator-system namespace. If you wish to create an instance in another namespace, you need to create a parameter template object within the corresponding namespace. You can use the following command to view all configured parameter templates.

kubectl get PolarDBXParameterTemplate --namespace=polardbx-operator-system
# Or the abbreviation can be used
kubectl get pxpt --namespace=polardbx-operator-system

PolarDBXCluster Configuration

Once the parameter template is configured, you can specify the required parameter template in the yaml file when starting the PolarDBXCluster.

# Adding a parameter template
kind: PolarDBXCluster
   name: pxc
   # Parameter template to configure
      name: product


  • After the instance applies the parameter template, it will adjust the default parameters in the CN or DN based on the default values in the parameter template. Furthermore, parameters in the configmap under the my.cnf.overwrite field have a higher priority and will not be modified by the parameter template.
  • Currently, it is not supported to change the parameter template of an instance once it has been configured, nor is it supported to add a parameter template to a running instance. If you want to modify the parameters of a running instance, you must use the dynamic parameters functionality.

results matching ""

    No results matching ""