Create MongoDB Users for a Shard Replica Set

Create MongoDB users for each shard replica set in your sharded MongoDB deployment for the Event Repository.

About this task

At a minimum, you must create the following MongoDB user for each shard replica set.
  • The administrator user of your MongoDB system (MtxAdmin).

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

Procedure

  1. Connect to the primary mongod of the replica set using the MongoDB mongo shell CLI.
    mongo
  2. Add the administrator 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"}]
        }
    )
    
    Note: If special characters are used in the username or password when creating the MongoDB user, you must encode each special character to URL encoded format (percent encoding) when you set these credentials later in MATRIXX configurations. For more information, see the discussion about URL encoding for special characters in MongoDB user names and passwords. To avoid URL encoding, use only alpha-numeric characters in MongoDB user names and passwords.

What to do next

After you create users for each shard replica set, initiate the sharded cluster.