How to Upgrade MongoDB from v3.6 to v4.4
Contents
Upgrade MongoDB from v3.6 to v4.0
Upgrade MongoDB from v4.0 to v4.2
Upgrade MongoDB from v4.2 to v4.4
Objective
This article introduces how to upgrade MongoDB from v3.6 to v4.4 on a Linux System.
Requirements
- Ubuntu 20.04
- Omada Software Controller
- MongoDB
Introduction
Since version 5.14, Omada Software Controller supports MongoDB up to v7. Here, we take Ubuntu 20.04 as an example to show the configurations for upgrading MongoDB from v3.6 to v4.4.
Configuration
Upgrade MongoDB from v3.6 to v4.0
Step 1. Backup database and uninstall Controller
sudo dpkg –r omadac

Choose yes to confirm.

Choose yes to confirm.

Note:
The backup db file will be restored in /opt/tplink/omada_db_backup. Back up the db.tar.gz file to another folder so you can restore it once a failure happens.

Step 2. Uninstall MongoDB.
sudo apt remove mongodb*
Type y to continute.

sudo apt autoremove
Type y to continue.

If you don’t have file mongodb-org-3.6.list in your folder /etc/apt/sources.list.d, you can skip this step:
sudo rm /etc/apt/sources.list.d/mongodb-org-3.6.list

Step 3. Install MongoDB v4.0
Go to https://www.mongodb.com/try/download/community-edition/releases/archive and download the following packages:

Here, we choose to download them to the folder /Downloads:

Go to /Downloads.
sudo dpkg -i mongodb-org-mongos_4.0.28_amd64.deb mongodb-org-server_4.0.28_amd64.deb mongodb-org-shell_4.0.28_amd64.deb mongodb-org-tools_4.0.28_amd64.deb

Step 4. Reinstall Omada Controller.
Go to the folder where the deb file exists.
sudo dpkg -i omada_v5.14.26.1_linux_x64_20240621095737.deb

Choose yes to confirm.

The controller will restore the data in the db file.

Step 5. Change the FeatureCompatibilityVersion
When the Controller starts up successfully, run the command
mongo –port 27217

db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )

db.adminCommand( { setFeatureCompatibilityVersion: "4.0" } )

db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )

Step 6. input exit to quit

Upgrade MongoDB from v4.0 to v4.2
Step 1. Backup database and uninstall Controller
sudo dpkg –r omadac

Choose yes to confirm.

Choose yes to confirm.

Note: the backup db file will be restored in /opt/tplink/omada_db_backup. Back up the db.tar.gz file to another folder so you can restore it once a failure happens.

Step 2. Uninstall MongoDB.
Go to /Downloads
sudo dpkg -r mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools

Step 3. Install MongoDB v4.2
curl -fsSL https://pgp.mongodb.com/server-4.2.asc | I am running a few minutes late; my previous meeting is running over.
sudo gpg -o /usr/share/keyrings/mongodb-server-4.2.gpg \
--dearmor

echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-4.2.gpg ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list

sudo apt-get update

sudo apt-get install -y mongodb-org

Step 4. Reinstall Omada Controller.
Go to the folder where the deb file exists.
sudo dpkg -i omada_v5.14.26.1_linux_x64_20240621095737.deb

Choose yes to confirm.

The controller will restore the data in the db file.

Step 5. Change the FeatureCompatibilityVersion
When the Controller starts up successfully.
mongo –port 27217

db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )

db.adminCommand( { setFeatureCompatibilityVersion: "4.2" } )

db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )

Step 6. input exit to quit

Upgrade MongoDB from v4.2 to v4.4
Step 1. Backup database and uninstall Controller
sudo dpkg –r omadac

Choose yes to confirm.

Choose yes to confirm.

Note: the backup db file will be restored in /opt/tplink/omada_db_backup. Back up the db.tar.gz file to another folder so you can restore it once a failure happens.

Step 2. Uninstall MongoDB.
sudo apt remove mongodb-org*

Type y to continue.

sudo rm /etc/apt/sources.list.d/mongodb-org-4.2.list

Step 3. Install MongoDB v4.4
curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-4.4.gpg \
--dearmor

echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-4.4.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list

sudo apt-get update

sudo apt-get install -y mongodb-org

Step 4. Reinstall Omada Controller.
Go to the folder where the deb file exists.
sudo dpkg -i omada_v5.14.26.1_linux_x64_20240621095737.deb

Choose yes to confirm.

The controller will restore the data in the db file.

Step 5. Change the FeatureCompatibilityVersion
When the Controller starts up successfully, run the command
mongo –port 27217

db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )

db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } )

db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )

Step 6. input exit to quit

Conclusion
Now, you have upgraded your MongoDB v3.6 to v4.4.