Upgrade a Replica Set to 3.6
On this page
Note
MongoDB 3.6 is not tested on APFS, the new filesystem in macOS 10.13 and may encounter errors.
Starting in MongoDB 3.6.13, MongoDB 3.6-series removes support for Ubuntu 16.04 PPCLE.
For earlier MongoDB Enterprise versions that support Ubuntu 16.04 POWER/PPC64LE:
Due to a lock elision bug present in older versions of the
glibc
package on Ubuntu 16.04 for POWER, you must upgrade theglibc
package to at leastglibc 2.23-0ubuntu5
before running MongoDB. Systems with older versions of theglibc
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.6, MongoDB professional services offer major version upgrade support 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.6, you must be running a 3.4-series release.
To upgrade from a version earlier than the 3.4-series, you must successively upgrade major releases until you have upgraded to 3.4-series. For example, if you are running a 3.2-series, you must upgrade first to 3.4 before you can upgrade to 3.6.
Check Driver Compatibility
Before you upgrade MongoDB, check that you're using a MongoDB 3.6-compatible driver. Consult the driver documentation for your specific driver to verify compatibility with MongoDB 3.6.
Upgraded deployments that run on incompatible drivers might encounter unexpected or undefined behavior.
Preparedness
Before beginning your upgrade, see the Compatibility Changes in MongoDB 3.6 document to ensure that your applications and deployments are compatible with MongoDB 3.6. 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
Starting in MongoDB 7.0, you cannot downgrade your deployment's binary version without assistance from support.
To learn more, see Downgrade 7.0 to 6.0.
Default Bind to Localhost
Starting in MongoDB 3.6, mongod
and mongos
instances bind to localhost by default. Remote clients, including other
members of the replica set, cannot connect to an instance bound only to
localhost. To override and bind to other ip addresses, use the
net.bindIp
configuration file setting or the --bind_ip
command-line option to specify a list of ip addresses.
The upgrade process will require that you specify the
net.bindIp
setting (or --bind_ip
) if your replica set
members are run on different hosts or if you wish remote clients to
connect to your replica set.
Warning
Before you bind your instance to a publicly-accessible IP address, you must secure your cluster from unauthorized access. For a complete list of security recommendations, see Security Checklist. At minimum, consider enabling authentication and hardening network infrastructure.
For more information, see Localhost Binding Compatibility Changes
Initial Syncs
Before starting the upgrade, ensure that no initial sync is in progress. Performing the upgrade while an initial sync is in progress will cause the initial sync to restart.
Read Concern Majority
Starting in MongoDB 3.6, MongoDB enables support for "majority" read concern by default.
For MongoDB 3.6.1 - 3.6.x, you can disable read concern "majority" to prevent the storage cache pressure from immobilizing a deployment with a primary-secondary-arbiter (PSA) architecture. Disabling "majority" read concern also disables support for change streams
For more information, see Disable Read Concern Majority.
Prerequisites
- Version 3.4
- All replica set members must be running version 3.4. To upgrade a replica set from an 3.2-series and earlier, first upgrade all members of the replica set to the latest 3.4-series release, and then follow the procedure to upgrade from MongoDB 3.4 to 3.6.
- Feature Compatibility Version
The 3.4 replica set must have
featureCompatibilityVersion
set to3.4
.To ensure that all members of the replica set have
featureCompatibilityVersion
set to3.4
, connect to each replica set member and check thefeatureCompatibilityVersion
:db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } ) All members should return a result that includes
"featureCompatibilityVersion": "3.4"
.To set or update
featureCompatibilityVersion
, run the following command on the primary. A majority of the data-bearing members must be available:db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } ) For more information, see
setFeatureCompatibilityVersion
.
- Replica Set Member State
- Ensure that no replica set member is in
ROLLBACK
orRECOVERING
state.
Download 3.6 Binaries
Via Package Manager
If you installed MongoDB from the MongoDB apt
, yum
, dnf
, or
zypper
repositories, you should upgrade to 3.6 using your package
manager.
Follow the appropriate 3.6 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 3.6 installation instructions for more information.
Upgrade Process
You can upgrade from MongoDB 3.4 to 3.6 using a "rolling" upgrade to minimize downtime by upgrading the members individually while the other members are available:
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.4 binary with the 3.6 binary.Restart the member.
Important
If your replica set members are run on different hosts or if you wish remote clients to connect to your instance, you must specify the
net.bindIp
setting (or--bind_ip
). For more information, see Localhost Binding Compatibility Changes.
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.
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.6 binary.Restart the member.
Important
If your replica set members are run on different hosts or if you wish remote clients to connect to your instance, you must specify the
net.bindIp
setting (or--bind_ip
).
Enable backwards-incompatible 3.6 features.
At this point, you can run the 3.6 binaries without the 3.6 features that are incompatible with 3.4.
To enable these 3.6 features, set the feature compatibility
version (fCV
) to 3.6.
Tip
Enabling these backwards-incompatible features can complicate the downgrade process since you must remove any persisted backwards-incompatible features before you downgrade.
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.
Tip
Ensure that no initial sync is in progress. Running
setFeatureCompatibilityVersion
command while an initial
sync is in progress will cause the initial sync to restart.
On the primary, run the setFeatureCompatibilityVersion
command in the admin
database:
db.adminCommand( { setFeatureCompatibilityVersion: "3.6" } )
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
To upgrade a standalone, see Upgrade a Standalone to 3.6.
To upgrade a sharded cluster, see Upgrade a Sharded Cluster to 3.6.