Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Installation

Debian or Ubuntu:

All recent versions of Debian-derived distributions come with suitable MongoDB packages. Use sudo or su to become the root user, then run the following command:

Code Block
themeEmacs
apt-get install mongodb-clients mongodb-server

Installing the mongodb-server package will result in a working, automatically started MongoDB with no authentication.

Other Systems:

Download MongoDB from the Website at http://www.mongodb.org/downloads (version 2.2.3 was latest at the time of writing this so the examples are using the 64-bit version of this release)

Code Block
curl http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.2.3.tgz -o mongodb-linux-x86_64-2.2.3.tgz
tar xvf mongodb-linux-x86_64-2.2.3.tgz
mv mongodb-linux-x86_64-2.2.3 /usr/local/
cd /usr/local/
ln -s mongodb-linux-x86_64-2.2.3 mongodb
ln -s mongodb/bin/mongo bin/mongo 

 

Opmantek Setup for MongoDB

For Debian-derived distributions the default configuration is fine, but you might still want to adjust the database storage area. The configuration file is /etc/mongodb.conf, and the init script is in /etc/init.d/mongodb.

For other systems, check that the location in the provided init script is where you want the database to store its files (the default is mongodbpath=/var/mongodb for the original version): 

Code Block
vi /usr/local/opmantek/install/mongod.init.d

### you will see 
### two suggestions provided

mongodbpath=/var/mongodb
## mongodbpath=/data/mongodb   

After you have the location you prefer, the next set of commands will put a start-up script in the correct location, register the script and then start mongo (before doing this make sure to consider how much data you plan to store.  Each application has different needs and how you plan to use the application will have an enormous impact on the space required by the database).  The last command here starts MongoDB, the first time it runs it can take some time to do its pre-allocation of database and journal files.  This will depend on the performance of your storage.

Code Block
themeEmacs
# as root
cp /usr/local/opmantek/install/mongod.init.d /etc/init.d/mongod
chkconfig mongod on
service mongod start

If this is a Debian-derived system and you made config changes, then your mongod will already be running and you need to restart it like this:

Code Block
#use su or sudo to become root
service mongodb restart
# or /etc/init.d/mongodb restart
# or invoke-rc.d mongodb restart

 

Configure MongoDB Authentication

Load the mongo CLI, create the user for the admin DB, authenticate, then do the same for the NMIS db (change the username and password to your liking):

Code Block
mongo 
Code Block
use admin;
db.addUser("opUserRW","op42flow42");
db.auth("opUserRW","op42flow42"); 

use nmis;
db.addUser("opUserRW","op42flow42");
db.auth("opUserRW","op42flow42"); 
   

NB: Now make sure that the user/pass matches the config in opCommon.nmis.

Code Block
'database' => {
 'db_server' => 'localhost',
 'db_port' => '27017',
 'db_name' => 'nmis',
 'db_username' => 'opUserRW',
 'db_password' => 'op42flow42'
 },

 

If you don't require authentication simply skip the steps above and set the username in the configuration file to ''

Code Block
# to disable authentication
 'db_username' => '',