2.0 Installation and Initial Configuration > Connecting Moab to MongoDB

Conventions

2.3 Connecting Moab to MongoDB

Moab connects to a MongoDB database to store information for use by MWS. This feature allows MWS and Viewpoint to do very fast queries on various Moab objects without querying Moab directly.

The following instructions assume that the MongoDB server is on the same machine as Moab.

To connect Moab to MongoDB

  1. Install MongoDB.
  2. RHEL, CentOS, and Scientific Linux:

    Create a file called /etc/yum.repos.d/10gen.repo and add the following lines.

    [10gen]
    name=10gen Repository

    baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64

    gpgcheck=0

    enabled=1

    Install mongo20-10gen and mongo20-10gen-server.

    [root]# yum install mongo20-10gen mongo20-10gen-server

    SLES:

    [root]# zypper ar http://download.opensuse.org/repositories/server:/database/SLE_11_SP2 OpenSuseDatabase
    [root]# zypper install mongodb
  3. Start MongoDB.
  4. RHEL, CentOS, and Scientific Linux:

    [root]# chkconfig mongod on

    [root]# service mongod start

    SLES:

    [root]# chkconfig mongodb on

    [root]# service mongodb start

  5. Prepare the MongoDB database by doing the following:
    1. Add the required MongoDB users.

      [root]# mongo

      > use admin;

      > db.addUser("admin_user", "secret1");

      > db.auth("admin_user", "secret1");

       

      > use moab;

      > db.addUser("moab_user", "secret2");

      > db.addUser("mws_user", "secret3", true);

       

      > use mws;

      > db.addUser("mws_user", "secret3");

      Because the admin_user has read and write rights to the admin database, it also has read and write rights to all other databases. See Control Access to MongoDB Instances with Authentication for more information.

      The passwords used above (secret1, secret2, and secret3) are examples. Choose your own passwords for these users.

    2. Enable authentication in MongoDB.

      RHEL, CentOS, and Scientific Linux:

      [root]# vi /etc/mongod.conf

      ...

      auth = true

      ...

      [root]# service mongod restart

      SLES: 

      MongoDB authentication is enabled by default in SLES. To verify, check the value of auth as shown below.

      [root]# nano /etc/mongodb.conf

      ...

      auth = true

      ...

      [root]# service mongodb restart

  6. In /opt/moab/etc/moab.cfg, set the MONGOSERVER parameter to the correct location of the MongoDB server. This may be set to localhost. By default, Moab assumes it is on the same server.

    MONGOSERVER <host>[:<port>]

    You only need to specify a port if you have changed it from the default. When a port is not specified, Moab assumes the default Mongo port.

  7. In /opt/moab/etc/moab-private.cfg, set the MONGOUSER and MONGOPASSWORD parameters to the MongoDB moab_user credentials you set in step 3.

    MONGOUSER     moab_user

    MONGOPASSWORD secret2

  8. Verify that Moab is able to connect to MongoDB.

    [root]# service moab restart

    [root]# mdiag -S

    ...

    Mongo connection (localhost) is up (credentials are set)

    ...

© 2014 Adaptive Computing