This topic describes how to use a parameter template to configure the parameters of multiple ApsaraDB RDS for MySQL instances at a time. ApsaraDB RDS for MySQL provides system parameter templates and custom parameter templates.
Prerequisites
The RDS instance runs one of the following database engine versions:
MySQL 8.0 (including serverless RDS instances)
MySQL 5.7
MySQL 5.6
Background information
To ensure service availability, you can configure only some parameters in the ApsaraDB 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.
For more information about how to configure a single parameter, see Modify instance parameters.
Introduction to system parameter templates
System parameter templates are provided only for RDS instances that run RDS High-availability Edition and RDS Basic Edition. If your RDS instance runs RDS Enterprise Edition, you can create a custom parameter template for the instance. For more information, see Create a custom parameter template.
The following system parameter templates are provided for RDS instances that run RDS High-availability Edition and RDS Basic Edition:
Default parameter template
This parameter template provides the highest data security but delivers relatively slow read and write performance. 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
NoteWhen you create an RDS instance, the default parameter template that matches the specified database engine version and RDS edition is selected by default. You can perform the following operations to view the parameter settings of the default parameter template: Log on to the ApsaraDB RDS console. In the left-side navigation pane, click Parameter Templates. On the page that appears, click the System Parameter Templates tab and search for the default parameter template to view all parameter settings in the default parameter template.
You cannot modify the default parameter template.
Asynchronous parameter template
This parameter template ensures high data security and fast speed. If you use this parameter template, data is replicated in asynchronous mode. The following parameter settings are fixed in this parameter template to ensure data security:
innodb_flush_log_at_trx_commit = 1
sync_binlog=1
rpl_semi_sync_master_enabled=off
NoteFor more information about how to change the data replication mode to asynchronous, see Query and change the data replication mode.
High-performance parameter template
This parameter template provides average data security but delivers the fastest read and write performance. If you use this parameter template, data is replicated in asynchronous mode. The following parameter settings are fixed in this parameter template to ensure data security:
innodb_flush_log_at_trx_commit = 2
sync_binlog = 1000
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 log file and immediately synchronizes the log file to the disk. |
2 | When you commit a transaction, the system writes the transaction log record from the buffer to the log file but does not immediately synchronize the log file to the disk. The 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
Log on to the ApsaraDB RDS console. In the left-side navigation pane, click Parameter Templates. In the top navigation bar, select the region in which the RDS instance resides.
On the Custom Parameter Templates or System Parameter Templates tab, find the parameter template that you want to apply and choose > Apply to Instance in the Actions column.
In the All Instances section of the panel 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.
ImportantBefore you apply a parameter template to multiple RDS instances, you must verify that the parameter settings are suitable for all the RDS instances. Proceed with caution.
Click OK.
Create a custom parameter template
- Log on to the ApsaraDB RDS console. In the left-side navigation pane, click Instances. In the top navigation bar, select the region in which your RDS instance resides.
In the left-side navigation pane, click Parameter Templates. On the Parameter Templates page, click Create Parameter Template.
Configure the following parameters.
Parameter
Description
Template Name
Enter a name for 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. Valid values: 5.6, 5.7, and 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 configure the parameter. You can also view the value range and default value of the parameter.
NoteTo view the parameters that can be added or modified, perform the following operations: Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Click the ID of the RDS instance. In the left-side navigation pane, click Parameters. On the Editable Parameters tab, view the parameters that can be added or modified.
If you want to add another parameter, you must click Add Parameter again.
To delete 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 Modify instance parameters.
Click OK.
Clone a parameter template
If you want to clone a custom parameter template from the current region to another region or you want to modify the parameter settings of a custom parameter template, you can use the parameter template cloning feature.
System parameter templates cannot be cloned.
- Log on to the ApsaraDB RDS console. In the left-side navigation pane, click Instances. In the top navigation bar, select the region in which your RDS instance resides.
In the left-side navigation pane, click Parameter Templates.
Find the parameter template that you want to clone, click the icon, and then select Clone in the Actions column.
Configure the following parameters.
Parameter
Description
Region
Specify the destination region to which you want to clone the parameter template.
Template Name
Enter a name for 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.
Operation
Enter a description for the parameter template. The description can be up to 200 characters in length.
Click OK.
Manage parameter templates
- Log on to the ApsaraDB RDS console. In the left-side navigation pane, click Instances. In the top navigation bar, select the region in which your RDS instance resides.
In the left-side navigation pane, click Parameter Templates.
Manage parameter templates in this region.
NoteYou can perform the View and Apply to Instance operations on system templates.
View a parameter template.
Find the parameter template that you want to view and click View in the Actions column to view the basic information and parameter settings of the parameter template.
Modify a parameter template.
ImportantIf you modify a custom parameter template, you must re-apply the custom parameter template to your RDS instance for the modification to take effect.
After the custom parameter template is re-applied to your RDS instance, your RDS instance may be restarted. If you modify the parameters for which instance restart is required for the modifications to take effect, you must restart your RDS instance.
Find the parameter template that you want to modify, click the icon, and then select Modify in the Actions column. Alternatively, click Edit Parameter Template in the panel that appears after you click View in the Actions column of the parameter template. For more information, see Parameter description.
Click OK.
Delete a parameter template.
NoteWhen you delete a parameter template, the RDS instances to which the parameter template is applied are not affected.
Find the parameter template that you want to delete, click the icon, and then select Delete in the Actions column. In the message that appears, click OK.
Related operations
Operation | Description |
Creates a parameter template. | |
Modifies a parameter template. | |
Clones a parameter template from one region to another region. | |
Queries the parameter templates that are available in a region. | |
Queries the details about a parameter template. | |
Deletes a parameter template from a region. |
FAQ
How do I reset the parameter values in a custom parameter template to their default values?
Find the parameter that you want to modify in the custom parameter template and change the user-defined value to the default value. For more information, see Modify a parameter template.
Re-apply the custom parameter template to your RDS instance. For more information, see Apply a parameter template.