Upgrade to MongoDB Enterprise (Sharded Cluster)
On this page
MongoDB Enterprise provides various features not available in the MongoDB Community edition, such as:
The following steps outline the procedure to upgrade a sharded cluster from the MongoDB Community Edition to the MongoDB Enterprise Edition. For example, the steps can be used to upgrade MongoDB 7.0 Community to MongoDB 7.0 Enterprise.
Before You Begin
Starting in MongoDB 8.0, you can use the
directShardOperations
role to perform maintenance operations
that require you to execute commands directly against a shard.
Warning
Running commands using the directShardOperations
role can cause
your cluster to stop working correctly and may cause data corruption.
Only use the directShardOperations
role for maintenance purposes
or under the guidance of MongoDB support. Once you are done
performing maintenance operations, stop using the
directShardOperations
role.
About This Task
Upgrade Major Releases
Warning
Do not use these instructions to upgrade to another release version. To upgrade release versions, refer to the appropriate release upgrade instructions, such as Upgrade to MongoDB 8.0.
Ops Manager
With Ops Manager, you can automatically upgrade from MongoDB Community Server to MongoDB Enterprise Server.
For more information, see Change MongoDB Version.
Rolling Upgrades
When updating the sharded clusters manually, you can perform a rolling upgrade on the shard replica sets and config servers to update each MongoDB Community Server to Enterprise edition with minimal downtime.
In a rolling upgrade, each secondary is taken down and upgraded. The Enterprise server rejoins the replica set as a secondary. When all secondaries are upgraded, you can step down the primary, forcing the replica set to elect one of the Enterprise servers as the new primary.
Steps
To minimize downtime, manually upgrade each from MongoDB Community Server to Enterprise Edition:
Stop the balancer
During an upgrade, the balancer should not attempt to redistribute data between the shards. To prevent the balancer from attempting to redistribute data, stop the balancer for the duration of the upgrade.
To stop the balancer, connect to mongos
and run
the sh.stopBalancer()
method:
sh.stopBalancer()
If a balancing round is in progress, the operation waits for balancing to complete.
To confirm that the balancer is stopped, use the
sh.getBalancerState()
method:
sh.getBalancerState()
false
The command returns false
when the balancer is stopped.
Upgrade the config servers
Perform a rolling upgrade of the config servers.
For the procedure, see Upgrade a Replica Set to MongoDB Enterprise.
Upgrade the shards
Perform a rolling upgrade on each shard.
For the procedure, see Upgrade a Replica Set to MongoDB Enterprise.
Upgrade routers (mongos)
Perform a rolling upgrade of the mongos
instances from the Community installation to Enterprise.
Connect to
mongos
and stop the router process:db.getSiblingDB("admin").shutdownServer() If you installed
mongos
with a package manager on Linux, you must remove the existing packages before you install the Enterprisemongos
To remove the Community
mongos
:To remove the Community
mongos
from RHEL, CentOS, Alma Linux, Oracle, Rocky, and Amazon Linux, run the following command:sudo dnf remove mongodb-mongos To remove the Community
mongos
from Ubuntu and Debian, run the following command:sudo apt remove mongodb-mongos To remove the Community
mongos
from SUSE Enterprise Linux, run the following command:sudo zypper remove mongodb-mongos Depending on your operating system, you can install the MongoDB Enterprise binaries by using a package manager or by downloading the binaries manually.
If you have installed MongoDB Community using a package manager, follow the package manager instructions for your operating system:
If you have not installed MongoDB using a package manager, you can manually download the MongoDB binaries from the MongoDB Download Center. Follow the manual instructions, including specific prerequisites for MongoDB Enterprise, for your operating system:
Important
Install to a location different from that of your current Community edition.
In the upgrade procedure, you will use the existing data directory and, if applicable, the existing configuration file.
Important
You cannot use the
.msi
to install the Enterprise edition if you have the Community edition of the same release series installed on the same machine. That is, if you have version 4.4.0 Community edition installed, you cannot use the.msi
to install the 4.4.0 or 4.4.1 Enterprise edition.Manually download the archive file from the MongoDB Download Center.
To install, extract/unzip the file to a location different from that of your current Community edition.
In the upgrade procedure, you will use the existing data directory and, if applicable, the existing configuration file.
Install the binaries:
Manually download the archive file from the MongoDB Download Center.
Extract the files to a location different from that of your current Community edition. For details on extracting the files, see macOS.
In the upgrade procedure, you will use the existing data directory and, if applicable, the existing configuration file.
To start the router, run Enterprise
mongos
with the same configuration as you used for the Communitymongos
.For example:
sudo mongos --config /etc/mongos.conf
Restart the balancer
To restart the balancer, connect to mongos
and
use the sh.startBalancer()
method:
sh.startBalancer()
To confirm that the balancer is running, use the
sh.getBalancerState()
method:
sh.getBalancerState()
true
The command returns true
when the balancer is running.
Important
Before using any Enterprise features, ensure that all members have been upgraded to Enterprise edition.