Navigation
This version of the documentation is archived and no longer supported. To learn how to upgrade your version of MongoDB Ops Manager, refer to the upgrade documentation.
You were redirected from a different version of the documentation. Click here to go back.

Update the MongoDB Version of a Deployment

Overview

This tutorial describes how to use the API to migrate a MongoDB deployment to a new version of MongoDB. These steps assume you have an existing deployment that uses a 2.4.x version of MongoDB, as would be the case if you used the tutorial to Deploy a Cluster through the API, that you will migrate to a 2.6 or later deployment.

Beginning with version 2.6, MongoDB implemented a new format for MongoDB configuration options. These steps describe how to modify an existing 2.4 sharded cluster to conform to the 2.6 configuration format.

Consideration

The API supports the MongoDB options listed on the Supported MongoDB Options for Automation page.

Prerequisite

You must have credentials to access Ops Manager as a user with the Global Owner role.

Procedure

1

Retrieve the automation configuration from Ops Manager.

Use the automationConfig resource to retrieve the configuration. Issue the following command, replacing <user@example.net> with the credentials of the global owner, <api_key> with the previously retrieved API key, <app-example.net> with the URL of Ops Manager, and <group_id> with the previously retrieved group ID:

curl -u "<user@example.net>:<api_key>" "http://<app-example.net>/api/public/v1.0/groups/<group_id>/automationConfig" --digest -i

Confirm that the version field of the retrieved automation configuration matches the version field in the mms-cluster-config-backup.json file.

2

Open the configuration document for editing.

As you edit the configuration document in the next steps, reference the description of an automation configuration for detailed descriptions of settings.

3

Add the new MongoDB version number to the configuration document.

Update the mongoDbVersions array to include {"name": "2.6.7"}:

"mongoDbVersions": [
    {"name": "2.4.12"},
    {"name": "2.6.7"}
]
4

Update the MongoDB configuration options to the 2.6 syntax.

Update each document in the processes array as follows.

Update the processes.version field to specify 2.6.7:

"version": "2.6.7"

Change the processes.args2_4 field to processes.args2_6:

"args2_6": {

Edit the options in the processes.args2_6 field to conform with the MongoDB 2.6 structure described in Configuration File Options in the MongoDB manual. For example:

"args2_6": {
    "net": {
        "port": 27017
    },
    "storage": {
        "dbPath": "/data/"
    },
    "systemLog": {
        "path": "/data/mongodb.log",
        "destination": "file"
    },
    "replication": {
        "replSetName": "rs1"
    },
    "operationProfiling": {}
}
5

Send the configuration document.

Use the automationConfig resource to send the updated automation configuration.

Issue the following command, replacing <user@example.net> with the credentials of the global owner, <api_key> with the API key, <app-example.net> with the Ops Manager URL, and <group_id> with the group id. Replace <configuration_document> with the entire updated configuration document.

curl -u "<user@example.net>:<api_key>" -H "Content-Type: application/json" "http://<app-example.net>/api/public/v1.0/groups/<group_id>/automationConfig" --digest -i -X PUT --data '
<configuration_document>
'

Upon successful update of the configuration, the API returns the HTTP 200 OK status code to indicate the request has succeeded.

6

Confirm successful update of the automation configuration.

Retrieve the automation configuration from Ops Manager to compare it against the document you sent. Issue a command similar to the following. Replace the credentials, API key, URL, and group id as in the previous step.

curl -u "<user@example.net>:<api_key>" "http://<app-example.net>/api/public/v1.0/groups/<group_id>/automationConfig" --digest -i
7

Check the deployment status to ensure goal state is reached.

Use the automationStatus resource to retrieve the deployment status. Issue the following command, replacing the credentials, API key, URL, and group id as in previous steps.

curl -u "<user@example.net>:<api_key>" "http://<app-example.net>/api/public/v1.0/groups/<group_id>/automationStatus" --digest -i

Confirm that the values of all the lastGoalVersionAchieved fields in the processes array match the goalVersion field. For more information on deployment status, see Automation Status.

To view the new configuration in the Ops Manager web interface, select the Deployment tab and then the Deployment page.