Configuring MongoDB for Sametime

This topic guides you through the steps for configuring MongoDB on Windows and Linux.

Before you begin

Installing MongoDB

About this task

To configure MongoDB 4.2.x on Windows and Linux, perform the following steps.

Note: For MongoDB 3.6.x version configuration, refer to Installing MongoDB on Windows in the HCL Sametime 11.0 documentation.

Procedure

  1. If not running, start the MongoDB server as a service.
  2. If not running, start the MongoDB console.

    Windows:

    C:\Program Files\MongoDB\Server\4.2\bin\mongo.exe

    Linux:

    >mongo
  3. Create sametimeUser in MongoDB with the following command from the MongoDB console.
    Note: The user and password specified below are examples and can be changed at this time if desired. If changing, use the new values when you configure the Sametime Community server in a later step.
    > use admin
    > db.createUser({user: "sametimeUser", pwd: "sametime", roles:[{role:"readWrite", db:"chatlogging"},{ role:"readWrite", db:"mobileOffline"},{role:"userAdminAnyDatabase", db:"admin"}]})
    Note: These are two separate commands. The expected output will be a successfully added user message and details.


  4. Create the chatlogging database with events and sessions collections in MongoDB with the following command from the MongoDB console.
    > use chatlogging 
            
    > db.EVENTS.insertOne({"_id" : "dummy"}) 
            
    > db.SESSIONS.insertOne({"_id" : "dummy"}) 
    Note: These are three separate commands and are case sensitive.


  5. Stop the MongoDB server and exit the console to pick up the new schema version change. To exit the MongoDB console, use the command “exit”. To shut down the MongoDB server, on Windows stop the MongoDB service and on Linux use the command ‘service mongod stop’.
  6. Edit the mongod.cfg file.

    Windows:

    C:\Program Files\MongoDB\Server\4.2\bin 

    Linux:

     /etc/mongod.conf  

    Uncomment or add “replication:” and add “replSetName: rs0” under it.

    replication:
      replSetName: rs0

    Under # network interfaces, add bindIpAll: true.

    Example:

    # network interfaces

    net:
      port: 27017
      bindIp: 127.0.0.1
      bindIpAll: true
    Note:
    • You can copy/paste the instructions from the document. However, the format of the instructions is critical and must remain the same. The indentations are two spaces, not a tab and there can be no trailing spaces at the end of each line. See screen shot with text highlighted to help confirm.
    • If the MongoDB logs and data were different from the default values, confirm this file needs to be updated correctly.

    Example of mongod.cfg file showing no spaces at the at the line ends.



    Note: Make sure the file is not saved as a .txt when saving.
  7. Start the MongoDB service from the Windows Services panel on Windows or from a command prompt on Linux.

    Windows:



    Linux:

    >service mongod start 
  8. Start the MongoDB console.

    Windows:

    C:\Program Files\MongoDB\Server\4.2\bin\mongo.exe

    Linux:

    >mongo 
  9. Initiate the Replica Set in MongoDB with the following command from the MongoDB console.
    > rs.initiate()


    Windows:

    Review the message returned. The expected output should be:
    rs0:Secondary
    or
    rs0:OTHER
    Hit enter it will change to:
    rs0:Primary>


  10. The replica set is now operational. To view the replica set configuration, use rs.conf() from the MongoDB Console. To check the status of the replica set, use rs.status().

    At this point you can exit the console using exit.

    Note: When MongoDB is not configured on the localhost, the configuration must reflect the correct host name or IP. See the following article for known issues.

    HCL Sametime 11 clients fail when MongoDB host is not configured correctly on the Community server

    Note: MongoDB security is not enabled by default. Securing MongoDB is not required for Sametime, but it is recommended. Refer to Enable Security in MongoDB for steps to enable.

What to do next

Installing Sametime Community