On this page
Upgrade a Sharded Cluster to 3.4
On this page
Note
Starting in MongoDB 3.4.21, MongoDB 3.4-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.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 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.
Prerequisites
-
- Version 3.2 or Greater
-
To upgrade a sharded cluster to 3.4, all members of the cluster must be at least version 3.2. The upgrade process checks all components of the cluster and will produce warnings if any component is running version earlier than 3.2.
-
- Config Server as Replica Set (CSRS)
-
Starting in 3.4, the use of the deprecated mirrored
mongod
instances as config servers (SCCC) is no longer supported.Before you can upgrade your sharded clusters to 3.4, you must convert your config servers from SCCC to a replica set (CSRS). To convert your config servers from SCCC to CSRS, see Upgrade Config Servers to Replica Set .
-
-
Back up the
config
Database -
Optional but Recommended. As a precaution, take a backup of the
config
database before upgrading the sharded cluster.
-
Back up the
Download 3.4 Binaries
Use 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 3.4 installation instructions for your Linux system. This will involve adding a repository for the new release, then performing the actual upgrade process.
Download 3.4 Binaries 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.4 installation instructions for more information.
Upgrade Process
Disable the Balancer.
Disable the balancer as described in Disable the Balancer.
Upgrade the config servers.
If the config servers are replica sets:
Upgrade the secondary members of the replica set one at a time:
Shut down the secondary
mongod
instance and replace the 3.2 binary with the 3.4 binary.Start the 3.4 binary with both the
--configsvr
and--port
options:mongod --configsvr --port <port> --dbpath <path>
If using a configuration file, update the file to specify
sharding.clusterRole: configsvr
andnet.port
and start the 3.4 binary:sharding: clusterRole: configsvr net: port: <port> storage: dbpath: <path>
Include any other configuration as appropriate for your deployment.
Wait for the member to recover to
SECONDARY
state before upgrading the next secondary member. To check the member’s state, issuers.status()
in themongo
shell.Repeat for each secondary member.
Step down the replica set primary.
Connect a
mongo
shell to the primary and users.stepDown()
to step down the primary and force an election of a new primary:rs.stepDown()
When
rs.status()
shows that the primary has stepped down and another member has assumedPRIMARY
state, shut down the stepped-down primary and replace themongod
binary with the 3.4 binary.Start the 3.4 binary with both the
--configsvr
and--port
options:mongod --configsvr --port <port> --dbpath <path>
If using a configuration file, update the file to specify
sharding.clusterRole: configsvr
andnet.port
and start the 3.4 binary:sharding: clusterRole: configsvr net: port: <port> storage: dbpath: <path>
Include any other configuration as appropriate for your deployment.
Upgrade the shards.
Upgrade the shards one at a time. If the shards are replica sets, for each shard:
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.Start the 3.4 binary with the
--shardsvr
and--port
command line options.mongod --shardsvr --port <port> --dbpath <path>
Of if using a configuration file, update the file to include
sharding.clusterRole: shardsvr
andnet.port
and start:sharding: clusterRole: shardsvr net: port: <port> storage: dbpath: <path>
Include any other configuration as appropriate for your deployment.
Wait for the member to recover to
SECONDARY
state before upgrading the next secondary member. To check the member’s state, you can issuers.status()
in themongo
shell.Repeat for each secondary member.
Step down the replica set primary.
Connect a
mongo
shell to the primary and users.stepDown()
to step down the primary and force an election of a new primary:rs.stepDown()
When
rs.status()
shows that the primary has stepped down and another member has assumedPRIMARY
state, upgrade the stepped-down primary:Shut down the stepped-down primary and replace the
mongod
binary with the 3.4 binary.Start the 3.4 binary with the
--shardsvr
and--port
command line options.