Yandex StoreDoc version upgrade
You can only upgrade your Yandex StoreDoc cluster to a version that immediately follows the current one, such as 4.2 to 4.4. Upgrading to later versions is performed in stages. For example, for Yandex StoreDoc, the upgrade sequence from version 4.2 to 8.0 is: 4.2 → 4.4 → 5.0 → 6.0 → 7.0 → 8.0. Before each cluster upgrade step, you must update the cluster compatibility version.
Alert
After upgrading, you cannot roll your cluster back to the previous version.
Before upgrading a version
-
Make sure the upgrade will not disrupt your applications:
-
See 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.
-
Create a backup of the main cluster immediately before upgrading.
-
Make sure the cluster compatibility version matches the current cluster version. If required, upgrade the cluster compatibility version.
Upgrading the cluster version
- Go to the folder
page. - Go to Yandex StoreDoc.
- Select the cluster from the list and click Edit.
- In the Version field, select the new version number.
- Click Save changes.
As soon as you run the upgrade, the cluster status will change to UPDATING. Wait for the operation to complete and then check the cluster version.
-
Get the list of your Yandex StoreDoc clusters using this command:
yc managed-mongodb cluster list -
Get information about the cluster in question and check its Yandex StoreDoc version in the
config.versionsetting:yc managed-mongodb cluster get <cluster_name_or_ID> -
Run the Yandex StoreDoc upgrade:
yc managed-mongodb cluster update <cluster_name_or_ID> \ --mongodb-version=<new_version_number>As soon as you run 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 Yandex StoreDoc features that are not backward-compatible with the previous version will be disabled. To remove this restriction, run this 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.
Learn how to create this file in Creating a cluster.
-
Add the
versionfield to the Yandex StoreDoc cluster description or edit its value if it is already there:resource "yandex_mdb_mongodb_cluster" "<cluster_name>" { ... cluster_config { version = "<Yandex_StoreDoc_version>" } } -
Make sure the settings are correct.
-
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 updating the resources.
-
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 put it into 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 string of settings you want to update.In this case, one parameter is provided.
-
configSpec.version: New Yandex StoreDoc version.
You can get the cluster ID with the list of clusters in the folder.
-
-
View the server response to make sure your request was successful.
-
Get an IAM token for API authentication and put it into 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[]).In this case, one parameter is provided.
-
version: New Yandex StoreDoc version.
You can get the cluster ID with the list of clusters in the folder.
-
-
View the server response to make sure your request was successful.
Note
After the upgrade, all Yandex StoreDoc features that are not backward-compatible with the previous version will be disabled. To remove this limitation, upgrade the cluster compatibility version.
Upgrading the compatibility version
Upgrading the cluster compatibility version is required if you need to:
- Upgrade your cluster to a new version, but the compatibility version does not match the current cluster version.
- Make new Yandex StoreDoc features available after a cluster upgrade.
Learn more about backward compatibility in the MongoDB guide
Alert
Upgrading the cluster compatibility version is irreversible.
-
Get the list of your Yandex StoreDoc clusters using this command:
yc managed-mongodb cluster list -
Get information about the cluster in question and check its Yandex StoreDoc version in the
config.feature_compatibility_versionsetting:yc managed-mongodb cluster get <cluster_name_or_ID> -
Run the cluster update command by specifying 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.
Learn how to create this file in Creating a cluster.
-
Add the
feature_compatibility_versionfield to the Yandex StoreDoc cluster description or edit its value if it is already there:resource "yandex_mdb_mongodb_cluster" "<cluster_name>" { ... cluster_config { feature_compatibility_version = "<Yandex_StoreDoc_compatibility_version>" } } -
Make sure the settings are correct.
-
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 updating the resources.
-
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 put it into 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 string of settings you want to update.In this case, one parameter is provided.
-
configSpec.featureCompatibilityVersion: New Yandex StoreDoc compatibility version.
You can get the cluster ID with the list of clusters in the folder.
-
-
View the server response to make sure your request was successful.
-
Get an IAM token for API authentication and put it into 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[]).In this case, one parameter is provided.
-
feature_compatibility_version: New Yandex StoreDoc compatibility version.
You can get the cluster ID with the list of clusters in the folder.
-
-
View the server response to make sure your request was successful.
Examples
Let's assume that you need to upgrade your cluster from version 5.0 to version 6.0.
-
To find out the cluster ID, get a list of all clusters in the folder:
yc managed-mongodb cluster listResult:
+----------------------+---------------+---------------------+--------+---------+ | ID | NAME | CREATED AT | HEALTH | STATUS | +----------------------+---------------+---------------------+--------+---------+ | c9q8p8j2gaih******** | storedoc406 | 2019-04-23 12:44:17 | ALIVE | RUNNING | +----------------------+---------------+---------------------+--------+---------+ -
To get information about a
c9qut3k64b2o********cluster, 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 6.0 features in the
c9qutgkd4b2o********cluster, run this command:yc managed-mongodb cluster update c9qutgkd4b2o******** \ --feature-compatibility-version=6.0