Set MongoDB Connection String for General Ledger Utilities
Set the MongoDB connection string for General Ledger (GL) utilities to connect to your MongoDB system. If you use multi-tenancy, you must set connection strings for each MongoDB-based Event Repository.
About this task
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, MongoDB connects
GL utilities 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 GL utilities automatically connect to the new primary mongod instance. For a sharded MongoDB deployment, only the server address of the mongos
instance is specified.
Procedure
- Connect to the host server on which the GL utilities run.
- Open the gl_processor.yaml and gl_posting.yaml properties files.
-
For the
dbServerAddress property in each file, set the
connection string in the format:
host1[:port1][,host2[:port2],...[,hostN[:portN]]][/?replicaSet=name]
where:
host1
:- For a non-sharded MongoDB deployment, the IP address or host name of the server where your MongoDB instances (
mongod
) run.- If only one server is specified, then
host1
is the address of the server where the primarymongod
runs. - If more than one server is specified, then
host1
is the address of a server where one of themongod
instances in a replica set runs.
- If only one server is specified, then
- For a sharded cluster, the IP address or host name of the server where your
mongos
instance (MongoDB routing process) runs.
- For a non-sharded MongoDB deployment, the IP address or host name of the server where your MongoDB instances (
portx
:Note:portx
is optional. If a port is not provided, the default is:27017
.- For a non-sharded
MongoDB deployment, the port number on the server where a
mongod
instance runs. - For a sharded cluster,
the port number on the server where your
mongos
instance runs.
- For a non-sharded
MongoDB deployment, the port number on the server where a
name
: The name of the replica set in which to connect.
The following are example connection strings:- To connect to the local primary
(
mongod
) running on port 27017:dbServerAddress: localhost:27017
Important: The valuelocalhost
is only suitable for testing on an environment where themongod
runs on the same machine as the GL utility. If that is not your intended setup, do not uselocalhost
. - To connect to the primary
mongod
on a remote server:dbServerAddress: 10.10.106.57:27017
- To connect to a replica set by passing a list of
server addresses:
dbServerAddress: 10.10.106.57:27017,10.10.106.54:27017,10.10.106.55:27017
- To connect to a replica set by passing a seed list
and the name of the replica set:
dbServerAddress: 10.10.106.57:27017,10.10.106.54:27017,10.10.106.55:27017/ ?replicaSet=MtxEventReplSet
- To connect to a sharded cluster (connects to the
host and port of the server where the
mongos
instance runs):dbServerAddress: 10.10.176.61:27017
-
To use a DNS seed list to connect to MongoDB, set the isDNSSeedList property to
yes and set the
dbServerAddress
property to the seed list server. -
Define the tenants array information in the
gl_processor.yaml
andgl_posting.yaml
properties files if required to support multi-tenancy.