MongoDB Installation
What is MongoDB?
MongoDB is a free and open-source big-data document database that stores data in flexible, JSON-like documents. FirstWave chose MongoDB as our back-end database because it is fast and reliable, all with relatively low overhead.
Which MongoDB version should be used?
Please see our Product Compatibility page for details regarding what product releases work (best) with which MongoDB versions.
Installing MongoDB
The installer in our product releases offers to install the latest supported version of MongoDB for you if none is present on your server, and no manual configuration should be required.
Upgrading MongoDB
Step by step procedures for upgrading MongoDB from 3.4 to 4.2 are available Upgrading to MongoDB 4.2
Step by step procedures for upgrading MongoDB from 4.2 to 6.0 are available Upgrading to MongoDB 6.0
Configuring MongoDB Authentication/Authorization with the setup_mongodb.pl Script
All FirstWave applications that require MongoDB ship with a configuration tool for MongoDB, named bin/setup_mongodb.pl
. It's recommended that you use this tool for setting up MongoDB authentication, as it can deal with separate per-product MongoDB instances and simplifies the procedure substantially. The relevant product installers already offer to run the tool during installation and upgrades, hence you rarely need to run it manually.
To use the tool manually, simply run it as root and follow the prompts (if any):
$ sudo /usr/local/omk/bin/setup_mongodb.pl setup_mongodb.pl version 1.0.3 Reading configuration file /usr/local/omk/conf/opCommon.nmis... Checking authentication status for db_server localhost... MongoDB on localhost:27017 is running in non-authenticated mode. INFO: adding user opUserRW to database admin INFO: adding user opUserRW to database nmis INFO: adding user opUserRW to database optrend ...
If required the tool will prompt you for database credentials and advise on remote-vs-local operation, as well as authenticated-vs-nonauthenticated modes. The MongoDB setup helper can be run repeatedly with no adverse effects.
See how authentication is enabled in this mongod.conf on the NMIS9 VM that we ship.
See 'security:' >>' authorization: enabled':
net: bindIp: 127.0.0.1 port: 27017 processManagement: fork: true pidFilePath: /var/run/mongodb/mongod.pid security: authorization: enabled storage: dbPath: /data/mongo journal: enabled: true wiredTiger: engineConfig: cacheSizeGB: 1.7 systemLog: destination: file logAppend: true logRotate: reopen path: /var/log/mongodb/mongod.log
See paragraph Setting cacheSizeGB appropriately when MongoDB table type is wiredtiger (the default)
in this wiki page:
Reducing a Server's Memory Footprint when OMK applications are installed
for the calculation we use to calculate 'cacheSizeGB: 1.7' in the above mongod.conf file.
Resetting Databases with the setup_mongodb.pl Script
Should you want to reset one or more product databases to their initial empty state, you will need version 2.54 (or newer) of setup_mongodb.pl
. With that version you may pass the extra arguments "drop=<dbname1>,<dbname2> confirm=YES", and setup_mongodb
will completely empty the named databases. Please note that this is an irrevocable operation and may lead to substantial data loss if you pick the wrong database to drop!
You can find the database names in the standard configuration file conf/opCommon.nmis
, under the keys <product>_db_name
and db_name
.
Please note that the database named by the key db_name
(default name: "nmis
") is shared and used by multiple products and therefore dropping this database would affect multiple products!
Deprecated - Historic Installation Instructions
As of September 2015 the installation instructions below are no longer applicable; the installer will take care of installation and initial configuration of MongoDB for you.