Set MongoDB Connection String for Event Loader

Set the connection string that the Event Loader uses to connect to the Event Repository of your MongoDB system.

About this task

You configure the Event Loader connection string for connecting to your MongoDB system when you configure MATRIXX Engine. Specifically, when you set create_config.py parameters and set the value for the create_config.info question: EventLoader:What is the address or connection string for the external database?.

When setting the connection string, the MongoDB server or instance to connect to is identified by a server address or a replica set. When a replica set is specified, by default, the MongoDB connects the Event Loader to the primary mongod in the replica set. The advantage of specifying a replica set, instead of a specific server address, is that when a failover occurs, the Event Loader is connected to the new primary mongod instance. For a sharded MongoDB deployment, only the server address of the mongos instance is specified.

Procedure

For the create_config.info question: EventLoader:What is the address or connection string for the external database?, set the connection string in the format:
mongodb://host1:port1[,host2:port2],...[,hostN:portN]/MtxEventDatabase[?replicaSet=name]

where:

  • The required prefix is mongodb://.

    For MongoDB Atlas, use mongodb+srv://

  • host1:
    • For a non-sharded MongoDB deployment, the IP address or host name of the server where your MongoDB database instances (mongod) run.
      • If more than one server is specified (recommended), then host1 is the address of a server where one of the mongod instances in a replica set runs.
      • If only one server is specified, then host1 is the address of the server where the primary mongod runs.
        Note: Although you can connect to only one server in a design or test environment, setting only one host is not a valid deployment configuration.
    • For a sharded MongoDB deployment, the IP address or host name of the host where your MongoDB query router (mongos) runs. Run the mongos on the same host server that the Event Loader runs on.
  • portx:
    • For a non-sharded MongoDB deployment, the listening port of mongod where your mongod runs.
    • For a MongoDB sharded cluster, the listening port of mongos where your mongos runs.
  • MtxEventDatabase is the database the Event Loader uses to authenticate.

    Do not change this value.

  • name: is the name of the replica set to connect to.
The following are example connection strings for Event Loader to connect to MongoDB:
  • To connect to a replica set by passing a seed list and the name of the replica set (using MongoDB default port on each server):
    mongodb://host1:27017,host2:27017,host3:27017/​MtxEventDatabase?replicaSet=MtxEventReplSet
  • To connect to the local primary (mongod) running on port 27017:
    mongodb://localhost:27017/MtxEventDatabase
    Important: The value localhost is only suitable for testing on an environment where the mongod runs on the same machine as the Event Loader. If that is not your intended setup, do not use localhost (or 127.0.0.1).
  • To connect to the primary mongod on a remote server:
    mongodb://192.0.2.0:27017
  • To connect to a sharded cluster (connects to the host and port of the server where the mongos instance runs):
    mongodb://10.10.179.53:27017,10.10.179.54:27017,10.10.189.63:27017,10.10.189​.64:27017/MtxEventDatabase
Warning: If you are specifying a URL that has an ampersand, you must specify it as &. For example, specify mongodb://127.0.0.1:27017/MtxEventDatabase?retryWrites=true\&w=majority to mean mongodb://127.0.0.1:27017/MtxEventDatabase?retryWrites=true\&;w=majority.