When you configure multiple clusters that contain one or more parameters with the same settings, you can use parameter templates to manage and quickly apply parameters to clusters. This improves the efficiency of parameter management and cluster configuration.

Prerequisites

The following versions of clusters are supported:
  • MySQL 8.0
  • MySQL 5.7
  • MySQL 5.6

Create a parameter template

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster resides.
  3. In the left-side navigation pane, click Parameter Templates.
  4. On the Parameter Templates page, click Create Parameter Template.
  5. On the page that appears, specify the following parameters.
    Parameter Description
    Template Name The name of the template. The name must meet the following requirements:
    • It can contain letters, digits, and underscores (_). It must start with a letter and cannot contain Chinese characters.
    • It must be 8 to 64 characters in length.
    Database Engine The type of database engine. Only MySQL is supported.
    Version The version of the database engine. Valid values:
    • 8.0
    • 5.7
    • 5.6
    Description The description of the parameter template. It must be 0 to 200 characters in length.
    Add Parameter After you click Add Parameter, the system adds a parameter in the list. You can specify Template Name and set Current Value based on Description and Valid Value. You can also view the information about whether a restart is required and the default parameter value on the page.
    Note
    • To add another parameter, click Add Parameter again.
    • To remove a parameter, click Delete on the right of the parameter.
    Import Parameter Click Import Parameter and enter parameters and values. The parameters and values must be in the key=value format. Separate multiple key-value pairs with line feeds. Example:
    wait_timeout=60
    thread_stack=262144
  6. Click OK.

Apply a parameter template

Note
  • If a restart is required, we recommend that you apply the parameter template during off-peak hours and make sure that your application is configured to automatically reconnect to the cluster.
  • After a parameter template is created, you can apply the parameter template to the cluster by using the following methods:
    • You can apply a parameter template on the related page of a cluster. For more information, see Specify cluster parameters.
    • You can also perform the following steps to apply a parameter template to the cluster.
  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster resides.
  3. In the left-side navigation pane, click Parameter Templates.
  4. On the Parameter Templates page, click the Custom Parameter Templates tab.
  5. In the parameter template list, click Apply to Instance in the Actions column of the parameter template.
  6. On the Apply to Instance page, select the clusters to which you want to apply the parameter template and click Move to to move them to the right. You can view the difference between the parameter values in the template and the parameter values in the cluster in the Parameter Comparison section.
    Note When you apply a parameter template to multiple clusters, take note of the following information:
    • Check whether the parameters are applicable to these clusters. Proceed with caution.
    • A parameter template can be applied to up to 10 clusters at a time. To apply a parameter template to more than 10 clusters, you can apply it in batches.
    • The parameter template must be in the same region as the cluster to which the template is applied. If no parameter template is available in the region where the cluster is deployed, create one first.
    Apply a parameter template
  7. Click OK.

Copy a parameter template

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster resides.
  3. In the left-side navigation pane, click Parameter Templates.
  4. On the Parameter Templates page, click the Custom Parameter Templates tab.
  5. In the parameter template list, click Clone in the Actions column of the parameter template.
  6. On the page that appears, specify the following parameters.
    Parameter Description
    Template Name The name of the template. By default, the name is the name of the original template_clone. You can rename the template. The name must meet the following requirements:
    • It can contain letters, digits, and underscores (_). It must start with a letter and cannot contain Chinese characters.
    • It must be 8 to 64 characters in length.
    Database Engine The type of database engine. Only MySQL is supported.
    Version MySQL 5.6, 5.7, and 8.0 are supported. The default version is the version of the original template. You can specify the version based on your business requirements.
    Description The description of the parameter template. It must be 0 to 200 characters in length.
    Add Parameter By default, the values of parameters are the same as the parameters in the original template. You can modify the values based on your business requirements.
    Note
    • To add a parameter, click Add Parameter.
    • To modify the value of a parameter, enter the value in the Current Value field on the right of the parameter.
    • To remove a parameter, click Delete on the right of the parameter.
    Import Parameter Click Import Parameter and enter parameters and values. The parameters and values must be in the key=value format. Separate multiple key-value pairs with line feeds. Example:
    wait_timeout=60
    thread_stack=262144
  7. Click OK.

Delete a parameter template

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster resides.
  3. In the left-side navigation pane, click Parameter Templates.
  4. On the Parameter Templates page, click the Custom Parameter Templates tab.
  5. In the parameter template list, click Delete in the Actions column of the parameter template.
  6. Click OK.
Note To delete multiple parameter templates at a time, select the parameter templates and click Delete at the bottom of the list.

View differences in parameter templates

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster resides.
  3. In the left-side navigation pane, click Parameter Templates.
  4. On the Parameter Templates page, click the Custom Parameter Templates tab.
  5. In the custom parameter template list, select the parameter templates and click Compare.
  6. On the Compare page, view the differences of parameters in different parameter templates.

Related API operations

API Description
CreateParameterGroup Creates a parameter template.
DescribeParameterGroups Queries parameter templates.
DescribeParameterGroup Queries the details of a parameter template.
ModifyDBClusterParameters Modifies or applies a parameter template.
DeleteParameterGroup Deletes a parameter template.