Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Following the release notes for MongoDB you must upgrade to each version of MongoDB along the way.

NOTE: All Linux Commands in this document are run at root level: you need access to root via su or sudo -i

This document will follow the MongoDB upgrade path from 3.4 → 3.6 → 4.0 → 4.2, with the document structured as follows:

...

Table of Contents

Table of Contents

...


Prerequisites for Upgrading MongoDB 3.4 to MongoDB 4.2

As MongoDB 3.4 is out of support customers are wanting to upgrade their NMIS installation to newer in support releases. This document outlines the process to bring MongoDB up to version 4.2. There are a series of pre-requisites prerequisites that determine the type of update required. This document outlines the process for MongoDB Standalone.

There are 4 pre-requisites prerequisites to confirm:

  • Operating System
  • MongoDB Version
  • MongoDB Storage Engine
  • NMIS and Modules for Mongo 4.2

...

https://www.mongodb.com/docs/v4.2/tutorial/change-standalone-wiredtiger/

Upgrade NMIS and Modules for Mongo 4.2

NMIS and Modules should must be updated to versions that support MongoDB v4.2 before upgrading MongoDB to v4.2. These releases are backwards compatible with MongoDB v3.4.

Minimum releases for MongoDB 4.2 are:

  • nmis9 NMIS 9.4.0
  • opAddress 2.2.0
  • opCharts 4.4.0
  • opConfig 4.4.0
  • opEvents 4.2.0
  • opHA 3.5.0

...

You should follow the standard upgrade process for each of these packages, which is handled by the The Opmantek Installer#StartingtheInstallerInstaller.

Preparation

The preparation phase includes 3 sections

...

  • Full system backups, including Operating System and Data - Contact your IT deptdepartment, 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/

...

Code Block
titleExample Command and Output
mongo -u <YOUR USERNAME> -p <YOUR PASSWORD> --authenticationDatabase=admin --quiet --eval 'db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )'

{ "featureCompatibilityVersion" : "3.4", "ok" : 1 }

...

Complete the upgrade with the following commands and retest. If you skip the stop/start sequence above the following will set command will fail.

Code Block
mongo -u <YOUR USERNAME> -p <YOUR PASSWORD> --authenticationDatabase=admin --quiet --eval 'db.adminCommand( { setFeatureCompatibilityVersion: "3.6" } )'
mongo -u <YOUR USERNAME> -p <YOUR PASSWORD> --authenticationDatabase=admin --quiet --eval 'db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )'
systemctl stop mongod
systemctl start mongod

...

Code Block
titleExample Command and Output
mongo -u <YOUR USERNAME> -p <YOUR PASSWORD> --authenticationDatabase=admin --quiet --eval 'db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )'

{ "featureCompatibilityVersion" : "3.6", "ok" : 1 }

...

Complete the upgrade with the following commands and retest. If you skip the stop/start sequence above the following will set command will fail.

Code Block
mongo -u <YOUR USERNAME> -p <YOUR PASSWORD> --authenticationDatabase=admin --quiet --eval 'db.adminCommand( { setFeatureCompatibilityVersion: "4.0" } )'
mongo -u <YOUR USERNAME> -p <YOUR PASSWORD> --authenticationDatabase=admin --quiet --eval 'db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )'
systemctl stop mongod
systemctl start mongod

...

Code Block
titleExample Command and Output
{ "featureCompatibilityVersion" : "4.0", "ok" : 1 }mongo -u <YOUR USERNAME> -p <YOUR PASSWORD> --authenticationDatabase=admin --quiet --eval 'db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )'

{ "featureCompatibilityVersion" : "4.0", "ok" : 1 }

Upgrade from MongoDB 4.0 to MongoDB 4.2

...

The result should be as follows ensuring that the value 34.6 0 is set

Code Block
{ "featureCompatibilityVersion" : "4.0", "ok" : 1 }

...

Code Block
titleExample Command and Output
mongo -u <YOUR USERNAME> -p <YOUR PASSWORD> --authenticationDatabase=admin --quiet --eval 'db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )'

{ "featureCompatibilityVersion" : "4.0", "ok" : 1 }

...

Code Block
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.02 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
sudo apt-get update
sudo apt-get upgrade -y
systemctl stop mongod
systemctl start mongod
systemctl daemon-reload
systemctl is-active mongod

Complete the upgrade with the following commands and retest. If you skip the stop/start sequence above the following will set command will fail.

Code Block
mongo -u <YOUR USERNAME> -p <YOUR PASSWORD> --authenticationDatabase=admin --quiet --eval 'db.adminCommand( { setFeatureCompatibilityVersion: "4.2" } )'
mongo -u <YOUR USERNAME> -p <YOUR PASSWORD> --authenticationDatabase=admin --quiet --eval 'db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )'
systemctl stop mongod
systemctl start mongod

...

Code Block
titleExample Command and Output
mongo -u <YOUR USERNAME> -p <YOUR PASSWORD> --authenticationDatabase=admin --quiet --eval 'db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )'

{ "featureCompatibilityVersion" : "4.2", "ok" : 1 }

...