Debian - Process for Upgrading MongoDB 6.0 Standalone to MongoDB 7.0 Standalone
MongoDB upgrade requires that you must upgrade to each version of MongoDB along the way.
This document will follow the MongoDB upgrade path from 6.0 → 7.0, with the document structured as follows:
Prerequisites
Upgrade Preparation
Upgrade from MongoDB 6.0 to MongoDB 7.0
Services Restart
Clean-up
Notes
NOTE: All Linux commands in this document are run at root level: you need access to root via su or sudo -i
Set these two environment variables with your MongoDB admin username and password so that these script examples can be used:
# You can find your username and password with: egrep "[^_]db_username|db_password" /usr/local/omk/conf/opCommon.json
export YOUR_USERNAME=opUserRW
export YOUR_PASSWORD=t0pS3cr3tpw
showMongoFcv() {
mongosh --username $YOUR_USERNAME --password $YOUR_PASSWORD --authenticationDatabase=admin --quiet --eval "db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )"
}
setMongoFcv() {
mongosh --username $YOUR_USERNAME --password $YOUR_PASSWORD --authenticationDatabase=admin --quiet --eval "db.adminCommand( { setFeatureCompatibilityVersion: \"$1\", confirm: true } )"
}
showMongoFcv
Table of Contents
Prerequisites for Upgrading MongoDB 6.0 to MongoDB 7.0
This document outlines the process to bring MongoDB up to version 6.0. There are a series of prerequisites that determine the type of update required. This document outlines the process for MongoDB Standalone.
There are 4 prerequisites to confirm:
Operating System
MongoDB Version
MongoDB Storage Engine
NMIS and Modules for Mongo 7.0
Supported Operating Systems
MongoDB 7.0 is officially supported on the following Debian platforms:
MongoDB 7.0 supported on Debian 12 "Bookworm", Debian 11 (“Bullseye”)
MongoDB 6.0 supported on Debian 11 (“Bullseye”), Debian 10 ("Buster")
We have tested the upgrade process from MongoDB 6.0 to MongoDB 7.0 on:
Debian 11
To determine the version of Linux running on your system use the following command in a terminal session:
|
An example output of this command
|
MongoDB 6.0 Installed and Running
Verify by running (with your mongodb <username> and <password>)
This command does not do anything however, the output will show us the running shell and server that is running.
|
Result will look like below, we are looking for the MongoDB version numbers to be 6.0.x
If the versions do not match there may be an issue with your running installation and you should not proceed until this is resolved.
|
MongoDB Storage Engine
Verify storage engine by running
|
The "name" line should have "wiredTiger" in order to proceed.
|
If this mongo cli command does not work you can try the following to determine the storage engine in use
|
Example correct log output - notice the log entry declares the storage engine to be using "wiredTiger"
|
Upgrade NMIS and Modules for MongoDB 7.0
If you are already running MongoDB 6.0, then you do not need to upgrade any NMIS or Modules. The NMIS and Modules that support MongoDB 6.0 also support MongoDB 7.0. These releases are backwards compatible with MongoDB v4.2 which means that you can upgrade to NMIS and Modules that support MongoDB 6.0, restart NMIS and Modules, and continue to use them with MongoDB 4.2, then upgrade your MongoDB from 4.2 to 6.0 and then to 7.0 later.
Minimum releases that support MongoDB 6.0 and MongoDB 7.0 are:
NMIS 9.5.0
opAddress 2.4.0
opCharts 4.8.0
opConfig 4.6.0
opEvents 4.4.0
opHA 4.1.0
opReports 4.6.0
opFlow 4.1.0
You can determine the versions you are running by browsing to:
https://<yourserveraddress>/omk/
You should follow the standard upgrade process for each of these packages, which is handled by the FirstWave Installer.
Preparation
The preparation phase includes 3 sections
System Snapshot/Backup
Upgrade Linux to latest stable release packages
Shutdown all OMK Daemons
This is to be done in this specific sequence.
System Snapshot/Backup
For System Snapshots and Backups you will need to refer to the documentation for your environment.
If the information on your system, or stability of the system is critical to your business it is important to retain a working backup. It is important that you have confirmed that your backups can be restored.
Options:
Full system backups, including Operating System and Data - Contact your IT department, Vendor Support, or Integrator
Virtual Machine Snapshots - Refer to the solution guides for the environment
Database Dump - MongoDB documentation: https://www.mongodb.com/docs/database-tools/mongodump/
Upgrade Linux Packages
After completing the snapshot/backup follow Debian's instructions for upgrading and checking the sanity of the apt package system.
An example of the update/upgrade cycle is as follows:
|
This command will execute all outstanding upgrades. Check for any errors and address as required.
Once this step is completed you may optionally reboot the system. This can clear out any memory leaks and instabilities in the system that occur due to long uptimes.
Shutdown All FirstWave Daemons
Prior to commencing into the MongoDB upgrade cycles it is required to shutdown all FirstWave processes.
The following commands are used to complete this task
|
Example Command and Output
|
Upgrade from MongoDB 6.0 to MongoDB 7.0
Prepare the Database for Upgrade
Check the database compatibility mode is set to "6.0"
|
The result should be as follows ensuring that the value 6.0 is set
|
If MongoDB is on version 6.0 and the featureCompatibilityVersion is not "6.0" then set this with the following command
|
As before, check the featureCompatibilityVersion again confirming the correct value
Example Command and Output
|
Debian - Install MongoDB 7.0 Repo and Upgrade
Details available here:
https://www.mongodb.com/docs/manual/release-notes/7.0-upgrade-standalone/ and https://www.mongodb.com/docs/v7.0/tutorial/install-mongodb-on-debian/
Commands summarised here:
|
Complete the upgrade with the following commands and retest. If you skip the stop/start sequence above the following command will fail.
Note that once you have upgraded to 7.0, you will not be able to downgrade FCV and binary version without support assistance from MongoDB.
|
As before, check the featureCompatibilityVersion output from above is "7.0"
Example Command and Output
|
This completes the in-situ upgrade of MongoDB 6.0 to 7.0 Standalone
Restart All FirstWave Daemons
Now the MongoDB upgrade is complete, you can start all the NMIS and FirstWave daemons.
The following commands are used to complete this task
|
You can now browse to your FirstWave instance with:
https://<yourserver>/omk
You will get a screen similar to the following which will give you a status on all installed modules:
You can use http://<yourserver>/omk/opCore/dbinfo to show Database Information, including MongoDB Version.