This documentation supports the 18.02 version of BMC Digital Workplace. To view the latest version, select the version from the Product version menu.

Installing and setting up MongoDB on Windows

The procedure to to install and set up MongoDB on Windows is as follows.

Note

 This procedure applies to both standalone and high-availability setup. For high-availability, you have to perform an additional step of configuring MongoDB for replica set.

  1. Run with root access:
    Run as the system administrator.
  2. Download MongoDB: 
    https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-3.2.1.zip
    (Or, to get specific versions:  http://www.mongodb.org/downloads#previous )
  3. Extract (unzip) the MongoDB archive: 

  4. Copy MongoDB to the target directory:

    1. Create c:\dbdata\mongodb

    2. Move the extracted folder to c:\dbdata\mongodb

  5. Create the database data directory:
    Create c:\dbdata\mongodatawt

  6. Create a key file that your deployment will use to authenticate servers to each other.
    Ensure that your key file meets the following requirements:
    • Contains 6 to 1024 characters and contains only characters in the base64 set.
    • Setting keyFile enables authentication and specifies a key file for the replica set members to use when authenticating to each other.
    • Key file content is arbitrary but is the same on all members of the replica set instances that connect to the set.

    Create the mongo.key file in c:\dbdata\mongodb with the following content: mysecretkey007
  7. Set the storage engine to wiredTiger for better performance and reduced storage.
    Run the following command:

    c:\dbdata\mongodb\mongodb-win32-x86_64-2008plus-3.2.1\bin\mongod.exe --dbpath c:\dbdata\mongodatawt --port 27017 --storageEngine wiredTiger

    Note

    To ensure that Mongod is running, keep the command window open.  

  8. Connect to the mongo shell and create the administrator user and the social database administrator:

    Note

    Open a new command window to execute mongo.exe shell to create administrator users.

    use admin
    db.createUser( {
    user: "siteUserAdmin",
    pwd: "password",
    roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
    });
    db.createUser( {
    user: "siteRootAdmin",
    pwd: "<siteRootAdminPassword>",
    roles: [ { role: "root", db: "admin" } ]
    });
    use social
    db.createUser( {
    user: "social_admin", 
    pwd: "<social_adminPassword>",
    roles:
    [ { role: "dbOwner", db: "social" } ]
    });
  9. Stop the mongo process that was started.

  10. Start the MongoDB service with the key file:
    1. Create the file c:\dbdata\mongodb\mongodb-win32-x86_64-2008plus-3.0.8\mongod.cfg and add following settings:

      dbpath=c:\dbdata\mongodatawt
      port=27017
      logpath=c:\dbdata\mongodb\mongo_social.log
      logappend=true
      quiet=true
      journal=true
      replSet=myitsocial
      keyFile = c:\dbdata\mongodb\mongo.key
      nohttpinterface = true
      storageEngine = wiredTiger

      Note

      For standalone setup, remove replSet parameter form the mongod.cfg file.

    2. As administrator, open the command prompt window and run the following command:

      c:\dbdata\mongodb\mongodb-win32-x86_64-2008plus-3.2.1\bin\mongod.exe --config c:\dbdata\mongodb\mongodb-win32-x86_64-2008plus-3.2.1\mongod.cfg --install
      
    3. To start the service, run the net start MongoDB command.
  11. (For high-availability) After installing and setting up MongoDB on WIndows, go to Configuring MongoDB for replica set.
Was this page helpful? Yes No Submitting... Thank you

Comments