Updating Yandex StoreDoc cluster settings
After creating a cluster, you can:
- Change the host class.
- Change the disk type and expand the storage capacity.
- Configure Yandex StoreDoc servers as per the MongoDB documentation.
- Configure advanced cluster settings.
- Move the cluster to another folder.
- Update security groups.
To move a cluster to a different availability zone, follow this guide. Following this procedure, you will move the cluster hosts.
Changing the host class
Note
Some Yandex StoreDoc settings depend on the selected host class.
When changing the host class:
- A single-host cluster will be unavailable for a few minutes and all database connections will be dropped.
- A multi-host cluster will undergo a primary replica switchover. The hosts will undergo a rolling update, with each host unavailable for a few minutes while it is stopped and updated.
We recommend changing the host class only when the cluster is idle.
-
Open the folder dashboard
. -
Navigate to the Yandex StoreDoc service.
-
Select your cluster and click Edit in the top panel.
-
Depending on the sharding type you select, go to the section of the cluster resources you need to update: Resources, Mongod Resources, Mongoinfra Resources, Mongocfg Resources, or Mongos Resources.
-
Select:
- One of the available platforms.
- Configuration type: Memory-optimized, cpu-optimized, standard, or burstable.
- Host class: Defines the technical specifications of the VMs where the DB hosts will be deployed. When you change the host class for the cluster, the characteristics of all existing hosts change, too.
-
Click Save changes.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To change the cluster’s host class:
-
See the description of the CLI command for updating a cluster:
yc managed-mongodb cluster update --help -
Get the list of available host classes. The
ZONE IDScolumn indicates the availability zones supporting each class:yc managed-mongodb resource-preset list +-----------+--------------------------------+-------+----------+ | ID | ZONE IDS | CORES | MEMORY | +-----------+--------------------------------+-------+----------+ | s1.micro | ru-central1-a, ru-central1-b, | 2 | 8.0 GB | | | ru-central1-d | | | | ... | +-----------+--------------------------------+-------+----------+ -
Run the
cluster updatecommand, providing the required host class: When changing the class, consider the host’s role, which depends on the sharding type. A single command supports arguments for multiple host roles.-
For
MONGODhosts:yc managed-mongodb cluster update <cluster_name_or_ID> \ --mongod-resource-preset <class_ID> -
For
MONGOINFRAhosts:yc managed-mongodb cluster update <cluster_name_or_ID> \ --mongoinfra-resource-preset <class_ID> -
For
MONGOShosts:yc managed-mongodb cluster update <cluster_name_or_ID> \ --mongos-resource-preset <class_ID> -
For
MONGOCFGhosts:yc managed-mongodb cluster update <cluster_name_or_ID> \ --mongocfg-resource-preset <class_ID>
Yandex StoreDoc will start the host class update operation for your cluster.
-
-
Open the current Terraform configuration file describing your infrastructure.
To learn how to create this file, see Creating a cluster.
-
In the Yandex StoreDoc cluster description, update the value of the
resource_preset_idargument forresources_mongod,resources_mongoinfra,resources_mongos, andresources_mongocfgresources. The resource type depends on the sharding type.Here is an example:
resource "yandex_mdb_mongodb_cluster" "<cluster_name>" { ... resources_mongod { resource_preset_id = "<host_class>" ... } } -
Validate your configuration.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Confirm resource changes.
-
Run this command to view the planned changes:
terraform planIf you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
Wait for the operation to complete.
-
-
For more information, see this Terraform provider guide.
Timeouts
The Terraform provider sets the following timeouts for Yandex StoreDoc cluster operations:
- Creating a cluster, including by restoring one from a backup: 30 minutes.
- Editing a cluster: 60 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_mongodb_cluster" "<cluster_name>" {
...
timeouts {
create = "1h30m" # An hour and a half
update = "2h" # Two hours
}
}
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Call the Cluster.Update method, e.g., via the following cURL
request:Warning
The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the
updateMaskparameter as a single comma-separated string.curl \ --request PATCH \ --header "Authorization: Bearer $IAM_TOKEN" \ --header "Content-Type: application/json" \ --url 'https://mdb.api.cloud.yandex.net/managed-mongodb/v1/clusters/<cluster_ID>' \ --data '{ "updateMask": "configSpec.mongodb.<Yandex_StoreDoc_host_type>.resources.resourcePresetId", "configSpec": { "mongodb": { "<Yandex_StoreDoc_host_type>": { "resources": { "resourcePresetId": "<host_class>" } } } } }'Where:
-
updateMask: Comma-separated list of settings you want to update.Here, we provide only one setting.
-
configSpec.mongodb.<Yandex_StoreDoc_host_type>.resources.resourcePresetId: New host class.The Yandex StoreDoc host type depends on the sharding type. The possible values are
mongod,mongocfg,mongos, andmongoinfra. For a non-sharded cluster, usemongod.
You can get the cluster ID from the list of clusters in your folder.
-
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Call the ClusterService.Update method, e.g., via the following gRPCurl
request:Warning
The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the
update_maskparameter as an array ofpaths[]strings.Format for listing settings
"update_mask": { "paths": [ "<setting_1>", "<setting_2>", ... "<setting_N>" ] }grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/mdb/mongodb/v1/cluster_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d '{ "cluster_id": "<cluster_ID>", "update_mask": { "paths": [ "config_spec.mongodb.<Yandex_StoreDoc_host_type>.resources.resource_preset_id" ] }, "config_spec": { "mongodb": { "<Yandex_StoreDoc_host_type>": { "resources": { "resource_preset_id": "<host_class>" } } } } }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.mongodb.v1.ClusterService.UpdateWhere:
-
update_mask: List of settings you want to update as an array of strings (paths[]).Here, we provide only one setting.
-
config_spec.mongodb.<Yandex_StoreDoc_host_type>.resources.resource_preset_id: New host class.The Yandex StoreDoc host type depends on the sharding type. The possible values are
mongod,mongocfg,mongos, andmongoinfra. For a non-sharded cluster, usemongod.
You can get the cluster ID from the list of clusters in your folder.
-
-
Check the server response to make sure your request was successful.
Changing the disk type and expanding the storage size
Make sure the cloud has enough quota to increase the storage size. Open the cloud's Quotas
To change the disk type and expand the storage size for a cluster:
-
Open the folder dashboard
. -
Navigate to the Yandex StoreDoc service.
-
Select your cluster and click Edit in the top panel.
-
Depending on the sharding type you select, go to the section of the cluster resources you need to update: Resources, Mongod Resources, Mongoinfra Resources, Mongocfg Resources, or Mongos Resources.
-
Under Storage:
- Select the disk type.
- Specify the disk size.
-
Click Save changes.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To change the disk type and expand the storage size for a cluster:
-
See the description of the CLI command for updating a cluster:
yc managed-mongodb cluster update --help -
Specify the disk type and the required storage size in the
cluster updatecommand. The specified storage size must not be less than thedisk_sizecluster setting.When expanding storage, consider the host’s role, which depends on the sharding type. A single command supports arguments for multiple host roles.
-
For
MONGODhosts:yc managed-mongodb cluster update <cluster_name_or_ID> \ --mongod-disk-type <disk_type> \ --mongod-disk-size <storage_size_in_GB> -
For
MONGOINFRAhosts:yc managed-mongodb cluster update <cluster_name_or_ID> \ --mongoinfra-disk-type <disk_type> \ --mongoinfra-disk-size <storage_size_in_GB> -
For
MONGOShosts:yc managed-mongodb cluster update <cluster_name_or_ID> \ --mongos-disk-type <disk_type> \ --mongos-disk-size <storage_size_in_GB> -
For
MONGOCFGhosts:yc managed-mongodb cluster update <cluster_name_or_ID> \ --mongocfg-disk-type <disk_type> \ --mongocfg-disk-size <storage_size_in_GB>
If all the conditions are met, Yandex StoreDoc will start the storage reconfiguration operation.
-
To change the disk type and expand the storage size for a cluster:
-
Open the current Terraform configuration file describing your infrastructure.
To learn how to create this file, see Creating a cluster.
-
In the Yandex StoreDoc cluster description, change the values of the
disk_type_idanddisk_sizearguments for theresources_mongod,resources_mongoinfra,resources_mongos, andresources_mongocfgresources. The resource type depends on the sharding type.Here is an example:
resource "yandex_mdb_mongodb_cluster" "<cluster_name>" { ... resources_mongod { disk_type_id = "<disk_type>" disk_size = <storage_size_in_GB> ... } } -
Validate your configuration.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Confirm resource changes.
-
Run this command to view the planned changes:
terraform planIf you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
Wait for the operation to complete.
-
-
For more information, see this Terraform provider guide.
Timeouts
The Terraform provider sets the following timeouts for Yandex StoreDoc cluster operations:
- Creating a cluster, including by restoring one from a backup: 30 minutes.
- Editing a cluster: 60 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_mongodb_cluster" "<cluster_name>" {
...
timeouts {
create = "1h30m" # An hour and a half
update = "2h" # Two hours
}
}
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Call the Cluster.Update method, e.g., via the following cURL
request:Warning
The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the
updateMaskparameter as a single comma-separated string.curl \ --request PATCH \ --header "Authorization: Bearer $IAM_TOKEN" \ --header "Content-Type: application/json" \ --url 'https://mdb.api.cloud.yandex.net/managed-mongodb/v1/clusters/<cluster_ID>' \ --data '{ "updateMask": "configSpec.mongodb.<Yandex_StoreDoc_host_type>.resources.diskTypeId,configSpec.mongodb.<Yandex_StoreDoc_host_type>.resources.diskSize", "configSpec": { "mongodb": { "<Yandex_StoreDoc_host_type>": { "resources": { "diskTypeId": "<disk_type>", "diskSize": "<storage_size_in_bytes>" } } } } }'Where:
-
updateMask: Comma-separated list of settings you want to update. -
configSpec.mongodb.<Yandex_StoreDoc_host_type>.resources: Storage settings:diskTypeId: Disk type.diskSize: New storage size, in bytes.
The Yandex StoreDoc host type depends on the sharding type. The possible values are
mongod,mongocfg,mongos, andmongoinfra. For a non-sharded cluster, usemongod.
You can get the cluster ID from the list of clusters in your folder.
-
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Call the ClusterService.Update method, e.g., via the following gRPCurl
request:Warning
The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the
update_maskparameter as an array ofpaths[]strings.Format for listing settings
"update_mask": { "paths": [ "<setting_1>", "<setting_2>", ... "<setting_N>" ] }grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/mdb/mongodb/v1/cluster_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d '{ "cluster_id": "<cluster_ID>", "update_mask": { "paths": [ "config_spec.mongodb.<Yandex_StoreDoc_host_type>.resources.disk_type_id", "config_spec.mongodb.<Yandex_StoreDoc_host_type>.resources.disk_size" ] }, "config_spec": { "mongodb": { "<Yandex_StoreDoc_host_type>": { "resources": { "disk_type_id": "<disk_type>", "disk_size": "<storage_size_in_bytes>" } } } } }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.mongodb.v1.ClusterService.UpdateWhere:
-
update_mask: List of settings you want to update as an array of strings (paths[]). -
config_spec.mongodb.<Yandex_StoreDoc_host_type>.resources.disk_size: Storage settings:disk_type_id: Disk type.disk_size: New storage size, in bytes.
The Yandex StoreDoc host type depends on the sharding type. The possible values are
mongod,mongocfg,mongos, andmongoinfra. For a non-sharded cluster, usemongod.
You can get the cluster ID from the list of clusters in your folder.
-
-
Check the server response to make sure your request was successful.
Changing Yandex StoreDoc settings
You can change the DBMS settings for your cluster hosts.
Note
Some Yandex StoreDoc settings depend on the selected host class.
- Open the folder dashboard
. - Navigate to the Yandex StoreDoc service.
- Select your cluster and click Edit in the top panel.
- To change the Yandex StoreDoc settings, click Settings under DBMS settings.
- Click Save changes.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To update the Yandex StoreDoc cluster settings, use the following command:
yc managed-mongodb cluster update-config
For example, run the command below to set net.maxIncomingConnections to 4096:
yc managed-mongodb cluster update-config <cluster_name> \
--set net.max_incoming_connections=4096
Yandex StoreDoc will launch the reconfiguration of the cluster’s DBMS settings. If an updated setting requires a DBMS restart, Yandex StoreDoc will perform a rolling restart on all cluster hosts.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Call the Cluster.Update method, e.g., via the following cURL
request:Warning
The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the
updateMaskparameter as a single comma-separated string.curl \ --request PATCH \ --header "Authorization: Bearer $IAM_TOKEN" \ --header "Content-Type: application/json" \ --url 'https://mdb.api.cloud.yandex.net/managed-mongodb/v1/clusters/<cluster_ID>' \ --data '{ "updateMask": "configSpec.mongodb.<Yandex_StoreDoc_host_type>.config.<setting_1>,configSpec.mongodb.<Yandex_StoreDoc_host_type>.config.<setting_2>,...,configSpec.mongodb.<Yandex_StoreDoc_host_type>.config.<setting_N>", "configSpec": { "mongodb": { "<Yandex_StoreDoc_host_type>": { "config": { "<setting_1>": "<value_1>", "<setting_2>": "<value_2>", ... "<setting_N>": "<value_N>" } } } } }'Where:
-
updateMask: Comma-separated list of settings you want to update. -
configSpec.mongodb.<Yandex_StoreDoc_host_type>.config: List of Yandex StoreDoc settings. Enter each setting on a new line, separated by commas. All supported settings are described in the API reference and in Yandex StoreDoc settings.The Yandex StoreDoc host type depends on the sharding type. The possible values are
mongod,mongocfg,mongos, andmongoinfra. For a non-sharded cluster, usemongod.
You can get the cluster ID from the list of clusters in your folder.
-
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Call the ClusterService.Update method, e.g., via the following gRPCurl
request:Warning
The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the
update_maskparameter as an array ofpaths[]strings.Format for listing settings
"update_mask": { "paths": [ "<setting_1>", "<setting_2>", ... "<setting_N>" ] }grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/mdb/mongodb/v1/cluster_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d '{ "cluster_id": "<cluster_ID>", "update_mask": { "paths": [ "config_spec.mongodb.<Yandex_StoreDoc_host_type>.config.<setting_1>", "config_spec.mongodb.<Yandex_StoreDoc_host_type>.config.<setting_2>", ... "config_spec.mongodb.<Yandex_StoreDoc_host_type>.config.<setting_N>" ] }, "config_spec": { "mongodb": { "<Yandex_StoreDoc_host_type>": { "config": { "<setting_1>": "<value_1>", "<setting_2>": "<value_2>", ... "<setting_N>": "<value_N>" } } } } }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.mongodb.v1.ClusterService.UpdateWhere:
-
update_mask: List of settings you want to update as an array of strings (paths[]). -
config_spec.mongodb.<Yandex_StoreDoc_host_type>.config: List of Yandex StoreDoc settings. Enter each setting on a new line, separated by commas. All supported settings are described in the API reference and in Yandex StoreDoc settings.The Yandex StoreDoc host type depends on the sharding type. The possible values are
mongod,mongocfg,mongos, andmongoinfra. For a non-sharded cluster, usemongod.
You can get the cluster ID from the list of clusters in your folder.
-
-
Check the server response to make sure your request was successful.
Configuring advanced cluster settings
-
Open the folder dashboard
. -
Navigate to the Yandex StoreDoc service.
-
Select your cluster and click Edit in the top panel.
-
Configure advanced 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:00UTC. -
Retention period for automatic backups, days
Retention period for automatic backups. Backups are automatically deleted once their retention period expires. The default is 7 days. This feature is at the Preview stage. For more information, see Backups.
Changing the retention period affects both new and existing automatic backups. For example, if the initial retention period was 7 days, and the remaining lifetime of a separate automatic backup is 1 day, increasing the retention period to 9 days will change the remaining lifetime of this backup to 3 days.
For an existing cluster, automatic backups are stored for a specified number of days whereas manually created ones are stored indefinitely. After a cluster is deleted, all backups persist for 7 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.
-
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 built-in performance diagnostics tool in the cluster. This feature is at the Preview stage.
-
Deletion protection: Cluster protection from accidental deletion.
Even with cluster deletion protection enabled, one can still delete a user or database or connect manually and delete the database contents.
-
-
Click Save changes.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To change advanced cluster settings:
-
See the description of the CLI command for updating a cluster:
yc managed-mongodb cluster update --help -
Run the following command, providing the list of settings you want to update:
yc managed-mongodb cluster update <cluster_ID_or_name> \ --backup-retain-period-days=<retention_period> \ --backup-window-start <backup_start_time> \ --maintenance-window type=<maintenance_type>,` `day=<day_of_week>,` `hour=<hour> \ --performance-diagnostics=<enable_diagnostics> \ --deletion-protection
You can update the following settings:
-
--backup-retain-period: Retention period for automatic backups, in days.The
<retention_period>value must be in the range from 7 to 35. The default value is 7. This feature is in Preview. For more information, see Backups.Changing the retention period affects both new and existing automatic backups.
For example, if the original retention period was 7 days, and the remaining lifetime of a specific automatic backup was 1 day, then increasing the retention period to 9 days would make that backup’s remaining lifetime 3 days.
--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.
-
--maintenance-window: Maintenance window settings that apply to both running and stopped clusters. Thetypesetting defines the maintenance type:anytime: At any time (default).weekly: On a schedule. For this value, also specify the following:day: Day of week, i.e.,MON,TUE,WED,THU,FRI,SAT, orSUN.hour: Hour of day (UTC), from1to24.
-
--performance-diagnostics: Specify this setting to use the Performance diagnostics tool in your cluster. This feature is in Preview. -
--deletion-protection: Cluster protection from accidental deletion,trueorfalse.Even with cluster deletion protection enabled, one can still delete a user or database or connect manually and delete the database contents.
You can get the cluster ID and name with the list of clusters in the folder.
-
Open the current Terraform configuration file describing your infrastructure.
To learn how to create this file, see Creating a cluster.
-
To change the backup start time, locate your Yandex StoreDoc cluster description and add the
backup_window_startsection undercluster_config:resource "yandex_mdb_mongodb_cluster" "<cluster_name>" { ... cluster_config { backup_window_start { hours = <hour> minutes = <minute> } ... } ... }Where
hoursis the hour andminutesis the minute of the backup start time. -
To set up the maintenance window (for disabled clusters as well), add the
maintenance_windowsection to the cluster description:resource "yandex_mdb_mongodb_cluster" "<cluster_name>" { ... maintenance_window { type = <maintenance_type> day = <day_of_week> hour = <hour> } ... }Where:
type: Maintenance type. The possible values include:ANYTIME: AnytimeWEEKLY: On a schedule
day: Day of week for theWEEKLYtype, i.e.,MON,TUE,WED,THU,FRI,SAT, orSUN.hour: UTC hour for theWEEKLYtype, from1to24.
-
To protect your cluster against accidental deletion, add the
deletion_protectionfield set totrueto your cluster description:resource "yandex_mdb_mongodb_cluster" "<cluster_name>" { ... deletion_protection = <protect_cluster_from_deletion> }Even with cluster deletion protection enabled, one can still delete a user or database or connect manually and delete the database contents.
To disable deletion protection, set this value to
false. -
Validate your configuration.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Confirm resource changes.
-
Run this command to view the planned changes:
terraform planIf you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
Wait for the operation to complete.
-
-
For more information, see this Terraform provider guide.
Timeouts
The Terraform provider sets the following timeouts for Yandex StoreDoc cluster operations:
- Creating a cluster, including by restoring one from a backup: 30 minutes.
- Editing a cluster: 60 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_mongodb_cluster" "<cluster_name>" {
...
timeouts {
create = "1h30m" # An hour and a half
update = "2h" # Two hours
}
}
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Create a file named
body.jsonand paste the following code into it:Warning
The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the
updateMaskparameter as a single comma-separated string.{ "updateMask": "configSpec.backupWindowStart,configSpec.backupRetainPeriodDays,configSpec.performanceDiagnostics,maintenanceWindow,deletionProtection", "configSpec": { "backupWindowStart": { "hours": "<hours>", "minutes": "<minutes>", "seconds": "<seconds>", "nanos": "<nanoseconds>" }, "backupRetainPeriodDays": "<backup_retention_in_days>", "performanceDiagnostics": { "profilingEnabled": <enable_profiler> } } "maintenanceWindow": { "weeklyMaintenanceWindow": { "day": "<day_of_week>", "hour": "<hour>" } }, "deletionProtection": <protect_cluster_from_deletion> }Where:
-
updateMask: Comma-separated list of settings you want to update. -
configSpec: Cluster settings:-
backupWindowStart: Backup window settings.Here, specify the backup start time:
hours: Between0and23hours.minutes: Between0and59minutes.seconds: Between0and59seconds.nanos: Between0and999999999nanoseconds.
-
backupRetainPeriodDays: Backup retention time in days. -
performanceDiagnostics: Statistics collection settings:profilingEnabled: Enable profiler,trueorfalse.
-
-
maintenanceWindow: Maintenance window settings, applying to both running and stopped clusters. InmaintenanceWindow, provide one of the following values:-
anytime: Maintenance can occur at any time. -
weeklyMaintenanceWindow: Maintenance occurs once a week at the specified time:day: Day of the week, inDDDformat.hour: Hour of the day, inHHformat. Allowed values range from1to24hours.
-
-
deletionProtection: Cluster deletion protection,trueorfalse.Even with cluster deletion protection enabled, one can still delete a user or database or connect manually and delete the database contents.
-
-
Call the Cluster.Update method, e.g., via the following cURL
request:curl \ --request PATCH \ --header "Authorization: Bearer $IAM_TOKEN" \ --header "Content-Type: application/json" \ --url 'https://mdb.api.cloud.yandex.net/managed-mongodb/v1/clusters/<cluster_ID>' \ --data "@body.json"You can get the cluster ID from the list of clusters in your folder.
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Create a file named
body.jsonand paste the following code into it:Warning
The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the
update_maskparameter as an array ofpaths[]strings.Format for listing settings
"update_mask": { "paths": [ "<setting_1>", "<setting_2>", ... "<setting_N>" ] }{ "cluster_id": "<cluster_ID>", "update_mask": { "paths": [ "config_spec.backup_window_start", "config_spec.backup_retain_period_days", "config_spec.performance_diagnostics", "maintenance_window", "deletion_protection" ] }, "config_spec": { "backup_window_start": { "hours": "<hours>", "minutes": "<minutes>", "seconds": "<seconds>", "nanos": "<nanoseconds>" }, "backup_retain_period_days": "<backup_retention_in_days>", "performance_diagnostics": { "profiling_enabled": <enable_profiler> } }, "maintenance_window": { "weekly_maintenance_window": { "day": "<day_of_week>", "hour": "<hour>" } }, "deletion_protection": <protect_cluster_from_deletion> }Where:
-
update_mask: List of settings you want to update as an array of strings (paths[]). -
config_spec: Cluster settings:-
backup_window_start: Backup window settings.Here, specify the backup start time:
hours: Between0and23hours.minutes: Between0and59minutes.seconds: Between0and59seconds.nanos: Between0and999999999nanoseconds.
-
backup_retain_period_days: Backup retention time in days. -
performance_diagnostics: Statistics collection settings:profiling_enabled: Enable profiler,trueorfalse.
-
-
maintenance_window: Maintenance window settings, applying to both running and stopped clusters. Inmaintenance_window, provide one of the following values:-
anytime: Maintenance can occur at any time. -
weekly_maintenance_window: Maintenance occurs once a week at the specified time:day: Day of the week, inDDDformat.hour: Hour of the day, inHHformat. Allowed values range from1to24hours.
-
-
deletion_protection: Cluster deletion protection,trueorfalse.Even with cluster deletion protection enabled, one can still delete a user or database or connect manually and delete the database contents.
-
-
Call the ClusterService.Update method, e.g., via the following gRPCurl
request:grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/mdb/mongodb/v1/cluster_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d @ \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.mongodb.v1.ClusterService.Update \ < body.json -
Check the server response to make sure your request was successful.
Moving a cluster
- Open the folder dashboard
. - Navigate to the Yandex StoreDoc service.
- Click
next to the cluster you want to move. - Select Move.
- Select the destination folder for your cluster.
- Click Move.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To move a cluster:
-
See the description of the CLI command for moving a cluster:
yc managed-mongodb cluster move --help -
Run the
cluster movecommand, providing the destination folder:yc managed-mongodb cluster move <cluster_name_or_ID> \ --destination-folder-name=<destination_folder_name>You can get the cluster ID with the list of clusters in the folder.
-
Open the current Terraform configuration file describing your infrastructure.
To learn how to create this file, see Creating a cluster.
-
In the Yandex StoreDoc cluster description, add or update the
folder_idargument:resource "yandex_mdb_mongodb_cluster" "<cluster_name>" { ... folder_id = "<destination_folder_ID>" } -
Validate your configuration.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Confirm resource changes.
-
Run this command to view the planned changes:
terraform planIf you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
Wait for the operation to complete.
-
-
For more information, see this Terraform provider guide.
Timeouts
The Terraform provider sets the following timeouts for Yandex StoreDoc cluster operations:
- Creating a cluster, including by restoring one from a backup: 30 minutes.
- Editing a cluster: 60 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_mongodb_cluster" "<cluster_name>" {
...
timeouts {
create = "1h30m" # An hour and a half
update = "2h" # Two hours
}
}
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Call the Cluster.Move method, e.g., via the following cURL
request:curl \ --request POST \ --header "Authorization: Bearer $IAM_TOKEN" \ --header "Content-Type: application/json" \ --url 'https://mdb.api.cloud.yandex.net/managed-mongodb/v1/clusters/<cluster_ID>:move' \ --data '{ "destinationFolderId": "<folder_ID>" }'Where
destinationFolderIdis the ID of the target folder for your cluster. You can get it from the list of your cloud foldersYou can get the cluster ID from the list of clusters in your folder.
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Call the ClusterService.Move method, e.g., via the following gRPCurl
request:grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/mdb/mongodb/v1/cluster_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d '{ "cluster_id": "<cluster_ID>", "destination_folder_id": "<folder_ID>" }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.mongodb.v1.ClusterService.MoveWhere
destination_folder_idis the ID of the target folder for your cluster. You can get it from the list of your cloud foldersYou can get the cluster ID from the list of clusters in your folder.
-
Check the server response to make sure your request was successful.
Updating security groups
- Open the folder dashboard
. - Navigate to the Yandex StoreDoc service.
- Select your cluster and click Edit in the top panel.
- Under Network settings, select the security groups that control the cluster’s network traffic.
- Click Save changes.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To change the list of security groups for your cluster:
-
See the description of the CLI command for updating a cluster:
yc managed-mongodb cluster update --help -
Run the
cluster updatecommand, providing the required security groups:yc managed-mongodb cluster update <cluster_name_or_ID> \ --security-group-ids <list_of_security_group_IDs>
-
Open the current Terraform configuration file describing your infrastructure.
To learn how to create this file, see Creating a cluster.
-
Update the
security_group_idsvalue in the Yandex StoreDoc cluster description:resource "yandex_mdb_mongodb_cluster" "<cluster_name>" { ... security_group_ids = [ <list_of_security_group_IDs> ] ... } -
Validate your configuration.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Confirm resource changes.
-
Run this command to view the planned changes:
terraform planIf you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
Wait for the operation to complete.
-
-
For more information, see this Terraform provider guide.
Timeouts
The Terraform provider sets the following timeouts for Yandex StoreDoc cluster operations:
- Creating a cluster, including by restoring one from a backup: 30 minutes.
- Editing a cluster: 60 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_mongodb_cluster" "<cluster_name>" {
...
timeouts {
create = "1h30m" # An hour and a half
update = "2h" # Two hours
}
}
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Call the Cluster.Update method, e.g., via the following cURL
request:Warning
The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the
updateMaskparameter as a single comma-separated string.curl \ --request PATCH \ --header "Authorization: Bearer $IAM_TOKEN" \ --header "Content-Type: application/json" \ --url 'https://mdb.api.cloud.yandex.net/managed-mongodb/v1/clusters/<cluster_ID>' \ --data '{ "updateMask": "securityGroupIds", "securityGroupIds": [ "<security_group_1_ID>", "<security_group_2_ID>", ... "<security_group_N_ID>" ] }'Where:
-
updateMask: Comma-separated list of settings you want to update.Here, we provide only one setting.
-
securityGroupIds: List of security group IDs.
You can get the cluster ID from the list of clusters in your folder.
-
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Call the ClusterService.Update method, e.g., via the following gRPCurl
request:Warning
The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the
update_maskparameter as an array ofpaths[]strings.Format for listing settings
"update_mask": { "paths": [ "<setting_1>", "<setting_2>", ... "<setting_N>" ] }grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/mdb/mongodb/v1/cluster_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d '{ "cluster_id": "<cluster_ID>", "update_mask": { "paths": [ "security_group_ids" ] }, "security_group_ids": [ "<security_group_1_ID>", "<security_group_2_ID>", ... "<security_group_N_ID>" ] }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.mongodb.v1.ClusterService.UpdateWhere:
-
update_mask: List of settings you want to update as an array of strings (paths[]).Here, we provide only one setting.
-
security_group_ids: List of security group IDs.
You can get the cluster ID from the list of clusters in your folder.
-
-
Check the server response to make sure your request was successful.
Warning
You may need to configure security groups to enable access to your cluster.