This topic describes how to use a parameter template to configure the parameters of ApsaraDB RDS for MySQL instances. ApsaraDB RDS for MySQL provides system parameter templates and custom parameter templates.

Prerequisites

The RDS instance runs one of the following MySQL versions:
  • MySQL 8.0
  • MySQL 5.7
  • MySQL 5.6

Background information

To ensure service availability, you can configure only some parameters in the ApsaraDB for RDS console. ApsaraDB RDS for MySQL provides various system parameter templates. You can also create custom parameter templates to meet specific business requirements such as the requirements for high performance.
Note For more information about how to configure a single parameter, see Configure the parameters of an ApsaraDB RDS for MySQL instance.

Introduction to system templates

Note ApsaraDB RDS for MySQL provides system templates only for RDS instances that run RDS High-availability Edition or RDS Basic Edition. You can create custom parameter templates for RDS instances that run RDS Enterprise Edition. For more information, see Create a custom parameter template.

ApsaraDB RDS for MySQL provides the following system parameter templates for RDS instances that run RDS High-availability Edition or RDS Basic Edition:

  • Default parameter template

    This parameter template provides the highest data security but requires a longer period of time to take effect. If you use this parameter template, data is replicated in semi-synchronous mode. The following parameter settings are fixed in this parameter template to ensure data security:

    • InnoDB
      • innodb_flush_log_at_trx_commit = 1
      • sync_binlog = 1
    • X-Engine (Only the default parameter template is provided.)

      sync_binlog = 1

  • Asynchronous parameter template (phased-out)
    Note For more information about how to change the data replication mode to asynchronous, see Change the data replication mode of an ApsaraDB RDS for MySQL instance.
  • High-performance parameter template

    This parameter template provides average data security but can take effect within the shortest period of time. If you select this parameter template, data is replicated in asynchronous mode. The following parameters settings are fixed in this parameter template to ensure data security:

    • innodb_flush_log_at_trx_commit = 2
    • sync_binlog = 1000
Note You cannot use a custom parameter template to change the values of the parameters that are included in the system parameter templates.

The following table describes the parameters in the system parameter templates.

Parameter Value Description
innodb_flush_log_at_trx_commit 1 When you commit a transaction, the system writes the transaction log record from the buffer to the binary log file and immediately synchronizes the binary log file to the disk.
2 When you commit a transaction, the system writes the transaction log record from the buffer to the binary log file but does not immediately synchronize the binary log file to the disk. The binary log file is written to the disk once every second. If the system stops responding before a write operation is performed, the log records that are generated over the most recent second are lost.
sync_binlog 1 When you commit a transaction, the binary log file is written to the disk and the disk is immediately refreshed. The binary log file is not written to the buffer.
1000 The log records in the buffer are written to the disk and the disk is refreshed once every time when 1,000 log records are submitted to the buffer. This may result in data loss.

Apply a parameter template

  1. Log on to the ApsaraDB RDS console. In the left-side navigation pane, click Instances. In the top navigation bar, select the region where the RDS instance resides.
  2. In the left-side navigation pane, click Parameter Templates.
  3. On the Custom Parameter Templates or System Parameter Templates tab, find the parameter template that you want to apply.
  4. Click Apply to Instance in the Actions column.
  5. In the All Instances section of the dialog box that appears, select the RDS instances to which you want to apply the parameter template, click the icon to move the selected RDS instances to the Selected Instances section, and then view the changes to the parameter settings in the Parameter Comparison section.
    Note Before you apply a parameter template to multiple RDS instances, you must verify that the parameter settings are suitable for all the RDS instances.
  6. Click OK.

Create a custom parameter template

  1. Log on to the ApsaraDB RDS console. In the left-side navigation pane, click Instances. In the top navigation bar, select the region where the RDS instance resides.
  2. In the left-side navigation pane, click Parameter Templates. In the upper-right corner of the page, click Create Parameter Template.
  3. Configure the following parameters.
    Parameter Description
    Template Name Enter the name of the parameter template. The name must be 8 to 64 characters in length and can contain letters, digits, periods (.), and underscores (_). The name must start with a letter.
    Database Engine Select the database engine that is run by the RDS instance. Set the value to MySQL.
    Engine Version Select the version of the database engine that is run by the RDS instance. The supported database engine versions are MySQL 5.6, MySQL 5.7, and MySQL 8.0.
    Description Enter a description for the parameter template. The description can be up to 200 characters in length.
    Add Parameter Click Add Parameter and select a parameter from the Parameter drop-down list. Then, you can set the parameter. You can also view the value range and default value of the parameter.
    Note
    • For more information about the available parameters, see Editable Parameters on the Parameters page.
    • If you want to add another parameter, you must click Add Parameter again.
    • To remove a parameter, you must click Delete to the right of the parameter.
    Import After you export a parameter template to your computer, you can edit the parameter template based on your business requirements. Then, you can click Import to copy the parameter settings from the parameter template to the RDS instance. For more information about how to export a parameter template, see Configure the parameters of an ApsaraDB RDS for MySQL instance.
  4. Click OK.

Clone a parameter template

You can clone a parameter template from one region to another region.

  1. Log on to the ApsaraDB RDS console. In the left-side navigation pane, click Instances. In the top navigation bar, select the region where the RDS instance resides.
  2. In the left-side navigation pane, click Parameter Templates.
  3. Find the parameter template that you want to clone. Then, click Clone in the Actions column.
  4. Configure the following parameters.
    Parameter Description
    Region Specify the destination region to which you want to clone the parameter template.
    Template Name Enter the name of the parameter template. The name must be 8 to 64 characters in length and can contain letters, digits, periods (.), and underscores (_). The name must start with a letter.
    Description Enter a description for the parameter template. The description can be up to 200 characters in length.
  5. Click OK.

Manage parameter templates

  1. Log on to the ApsaraDB RDS console. In the left-side navigation pane, click Instances. In the top navigation bar, select the region where the RDS instance resides.
  2. In the left-side navigation pane, click Parameter Templates.
  3. Manage the parameter templates in this region.
    Note You can perform only the View and Apply to Instance operations on system templates.
    To view a parameter template, perform the following operations:

    Find the parameter template that you want to view. Then, click View in the Actions column. On the page that appears, view the basic information and parameters of the parameter template.

    To modify a parameter template, perform the following operations:
    1. Find the parameter template that you want to modify. Then, click Edit in the Actions column. For more information, see Step 3 in the "Create a custom parameter template" section of this topic.
    2. Click Confirm.
    To delete a parameter template, perform the following operations

    Find the parameter template that you want to delete. Then, click Delete in the Actions column. In the message that appears, click OK.

    Note When you delete a parameter template, the RDS instances to which the parameter template is applied are not affected.

Related operations

Operation Description
Create a parameter template Creates a parameter template.
Modify a parameter template Modifies a parameter template.
Copy a parameter template Clones a parameter template from one region to another region.
Query parameter templates Queries the parameter templates that are available in a region.
Query information of a parameter template Queries the details about a parameter template.
Delete a parameter template Deletes a parameter template from a region.