Create MongoDB Users for a Sharded Cluster

Create MongoDB sharded cluster users for the Event Repository.

About this task

At a minimum, you must create these MongoDB users for the sharded cluster.

  • The administrator user of your MongoDB system (MtxAdmin).

    This user is required for accessing and administering your MongoDB database.

  • The Event Loader (client) user of the MATRIXX Engine (MtxEventLoader).

    This user is required for the Event Loader to access your MongoDB system and must have the clusterAdmin role or a role with a higher privilege. The Event Loader service that runs on the MATRIXX Engine authenticates itself with this user.

Procedure

  1. Start a mongo shell and connect to the mongos.
    mongo
  2. Add the administrator user and the Event Loader (client) user by typing the following commands. Replace the value of the pwd field with your own password.
    use admin
    db.createUser(
        {
            user: "MtxAdmin",
            pwd: "password",
            roles: [{role: "root", db: "admin"}]
        }
    )
    db.auth("MtxAdmin", "password")
    use MtxEventDatabase
    db.createUser(
        {
            user: "MtxEventLoader",
            pwd: "12345678",
            roles: [{role: "dbAdmin", db: "MtxEventDatabase"}, {role: "readWrite", db: ​"MtxEventDatabase"}, {role: "root", db: "admin"}]
        }
    )
    
    Note: The password you select for the MtxEventLoader user is required when you configure MATRIXX Engine later.
  3. (General Ledger only) If you plan to use MATRIXX GL utilities to process GL information from the Event Repository, see the discussion about setting user credentials for GL utilities, and follow the procedure for adding the GL utility (client) user.
  4. Log in or re-authorize with the proper credentials to continue. As soon as the first user is created, user authentication is in effect. Starting the MongoDB mongo shell now requires a username and password. For example:
    mongo -u MtxAdmin -p password admin

What to do next

After you create sharded cluster users, run scripts to define and add indexes and create collections in your MongoDB database.