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:
...
Minimum releases for MongoDB 4.2:
- 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 | ||
---|---|---|
| ||
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 | ||
---|---|---|
| ||
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 | ||
---|---|---|
| ||
{ "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 | ||
---|---|---|
| ||
mongo -u <YOUR USERNAME> -p <YOUR PASSWORD> --authenticationDatabase=admin --quiet --eval 'db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )'
{ "featureCompatibilityVersion" : "4.0", "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.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 | ||
---|---|---|
| ||
mongo -u <YOUR USERNAME> -p <YOUR PASSWORD> --authenticationDatabase=admin --quiet --eval 'db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )'
{ "featureCompatibilityVersion" : "4.2", "ok" : 1 } |
...