Yandex StoreDoc version upgrade
You can only upgrade your Yandex StoreDoc cluster to the next sequential version, e.g., from 4.2 to 4.4. Upgrading to subsequent versions must be done incrementally. For example, upgrading Yandex StoreDoc from version 4.2 to 8.0 is performed in the following sequence: 4.2 → 4.4 → 5.0 → 6.0 → 7.0 → 8.0. Before each cluster upgrade stage, you must update the cluster compatibility version.
Alert
After the upgrade, it is impossible to revert the cluster to a previous version.
Before version upgrade
-
Make sure the upgrade will not disrupt your applications:
-
Review the MongoDB release notes to learn how upgrades may affect your applications.
-
Try upgrading a test cluster. You can deploy it from a backup of the main cluster.
-
Back up your main cluster before upgrading.
-
Make sure the cluster compatibility version matches the current cluster version. If necessary, upgrade the cluster compatibility version.
Upgrading the cluster version
- Open the folder dashboard
. - Navigate to the Yandex StoreDoc service.
- Select the cluster you need from the list and click Edit.
- Select the new version number in the Version field.
- Click Save changes.
Once you launch the upgrade, the cluster status will change to UPDATING. Wait for the operation to complete and then check the cluster version.
-
Retrieve the list of your Yandex StoreDoc clusters using this command:
yc managed-mongodb cluster list -
Get the target cluster details and check the
config.versionsetting for its Yandex StoreDoc version:yc managed-mongodb cluster get <cluster_name_or_ID> -
Start the Yandex StoreDoc upgrade:
yc managed-mongodb cluster update <cluster_name_or_ID> \ --mongodb-version=<new_version_number>Once you launch the upgrade, the cluster status will change to UPDATING. Wait for the operation to complete and then check the cluster version.
-
After the upgrade, all non-backward-compatible Yandex StoreDoc features will be disabled. To remove this limitation, run the following command:
yc managed-mongodb cluster update <cluster_name_or_ID> \ --feature-compatibility-version=<new_version_number>
-
Open the current Terraform configuration file describing your infrastructure.
To learn how to create this file, see Creating a cluster.
-
Add or update the
versionfield in the Yandex StoreDoc cluster description:resource "yandex_mdb_mongodb_cluster" "<cluster_name>" { ... cluster_config { version = "<Yandex_StoreDoc_version>" } } -
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.version", "configSpec": { "version": "<Yandex_StoreDoc_new_version>" } }'Where:
-
updateMask: Comma-separated list of settings you want to update.Here, we provide only one setting.
-
configSpec.version: New Yandex StoreDoc version.
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.version" ] }, "config_spec": { "version": "<Yandex_StoreDoc_version>" } }' \ 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.
-
version: New Yandex StoreDoc version.
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.
Note
After the upgrade, all non-backward-compatible Yandex StoreDoc features will be disabled. To remove this limitation, update the cluster compatibility version.
Updating the cluster compatibility version
Updating the cluster compatibility version is necessary when you need to:
- Upgrade your cluster to a new version (when the compatibility version does not match the current cluster version).
- Enable the new Yandex StoreDoc features after the cluster upgrade.
To learn more about backward compatibility, refer to the MongoDB documentation
Alert
Updating the cluster compatibility version is irreversible.
- Open the folder dashboard
. - Navigate to the Yandex StoreDoc service.
- Select the cluster you need from the list and click Edit.
- In the Compatibility version field, select the required version number.
- Click Save changes.
-
Retrieve the list of your Yandex StoreDoc clusters using this command:
yc managed-mongodb cluster list -
Get the target cluster details and check the
config.feature_compatibility_versionsetting for its Yandex StoreDoc version:yc managed-mongodb cluster get <cluster_name_or_ID> -
Run the
cluster updatecommand, providing the new compatibility version:yc managed-mongodb cluster update <cluster_name_or_ID> \ --feature-compatibility-version=<Yandex_StoreDoc_compatibility_version>
-
Open the current Terraform configuration file describing your infrastructure.
To learn how to create this file, see Creating a cluster.
-
Add or update the
feature_compatibility_versionfield in the Yandex StoreDoc cluster description:resource "yandex_mdb_mongodb_cluster" "<cluster_name>" { ... cluster_config { feature_compatibility_version = "<Yandex_StoreDoc_compatibility_version>" } } -
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.featureCompatibilityVersion", "configSpec": { "featureCompatibilityVersion": "<Yandex_StoreDoc_compatibility_version>" } }'Where:
-
updateMask: Comma-separated list of settings you want to update.Here, we provide only one setting.
-
configSpec.featureCompatibilityVersion: New Yandex StoreDoc compatibility version.
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.feature_compatibility_version" ] }, "config_spec": { "feature_compatibility_version": "<Yandex_StoreDoc_compatibility_version>" } }' \ 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.
-
feature_compatibility_version: New Yandex StoreDoc compatibility version.
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.
Examples
Suppose you need to upgrade a cluster from version 5.0 to 6.0.
-
To get the cluster ID, retrieve a list of all clusters in your folder:
yc managed-mongodb cluster listResult:
+----------------------+---------------+---------------------+--------+---------+ | ID | NAME | CREATED AT | HEALTH | STATUS | +----------------------+---------------+---------------------+--------+---------+ | c9q8p8j2gaih******** | storedoc406 | 2019-04-23 12:44:17 | ALIVE | RUNNING | +----------------------+---------------+---------------------+--------+---------+ -
To get
c9qut3k64b2o********cluster details, run the following command:yc managed-mongodb cluster get c9qut3k64b2o********Result:
id: c9qut3k64b2o******** folder_id: b1g0itj57rbj******** created_at: "2019-07-16T09:43:50.393231Z" name: storedoc406 environment: PRODUCTION monitoring: - name: Console description: Console charts link: https://console.yandex.cloud/folders/b1g0itj57rbj********/managed-mongodb/cluster/c9qut3k64b2o********?section=monitoring config: version: "5.0" feature_compatibility_version: "5.0" ... -
To upgrade the
c9qutgkd4b2o********cluster to version 6.0, run this command:yc managed-mongodb cluster update c9qutgkd4b2o******** \ --mongodb-version=6.0 -
To enable all version 6.0 capabilities in the
c9qutgkd4b2o********cluster, run this command:yc managed-mongodb cluster update c9qutgkd4b2o******** \ --feature-compatibility-version=6.0