How to Upgrade MongoDB from v3.6 to v4.4

Knowledgebase
Configuration Guide
03-24-2025
894

Contents

Objective

Requirements

Introduction

Configuration

Upgrade MongoDB from v3.6 to v4.0

Upgrade MongoDB from v4.0 to v4.2

Upgrade MongoDB from v4.2 to v4.4

Conclusion

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

Stop running Controller on Linux server.

Choose yes to confirm.

Uninstall Controller on Linux server.

Choose yes to confirm.

Backup Controller settings on the Linux server are in the db_backup file.

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.

The location of the backup file on the Linux server.

Step 2. Uninstall MongoDB.

sudo apt remove mongodb*

Type y to continute.

Uninstall MongoDB v3.6 on the Linux server.

sudo apt autoremove

Type y to continue.

Uninstall MongoDB’s related dependencies on the Linux server.

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

remove the file mirror path of MongoDB v3.6 from the list file.

Step 3. Install MongoDB v4.0

Go to https://www.mongodb.com/try/download/community-edition/releases/archive and download the following packages:

Download MongoDB v4.0 dpkg installation package.

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

Download the MongoDB package in a specific 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

Install MongoDB v4.0 on the Linux server with the specific dependencies command.

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

Reinstall Omada Controller on the Linux server.

Choose yes to confirm.

Import the previous backup file to the reinstalled Controller.

The controller will restore the data in the db file.

Controller will restore the data in the db_backup file.

Step 5. Change the FeatureCompatibilityVersion

When the Controller starts up successfully, run the command

mongo –port 27217

Starts command mode of MongoDB with port 27217.

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

Get the current value of FeatureCompatibilityVersion.

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

Change the FeatureCompatibilityVersion to 4.0.

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

Get the current value of FeatureCompatibilityVersion again.

Step 6. input exit to quit

Input exit to quit command mode.

Upgrade MongoDB from v4.0 to v4.2

Step 1. Backup database and uninstall Controller

sudo dpkg –r omadac

Stop running Controller on Linux server.

Choose yes to confirm.

Uninstall Controller on Linux server.

Choose yes to confirm.

Backup Controller settings on Linux server to db_backup file.

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.

The location of the db_backup file on the Linux server.

Step 2. Uninstall MongoDB.

Go to /Downloads

sudo dpkg -r mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools

Uninstall MongoDB v4.0 on the Linux server.

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

Obtain the mirror path of MongoDB v4.2.

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

Update the list file with the download link for MongoDB v4.2.

sudo apt-get update

sudo apt-get install -y mongodb-org

Install MongoDB v4.2.

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

Reinstall Omada Controller on the Linux server.

Choose yes to confirm.

Import previous db_backup file to new Controller.

The controller will restore the data in the db file.

Controller will restore the data in the db_backup file.

Step 5. Change the FeatureCompatibilityVersion

When the Controller starts up successfully.

mongo –port 27217

Start MongoDB command mode with port 27217.

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

Get the current value of FeatureCompatibilityVersion.

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

Input command to change the FeatureCompatibilityVersion to 4.2.

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

Get the current value of FeatureCompatibilityVersion.

Step 6. input exit to quit

Input exit to quit the command mode of the MongoDB tool.

Upgrade MongoDB from v4.2 to v4.4

Step 1. Backup database and uninstall Controller

sudo dpkg –r omadac

Stop running Controller on Linux server.

Choose yes to confirm.

Uninstall Controller on Linux server.

Choose yes to confirm.

Backup Controller settings on Linux server to db_backup file.

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.

The location of the db_backup file on the Linux server.

Step 2. Uninstall MongoDB.

sudo apt remove mongodb-org*

Uninstall MongoDB v4.2 on the Linux server.

Type y to continue.

Uninstall MongoDB v4.2 dependencies on the Linux server.

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

Delete MongoDB v4.2 mirror path from the list file.

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

input MongoDB v4.4 mirror path into the list file.

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

update MongoDB v4.4 mirror path.

sudo apt-get update

Update apt-get tool.

sudo apt-get install -y mongodb-org

Install MongoDB v4.4 with specific dependencies.

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

Reinstall Omada Controller on the Linux server.

Choose yes to confirm.

Import db_backup file to new Controller.

The controller will restore the data in the db file.

Controller will restore the data in the db_backup file.

Step 5. Change the FeatureCompatibilityVersion

When the Controller starts up successfully, run the command

mongo –port 27217

Start MongoDB command mode with port 27217.

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

Get the current value of FeatureCompatibilityVersion.

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

Input command to change the FeatureCompatibilityVersion.

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

Get the current value of the FeatureCompatibilityVersion.

Step 6. input exit to quit

Input exit to quit the command mode of the MongoDB tool.

Conclusion

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

Get to know more details of each function and configuration please go to Download Center to download the manual of your product. This article applies to Omada Software Controller(Linux)

Please Rate this Document

Related Documents