Docs Home → Develop Applications → MongoDB Manual
Upgrade a Replica Set to 4.4![](/docs/v6.0/assets/link.svg)
On this page
Warning
When upgrading a MongoDB 4.2-series deployment containing MongoDB 3.0 metadata to a 4.4-series deployment, you must upgrade to MongoDB 4.4.1 or later. You cannot successfully upgrade a deployment containing MongoDB 3.0 metadata to MongoDB 4.4.0 without serious risk of downtime.
For more information, see WT-6623.
Familiarize yourself with the content of this document, including thoroughly reviewing the prerequisites, prior to upgrading to MongoDB 4.4.
If you need guidance on upgrading to 4.4, MongoDB professional services offer major version upgrade support to help ensure a smooth transition without interruption to your MongoDB application.
Upgrade Recommendations and Checklists![](/docs/v6.0/assets/link.svg)
When upgrading, consider the following:
Upgrade Version Path![](/docs/v6.0/assets/link.svg)
To upgrade an existing MongoDB deployment to 4.4, you must be running a 4.2-series release.
To upgrade from a version earlier than the 4.2-series, you must successively upgrade major releases until you have upgraded to 4.2-series. For example, if you are running a 4.0-series, you must upgrade first to 4.2 before you can upgrade to 4.4.
Check Driver Compatibility![](/docs/v6.0/assets/link.svg)
Before you upgrade MongoDB, check that you're using a MongoDB 4.4-compatible driver. Consult the driver documentation for your specific driver to verify compatibility with MongoDB 4.4.
Upgraded deployments that run on incompatible drivers might encounter unexpected or undefined behavior.
Warning
If your drivers use legacy opcodes that were deprecated in v3.6, update your drivers to a version that uses supported opcodes. Drivers that use legacy opcodes are no longer supported.
Preparedness![](/docs/v6.0/assets/link.svg)
Before beginning your upgrade, see the Compatibility Changes in MongoDB 4.4 document to ensure that your applications and deployments are compatible with MongoDB 4.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![](/docs/v6.0/assets/link.svg)
Once upgraded to 4.4, if you need to downgrade, we recommend downgrading to the latest patch release of 4.2.
Warning
Downgrade Floor
If you need to downgrade from version 4.4, downgrade to 4.2.6 or a later version. You cannot downgrade to 4.2.5 or an earlier version.
Prerequisites![](/docs/v6.0/assets/link.svg)
All Members Version![](/docs/v6.0/assets/link.svg)
All replica set members must be running version 4.2. To upgrade a replica set from an 4.0-series and earlier, first upgrade all members of the replica set to the latest 4.2-series release, and then follow the procedure to upgrade from MongoDB 4.2 to 4.4.
Confirm Clean Shutdown![](/docs/v6.0/assets/link.svg)
Prior to upgrading a member of the replica set, confirm that the member was cleanly shut down.
Feature Compatibility Version![](/docs/v6.0/assets/link.svg)
The 4.2 replica set must have
featureCompatibilityVersion
set to "4.2"
.
To ensure that all members of the replica set have
featureCompatibilityVersion
set to "4.2"
, connect to each
replica set member and check the featureCompatibilityVersion
:
db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
All members should return a result that includes
"featureCompatibilityVersion" : { "version" : "4.2" }
.
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: "4.2" } )
For more information, see
setFeatureCompatibilityVersion
.
Replica Set Member State![](/docs/v6.0/assets/link.svg)
Ensure that no replica set member is in ROLLBACK
or
RECOVERING
state.
Download 4.4 Binaries![](/docs/v6.0/assets/link.svg)
Via Package Manager![](/docs/v6.0/assets/link.svg)
If you installed MongoDB from the MongoDB apt
, yum
, dnf
, or
zypper
repositories, you should upgrade to 4.4 using your package
manager.
Follow the appropriate 4.4 installation instructions for your Linux system. This will involve adding a repository for the new release, then performing the actual upgrade process.
Manually![](/docs/v6.0/assets/link.svg)
If you have not installed MongoDB using a package manager, you can manually download the MongoDB binaries from the MongoDB Download Center.
See 4.4 installation instructions for more information.
Upgrade Process![](/docs/v6.0/assets/link.svg)
Warning
If you upgrade an existing instance of MongoDB to MongoDB
4.4.19, that instance may fail to start if fork: true
is
set in the mongod.conf
file.
The upgrade issue affects all MongoDB instances that use .deb
or
.rpm
installation packages. Installations that use the tarball
(.tgz
) release or other package types are not affected. For more
information, see SERVER-74345.
To remove the fork: true
setting, run these commands from a system
terminal:
systemctl stop mongod.service sed -i.bak '/fork: true/d' /etc/mongod.conf systemctl start mongod.service
The second systemctl
command starts the upgraded instance after the
setting is removed.
You can upgrade from MongoDB 4.2 to 4.4 using a "rolling" upgrade to minimize downtime by upgrading the members individually while the other members are available.
Step down the replica set primary.![](/docs/v6.0/assets/link.svg)
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.![](/docs/v6.0/assets/link.svg)
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 4.4 binary.Restart the member.
Enable backwards-incompatible 4.4 features.![](/docs/v6.0/assets/link.svg)
At this point, you can run the 4.4 binaries without the 4.4 features that are incompatible with 4.2.
To enable these 4.4 features, set the feature compatibility
version (fCV
) to 4.4.
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: "4.4" } )
Setting featureCompatibilityVersion (fCV) : "4.4"
implicitly performs a replSetReconfig
to add the
term
field to the configuration document and blocks
until the new configuration propagates to a majority of replica
set members.
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![](/docs/v6.0/assets/link.svg)
To upgrade a standalone, see Upgrade a Standalone to 4.4.
To upgrade a sharded cluster, see Upgrade a Sharded Cluster to 4.4.