Fix This Page
Navigation

Upgrade a Replica Set to 3.4

Package Updates required on Ubuntu 16.04 for IBM POWER Systems

Due to a lock elision bug present in older versions of the glibc package on Ubuntu 16.04 for POWER, you must upgrade the glibc package to at least glibc 2.23-0ubuntu5 before running MongoDB. Systems with older versions of the glibc package will experience database server crashes and misbehavior due to random memory corruption, and are unsuitable for production deployments of MongoDB

Important

Before you attempt any upgrade, please familiarize yourself with the content of this document.

If you need guidance on upgrading to 3.4, MongoDB offers major version upgrade services to help ensure a smooth transition without interruption to your MongoDB application.

Upgrade Recommendations and Checklists

When upgrading, consider the following:

Upgrade Version Path

To upgrade an existing MongoDB deployment to 3.4, you must be running a 3.2-series release.

To upgrade from a version earlier than the 3.2-series, you must successively upgrade major releases until you have upgraded to 3.2-series. For example, if you are running a 3.0-series, you must upgrade first to 3.2 before you can upgrade to 3.4.

Preparedness

Before beginning your upgrade, see the Compatibility Changes in MongoDB 3.4 document to ensure that your applications and deployments are compatible with MongoDB 3.4. Resolve the incompatibilities in your deployment before starting the upgrade.

Before upgrading MongoDB, always test your application in a staging environment before deploying the upgrade to your production environment.

Downgrade Consideration

Once upgraded to 3.4, you cannot downgrade to a 3.2.7 or earlier version. You can only downgrade to a 3.2.8 or later version.

Warning

Avoid reconfiguring replica sets that contain members of different MongoDB versions as validation rules may differ across MongoDB versions.

Prerequisites

To upgrade a replica set to 3.4, all replica set members must be running version 3.2. To upgrade a replica set from an earlier MongoDB version, upgrade all members of the replica set to the latest 3.2-series release first, and then follow the procedure to upgrade from MongoDB 3.2 to 3.4.

Download 3.4 Binaries

Via Package Manager

If you installed MongoDB from the MongoDB apt, yum, dnf, or zypper repositories, you should upgrade to 3.4 using your package manager.

Follow the appropriate installation instructions for your Linux system. This will involve adding a repository for the new release, then performing the actual upgrade process.

Manually

If you have not installed MongoDB using a package manager, you can manually download the MongoDB binaries from the MongoDB Download Center.

See Install MongoDB for more information.

Upgrade Process

You can upgrade from MongoDB 3.2 to 3.4 using a “rolling” upgrade to minimize downtime by upgrading the members individually while the other members are available:

1

Upgrade secondary members of the replica set.

Upgrade the secondary members of the replica set one at a time:

  • Shut down the mongod instance and replace the 3.2 binary with the 3.4 binary.
  • Restart the member and wait for the member to recover to SECONDARY state before upgrading the next secondary member. To check the member’s state, issue rs.status() in the mongo shell.
2

Step down the replica set primary.

Connect a mongo shell to the primary and use rs.stepDown() to step down the primary and force an election of a new primary.

3

Upgrade the primary.

When rs.status() shows that the primary has stepped down and another member has assumed PRIMARY state, upgrade the stepped-down primary:

  • Shut down the stepped-down primary and replace the mongod binary with the 3.4 binary.
  • Restart.
4

Enable backwards-incompatible 3.4 features.

At this point, you can run the 3.4 binaries without the 3.4 features that are incompatible with 3.2.

To enable these 3.4 features, set the feature compatibility version to 3.4.

Warning

Enabling these backwards-incompatible features can complicate the downgrade process. For details, see Remove 3.4 Incompatible Features.

It is recommended that after upgrading, you allow your deployment to run without enabling these features for a burn-in period to ensure the likelihood of downgrade is minimal. When you are confident that the likelihood of downgrade is minimal, enable these features.

On the primary, run the setFeatureCompatibilityVersion command in the admin database:

db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )

This command must perform writes to an internal system collection. If for any reason the command does not complete successfully, you can safely retry the command on the primary as the operation is idempotent.

Additional Upgrade Procedures