Updating MySQL® cluster settings
After creating a cluster, you can:
-
Warning
You cannot change MySQL® settings using SQL commands.
-
Move a cluster to another folder.
Learn more about other cluster updates:
Changing the host class
The choice of a host class in Managed Service for MySQL® clusters is limited by the CPU and RAM quotas available to DB clusters in your cloud. To check the resources in use, open the Quotas
Note
Some MySQL® settings depend on the selected host class.
When changing the host class:
- Your single-host cluster will be unavailable for a few minutes with database connections terminated.
- Your multi-host cluster will get a new master host. Its hosts will be stopped and updated one by one. Once stopped, a host will be unavailable for a few minutes.
- Using a special FQDN does not guarantee a stable database connection: user sessions may be terminated.
We recommend changing the host class only when the cluster has no active workload.
- Go to the folder page
and select Managed Service for MySQL. - Select the cluster and click Edit in the top panel.
- To change the class of MySQL® hosts, under Host class, select the required class.
- Click Save changes.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To change the host class for the cluster:
-
View a description of the update cluster CLI command:
yc managed-mysql cluster update --help
-
Request a list of available host classes (the
ZONE IDS
column specifies the availability zones where you can select the appropriate class):yc managed-mysql resource-preset list
Result:
+-----------+--------------------------------+-------+----------+ | ID | ZONE IDS | CORES | MEMORY | +-----------+--------------------------------+-------+----------+ | s1.micro | ru-central1-a, ru-central1-b, | 2 | 8.0 GB | | | ru-central1-d | | | | ... | +-----------+--------------------------------+-------+----------+
-
Specify the class in the update cluster command:
yc managed-mysql cluster update <cluster_name_or_ID> --resource-preset <class_ID>
Managed Service for MySQL® will run the update host class command for the cluster.
-
Open the current Terraform configuration file with an infrastructure plan.
For more information about how to create this file, see Creating clusters.
-
In the Managed Service for MySQL® cluster description, change the
resource_preset_id
parameter value underresources
:resource "yandex_mdb_mysql_cluster" "<cluster_name>" { ... resources { resource_preset_id = "<host_class>" ... } }
-
Make sure the settings are correct.
-
Using the command line, navigate to the folder that contains the up-to-date Terraform configuration files with an infrastructure plan.
-
Run the command:
terraform validate
If there are errors in the configuration files, Terraform will point to them.
-
-
Confirm updating the resources.
-
Run the command to view planned changes:
terraform plan
If the resource configuration descriptions are correct, the terminal will display a list of the resources to modify and their parameters. This is a test step. No resources are updated.
-
If you are happy with the planned changes, apply them:
-
Run the command:
terraform apply
-
Confirm the update of resources.
-
Wait for the operation to complete.
-
-
For more information, see the Terraform provider documentation
Time limits
A Terraform provider sets the timeout for Managed Service for MySQL® cluster operations:
- Creating a cluster, including by restoring one from a backup: 15 minutes.
- Editing a cluster, including the MySQL® version update: 60 minutes.
- Deleting a cluster: 15 minutes.
Operations exceeding the set timeout are interrupted.
How do I change these limits?
Add the timeouts
block to the cluster description, for example:
resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
...
timeouts {
create = "1h30m" # 1 hour 30 minutes
update = "2h" # 2 hours
delete = "30m" # 30 minutes
}
}
To change the host class, use the update REST API method for the Cluster resource or the ClusterService/Update gRPC API call and provide the following in the request:
- Cluster ID in the
clusterId
parameter. To find out the cluster ID, get a list of clusters in the folder. - Host class you need in the
configSpec.resources.resourcePresetId
parameter. To request a list of supported values, use the list method for theResourcePreset
resources. - List of settings to update (in this case,
configSpec.resources.resourcePresetId
) in theupdateMask
parameter.
Warning
This API method overrides all parameters of the object being modified that were not explicitly passed in the request to the default values. To avoid this, list the settings you want to change in the updateMask
parameter (one line separated by commas).
Increasing storage size
Make sure the cloud has enough quota to increase the storage size. Open the cloud's Quotas
To increase the cluster storage size:
- Go to the folder page
and select Managed Service for MySQL. - Select the cluster and click Edit in the top panel.
- Under Size of storage, specify the required value.
- Click Save changes.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To increase the cluster storage size:
-
View a description of the update cluster CLI command:
yc managed-mysql cluster update --help
-
Specify the required storage in the cluster update command (it must be at least as large as
disk_size
in the cluster properties):yc managed-mysql cluster update <cluster_name_or_ID> \ --disk-size <storage_size_GB>
To increase the cluster storage size:
-
Open the current Terraform configuration file with an infrastructure plan.
For more information about how to create this file, see Creating clusters.
-
Change the
disk_size
parameter value underresources
:resource "yandex_mdb_mysql_cluster" "<cluster_name>" { ... resources { disk_size = <storage_size_GB> ... } }
-
Make sure the settings are correct.
-
Using the command line, navigate to the folder that contains the up-to-date Terraform configuration files with an infrastructure plan.
-
Run the command:
terraform validate
If there are errors in the configuration files, Terraform will point to them.
-
-
Confirm updating the resources.
-
Run the command to view planned changes:
terraform plan
If the resource configuration descriptions are correct, the terminal will display a list of the resources to modify and their parameters. This is a test step. No resources are updated.
-
If you are happy with the planned changes, apply them:
-
Run the command:
terraform apply
-
Confirm the update of resources.
-
Wait for the operation to complete.
-
-
For more information, see the Terraform provider documentation
Time limits
A Terraform provider sets the timeout for Managed Service for MySQL® cluster operations:
- Creating a cluster, including by restoring one from a backup: 15 minutes.
- Editing a cluster, including the MySQL® version update: 60 minutes.
- Deleting a cluster: 15 minutes.
Operations exceeding the set timeout are interrupted.
How do I change these limits?
Add the timeouts
block to the cluster description, for example:
resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
...
timeouts {
create = "1h30m" # 1 hour 30 minutes
update = "2h" # 2 hours
delete = "30m" # 30 minutes
}
}
To increase the cluster storage size, use the update REST API method for the Cluster resource or the ClusterService/Update gRPC API call and provide the following in the request:
- Cluster ID in the
clusterId
parameter. To find out the cluster ID, get a list of clusters in the folder. - Storage size in the
configSpec.resources.diskSize
parameter. - List of cluster configuration fields to update in the
updateMask
parameter (in this case,configSpec.resources.diskSize
).
Warning
This API method overrides all parameters of the object being modified that were not explicitly passed in the request to the default values. To avoid this, list the settings you want to change in the updateMask
parameter (one line separated by commas).
Changing MySQL® settings
Note
Some MySQL® settings depend on the selected host class.
- Go to the folder page
and select Managed Service for MySQL. - Select the cluster and click Edit in the top panel.
- Configure the MySQL® settings by clicking Settings under DBMS settings.
- Click Save.
- Click Save changes.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To update the MySQL® settings:
-
View a description of the update cluster configuration CLI command:
yc managed-mysql cluster update-config --help
-
Set the required parameter values.
All supported parameters are listed in the request format for the update method, in the
mysql_config_5_7
field. To specify the parameter name in the CLI's call, convert the name fromlowerCamelCase
tosnake_case
. For example, thelogMinDurationStatement
parameter from an API request should be converted tolog_min_duration_statement
for the CLI command:yc managed-mysql cluster update-config <cluster_name> --set log_min_duration_statement=100,<parameter_name>=<value>,...
Managed Service for MySQL® runs the update cluster settings operation.
-
Open the current Terraform configuration file with an infrastructure plan.
For more information about how to create this file, see Creating clusters.
-
In the Managed Service for MySQL® cluster description, add or update the DBMS settings under
mysql_config
:resource "yandex_mdb_mysql_cluster" "<cluster_name>" { ... mysql_config = { <MySQL®_setting_name> = <value> ... } }
-
Make sure the settings are correct.
-
Using the command line, navigate to the folder that contains the up-to-date Terraform configuration files with an infrastructure plan.
-
Run the command:
terraform validate
If there are errors in the configuration files, Terraform will point to them.
-
-
Confirm updating the resources.
-
Run the command to view planned changes:
terraform plan
If the resource configuration descriptions are correct, the terminal will display a list of the resources to modify and their parameters. This is a test step. No resources are updated.
-
If you are happy with the planned changes, apply them:
-
Run the command:
terraform apply
-
Confirm the update of resources.
-
Wait for the operation to complete.
-
-
For more information, see the Terraform provider documentation
Time limits
A Terraform provider sets the timeout for Managed Service for MySQL® cluster operations:
- Creating a cluster, including by restoring one from a backup: 15 minutes.
- Editing a cluster, including the MySQL® version update: 60 minutes.
- Deleting a cluster: 15 minutes.
Operations exceeding the set timeout are interrupted.
How do I change these limits?
Add the timeouts
block to the cluster description, for example:
resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
...
timeouts {
create = "1h30m" # 1 hour 30 minutes
update = "2h" # 2 hours
delete = "30m" # 30 minutes
}
}
To change MySQL® settings, use the update REST API method for the Cluster resource or the ClusterService/Update gRPC API call and provide the following in the request:
- Cluster ID in the
clusterId
parameter. To find out the cluster ID, get a list of clusters in the folder. - Array with new MySQL® settings in the following parameter:
configSpec.mysqlConfig_5_7.sqlMode
for MySQL® 5.7.configSpec.mysqlConfig_8_0.sqlMode
for MySQL® 8.0.
- List of cluster configuration fields to update in the
UpdateMask
parameter.
Warning
This API method overrides all parameters of the object being modified that were not explicitly passed in the request to the default values. To avoid this, list the settings you want to change in the updateMask
parameter (one line separated by commas).
For more information on how to update the MySQL® settings, see FAQ.
Changing additional cluster settings
-
Go to the folder page
and select Managed Service for MySQL. -
Select the cluster and click Edit in the top panel.
-
Change additional cluster settings:
-
Backup start time (UTC): Time interval during which the cluster backup starts. Time is specified in 24-hour UTC format. The default time is
22:00 - 23:00
UTC. -
Retention period for automatic backups, days
Automatic backups are stored for the specified number of days.
-
Maintenance window: Maintenance window settings:
- To enable maintenance at any time, select arbitrary (default).
- To specify the preferred maintenance start time, select by schedule and specify the desired day of the week and UTC hour. For example, you can choose a time when the cluster is least loaded.
Maintenance operations are carried out both on enabled and disabled clusters. They may include updating the DBMS, applying patches, and so on.
-
DataLens access: Enables you to analyze cluster data in Yandex DataLens.
For more information about setting up a connection, see Connecting to DataLens.
-
WebSQL access: Enables you to run SQL queries against cluster databases from the Yandex Cloud management console using Yandex WebSQL.
-
Statistics sampling: Enable this option to use the Performance diagnostics tool in the cluster.
-
Deletion protection: Manages protection of the cluster, its databases, and users against accidental deletion.
Enabled deletion protection will not prevent a manual connection with the purpose to delete database contents.
-
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To change additional cluster settings:
-
View a description of the update cluster CLI command:
yc managed-mysql cluster update --help
-
Run the following command with a list of settings to update:
yc managed-mysql cluster update <cluster_name_or_ID> \ --backup-window-start <backup_start_time> \ --backup-retain-period-days=<backup_retention_period> \ --datalens-access=<true_or_false> \ --websql-access=<true_or_false> \ --maintenance-window type=<maintenance_type>,` `day=<day_of_week>,` `hour=<hour> \ --deletion-protection=<deletion_protection> \ --performance-diagnostics enabled=true,` `sessions-sampling-interval=<session_sampling_interval>,` `statements-sampling-interval=<statement_sampling_interval>
You can change the following settings:
--backup-window-start
: The cluster backup start time, set in UTC formatHH:MM:SS
. If the time is not set, the backup will start at 22:00 UTC.
-
--backup-retain-period-days
: Retention period for automatic backups (in days). Acceptable values are from7
to60
. The default value is7
. -
--datalens-access
: Enables access from DataLens. The default value isfalse
. For more information about setting up a connection, see Connecting to a MySQL® cluster from DataLens. -
--websql-access
: Enables you to run SQL queries to cluster databases from the Yandex Cloud management console using Yandex WebSQL. The default value isfalse
. -
--maintenance-window
: Maintenance window settings (including for disabled clusters), wheretype
is the maintenance type:anytime
(default): Any time.weekly
: On a schedule. If setting this value, specify the day of week and the hour:day
: Day of week inDDD
format:MON
,TUE
,WED
,THU
,FRI
,SAT
, orSUN
.hour
: Hour (UTC) inHH
format:1
to24
.
-
--deletion-protection
: Protection of the cluster, its databases, and users against accidental deletion,true
orfalse
.Enabled deletion protection will not prevent a manual connection with the purpose to delete database contents.
-
performance-diagnostics
: Enabling statistics collection for cluster performance diagnostics. The values of thesessions-sampling-interval
and thestatements-sampling-interval
parameters may range from1
to86400
seconds.
You can retrieve the cluster name with a list of clusters in the folder.
-
Open the current Terraform configuration file with an infrastructure plan.
For more information about how to create this file, see Creating clusters.
-
To change the backup start time, add a
backup_window_start
block to the Managed Service for MySQL® cluster description:resource "yandex_mdb_mysql_cluster" "<cluster_name>" { ... backup_window_start { hours = <hour> minutes = <minute> } ... }
Where:
hours
: Backup starting hourminutes
: Backup starting minutes
-
To change the retention period for backup files, define the
backup_retain_period_days
parameter in the cluster description:resource "yandex_mdb_mysql_cluster" "<cluster_name>" { ... backup_retain_period_days = <backup_retention_period> ... }
Where
backup_retain_period_days
is the retention period for automatic backups (in days). Acceptable values are from7
to60
. The default value is7
. -
To enable access from DataLens and allow execution of SQL queries from the management console using Yandex WebSQL, add a section named
access
to the cluster description:resource "yandex_mdb_mysql_cluster" "<cluster_name>" { ... access { data_lens = <true_or_false> web_sql = <true_or_false> ... } ... }
-
To set up the maintenance window (for disabled clusters as well), add the
maintenance_window
block to the cluster description:resource "yandex_mdb_mysql_cluster" "<cluster_name>" { ... maintenance_window { type = <maintenance_type> day = <day_of_week> hour = <hour> } ... }
Where:
type
: Maintenance type. The possible values include:anytime
: Anytime.weekly
: By schedule.
day
: Day of the week for theweekly
type inDDD
format, e.g.,MON
.hour
: Hour of the day for theweekly
type in theHH
format, e.g.,21
.
-
To enable cluster protection against accidental deletion by a user of your cloud, add the
deletion_protection
field set totrue
to your cluster description:resource "yandex_mdb_mysql_cluster" "<cluster_name>" { ... deletion_protection = <deletion_protection> }
Where
deletion_protection
is cluster deletion protection,true
orfalse
.Enabled deletion protection will not prevent a manual connection with the purpose to delete database contents.
-
To enable statistics collection for cluster performance diagnostics, add the
performance_diagnostics
section to your Managed Service for MySQL® cluster description:resource "yandex_mdb_mysql_cluster" "<cluster_name>" { ... performance_diagnostics { enabled = true sessions_sampling_interval = <session_sampling_interval> statements_sampling_interval = <statement_sampling_interval> } ... }
The values of the
sessions_sampling_interval
and thestatements_sampling_interval
parameters may range from1
to86400
seconds. -
Make sure the settings are correct.
-
Using the command line, navigate to the folder that contains the up-to-date Terraform configuration files with an infrastructure plan.
-
Run the command:
terraform validate
If there are errors in the configuration files, Terraform will point to them.
-
-
Confirm updating the resources.
-
Run the command to view planned changes:
terraform plan
If the resource configuration descriptions are correct, the terminal will display a list of the resources to modify and their parameters. This is a test step. No resources are updated.
-
If you are happy with the planned changes, apply them:
-
Run the command:
terraform apply
-
Confirm the update of resources.
-
Wait for the operation to complete.
-
-
For more information, see the Terraform provider documentation
Time limits
A Terraform provider sets the timeout for Managed Service for MySQL® cluster operations:
- Creating a cluster, including by restoring one from a backup: 15 minutes.
- Editing a cluster, including the MySQL® version update: 60 minutes.
- Deleting a cluster: 15 minutes.
Operations exceeding the set timeout are interrupted.
How do I change these limits?
Add the timeouts
block to the cluster description, for example:
resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
...
timeouts {
create = "1h30m" # 1 hour 30 minutes
update = "2h" # 2 hours
delete = "30m" # 30 minutes
}
}
To change additional cluster settings, use the update REST API method for the Cluster resource or the ClusterService/Update gRPC API call and provide the following in the request:
-
Cluster ID in the
clusterId
parameter. To find out the cluster ID, get a list of clusters in the folder. -
Settings for access from other services in the
configSpec.access
parameter. -
Backup window settings in the
configSpec.backupWindowStart
parameter. -
Maintenance window settings (including for disabled clusters) in the
maintenanceWindow
parameter. -
Retention period of automatic backups in the
configSpec.backupRetainPeriodDays
parameter. Acceptable values are from7
to60
. The default value is7
. -
Cluster deletion protection settings in the
deletionProtection
parameter.Enabled deletion protection will not prevent a manual connection with the purpose to delete database contents.
-
Settings of statistics collection for cluster performance diagnostics in the
configSpec.performanceDiagnostics
parameter.
Warning
This API method overrides all parameters of the object being modified that were not explicitly passed in the request to the default values. To avoid this, list the settings you want to change in the updateMask
parameter (one line separated by commas).
You can get the cluster ID with a list of clusters in the folder.
Moving a cluster
- Go to the folder page and select Managed Service for MySQL.
- Click
to the right of the cluster you want to move. - Select Move.
- Select a folder you want to move the cluster to.
- Click Move.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To move a cluster:
-
View a description of the CLI move cluster command:
yc managed-mysql cluster move --help
-
Specify the destination folder in the move cluster command:
yc managed-mysql cluster move <cluster_ID> \ --destination-folder-name=<destination_folder_name>
You can get the cluster ID with a list of clusters in the folder.
-
Open the current Terraform configuration file with an infrastructure plan.
For more information about how to create this file, see Creating clusters.
-
In the Managed Service for MySQL® cluster description, add or edit the
folder_id
parameter value:resource "yandex_mdb_mysql_cluster" "<cluster_name>" { ... folder_id = "<target_folder_ID>" }
-
Make sure the settings are correct.
-
Using the command line, navigate to the folder that contains the up-to-date Terraform configuration files with an infrastructure plan.
-
Run the command:
terraform validate
If there are errors in the configuration files, Terraform will point to them.
-
-
Confirm updating the resources.
-
Run the command to view planned changes:
terraform plan
If the resource configuration descriptions are correct, the terminal will display a list of the resources to modify and their parameters. This is a test step. No resources are updated.
-
If you are happy with the planned changes, apply them:
-
Run the command:
terraform apply
-
Confirm the update of resources.
-
Wait for the operation to complete.
-
-
For more information, see the Terraform provider documentation
Time limits
A Terraform provider sets the timeout for Managed Service for MySQL® cluster operations:
- Creating a cluster, including by restoring one from a backup: 15 minutes.
- Editing a cluster, including the MySQL® version update: 60 minutes.
- Deleting a cluster: 15 minutes.
Operations exceeding the set timeout are interrupted.
How do I change these limits?
Add the timeouts
block to the cluster description, for example:
resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
...
timeouts {
create = "1h30m" # 1 hour 30 minutes
update = "2h" # 2 hours
delete = "30m" # 30 minutes
}
}
To move a cluster, use the move REST API method for the Cluster resource or the ClusterService/Move gRPC API call and provide the following in the request:
- Cluster ID in the
clusterId
parameter. To find out the cluster ID, get a list of clusters in the folder. - ID of the destination folder in the
destinationFolderId
parameter.
Changing security groups
- Go to the folder page
and select Managed Service for MySQL. - Select the cluster and click Edit in the top panel.
- Under Network settings, select security groups for cluster network traffic.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To edit the list of security groups for your cluster:
-
View a description of the update cluster CLI command:
yc managed-mysql cluster update --help
-
Specify the security groups in the update cluster command:
yc managed-mysql cluster update <cluster_name_or_ID> \ --security-group-ids <list_of_security_group_IDs>
-
Open the current Terraform configuration file with an infrastructure plan.
For more information about how to create this file, see Creating clusters.
-
In the Managed Service for MySQL® cluster description, change the
security_group_ids
parameter value:resource "yandex_mdb_mysql_cluster" "<cluster_name>" { ... security_group_ids = [<list_of_security_group_IDs>] }
-
Make sure the settings are correct.
-
Using the command line, navigate to the folder that contains the up-to-date Terraform configuration files with an infrastructure plan.
-
Run the command:
terraform validate
If there are errors in the configuration files, Terraform will point to them.
-
-
Confirm updating the resources.
-
Run the command to view planned changes:
terraform plan
If the resource configuration descriptions are correct, the terminal will display a list of the resources to modify and their parameters. This is a test step. No resources are updated.
-
If you are happy with the planned changes, apply them:
-
Run the command:
terraform apply
-
Confirm the update of resources.
-
Wait for the operation to complete.
-
-
For more information, see the Terraform provider documentation
Time limits
A Terraform provider sets the timeout for Managed Service for MySQL® cluster operations:
- Creating a cluster, including by restoring one from a backup: 15 minutes.
- Editing a cluster, including the MySQL® version update: 60 minutes.
- Deleting a cluster: 15 minutes.
Operations exceeding the set timeout are interrupted.
How do I change these limits?
Add the timeouts
block to the cluster description, for example:
resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
...
timeouts {
create = "1h30m" # 1 hour 30 minutes
update = "2h" # 2 hours
delete = "30m" # 30 minutes
}
}
To edit the list of cluster security groups, use the update REST API method for the Cluster resource or the ClusterService/Update gRPC API call and provide the following in the request:
- Cluster ID in the
clusterId
parameter. To find out the cluster ID, get a list of clusters in the folder. - List of security group IDs in the
securityGroupIds
parameter. - List of settings to update (in this case,
securityGroupIds
) in theupdateMask
parameter.
Warning
This API method overrides all parameters of the object being modified that were not explicitly passed in the request to the default values. To avoid this, list the settings you want to change in the updateMask
parameter (one line separated by commas).
Warning
You may need to additionally set up security groups to connect to the cluster.