Upgrading MongoDB
To upgrade PingIntelligence, you must upgrade MongoDB from version 4.2 to 4.4 before proceeding to upgrade MongoDB to version 5.0.
Before you begin
-
Upgrading MongoDB from version 4.2 to 5.0 is a multi-step process. Before performing any upgrades, it’s crucial to back up your MongoDB data.
-
Test that the upgraded system is working correctly with MongoDB 4.4 before upgrading to MongoDB 5.0.
-
Stop all API Behavioral Security (ABS), API Publish, and Dashboard components.
-
Ensure all replica set members are running MongoDB version 4.2.
-
Ensure the 4.2 replica set has
featureCompatibilityVersion
set to4.2
:-
Connect to each replica set member and check
featureCompatibilityVersion
using the following command:db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
-
To set or update
featureCompatibilityVersion
, run the following command on the primary:db.adminCommand( { setFeatureCompatibilityVersion: "4.2" } )
-
-
Ensure that no replica set member is in
.mongodb.com/docs/v5.3/reference/replica-states///[ROLLBACK]
or.mongodb.com/docs/v5.3/reference/replica-states///[RECOVERING]
state by running thers.status() command
command in the primary. -
Prior to upgrading a member of the replica set, confirm that the member was cleanly shut down.
-
Make sure that the
abs_rs.js
file has actual MongoDB IPs (instead oflocalhost/127.0.0.1
) for the replica set members.
About this task
To upgrade MongoDB version 4.2 to 5.0:
Steps
-
Upgrade secondary members of the replica set:
-
Shutdown the secondary
mongo
instance. -
https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.4.15.tgz
mongo
build] and untar it. -
Replace the 4.2 binary with the 4.4 binary.
-
Restart the member.
-
-
To step down the primary and force an election of a new primary, connect a
.mongodb.com/docs/v5.3/reference/program/mongod///[mongod]
shell to the primary and use.mongodb.com/docs/v5.3/reference/method/rs.stepDown///[rs.stepDown()]
. -
When
.mongodb.com/docs/v5.3/reference/method/rs.status///[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
.mongodb.com/docs/v5.3/reference/program/mongod///[mongod]
binary with the 4.4 binary. -
Restart the member.
-
-
To enable backwards-incompatible 4.4 features, run the
setFeatureCompatibilityVersion
command on the primary in the admin database:db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } )
-
Repeat the prerequisites and steps 1-4 to upgrade from 4.4.15 to 5.0.18.
Next steps
Complete the steps in Migrating MongoDB from RHEL 7.9 to 8.