MongoDB agent
Target MongoDB
Prerequisites
To have Gluesync working on your MongoDB instance you will need to have:
-
Valid user credentials with permission to read, and write to the target.
If you’re considering running Gluesync on a MongoDB Atlas DBaaS, please consider also looking at the specific section Deploying in MongoDB Atlas DBaaS here below on that page. |
Setup via Web UI
-
Hostname / IP Address: DNS record or IP Address of your server;
-
Port: Optional, defaults to
27017
; -
Database name: Name of your target database;
-
Username: Username with read & write access to the target;
-
Password: Password belonging to the given username.
-
Enable Tls: (optional, defaults to
false
) Enable or disable the usage of TLS encryption; -
Tls certificates: (optional) File browser to let you upload your certificates;
Connecting to MongoDB Atlas
If you are using MongoDB Atlas DBaaS, you can connect to your cluster by enabling the Use Dns Seed List
param avaible in the Host Credentials
section, just like this screenshot here below:

This will let the agent retrieve the cluster definition from the SRV record in the provided DNS address, this is mandatory when you are performing a connection to MongoDB Atlas (for example).
Custom host credentials
This can be also set via Rest API by specifying customHostCredentials
param.
-
Use DNS Seed List: (optional, defaults to
false
) Set it totrue
to let the MongoDB SDK retrieve the cluster definition from the SRV record in the provided DNS address, this is mandatory when you are performing a connection to MongoDB Atlas (for example); -
Auth Database: (optional, defaults to
null
) Use this field when authenticating against a MongoDB server that requires you to specify a different authentication database; -
Direct Connection (optional, defaults to
false
) Uses Direct connection over MongoDB; -
Replica Set (optional), defaults to
null
: Configure the MongoDB SDK to talk with the specified replica set. -
Read Timeout (optional), defaults to
60
: Configure the MongoDB SDK to use this specific read timeout. -
Connect Timeout (optional), defaults to
60
: Configure the MongoDB SDK to use this specific connection timeout.
Setup via Rest APIs
Here following an example of calling the CoreHub’s Rest API via curl to setup the connection for this Agent.
Connect the agent
curl --location --request PUT 'http://core-hub-ip-address:1717/pipelines/{pipelineId}/agents/{agentId}/config/credentials' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"hostCredentials": {
"connectionName": "myAgentNickName",
"host": "host-address",
"port": 27017,
"databaseName": "db_name",
"username": "",
"password": "",
"enableTls": true,
"certificatePath": "/myPath/cert.pem"
},
"customHostCredentials": {
"replicaSet": "rs0",
"directConnection": true
}
}'
Setup specific configuration
The following example shows how to apply the agent-specific configurations via Rest API.
curl --location --request PUT 'http://core-hub-ip-address:1717/pipelines/{pipelineId}/agents/{agentId}/config/specific' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"configuration": {
"enableRecursionProtection": false
}
}'
Deploying in MongoDB Atlas DBaaS
Gluesync is fully compatible with working within MongoDB Atlas DBaaS. To establish a connection to a MongoDB Atlas Cluster you just need to have:
-
valid
.pem
certificate file; -
the hostname of your Atlas instance, for example:
cluster0.instancereferencename.mongodb.net
.
credentials keypair is not needed when connecting using a .pem certificate to your instance.
|
Troubleshooting
Here is the list of common errors.
-
AuthenticationFailed - Error 18
: You might either have specified a wrong database name as an authentication database or the user that you’re using to connect against the source database does not belong to it, you should issue the correct authentication database where this user is defined. For more detailed info please check out the official MongoDB documentation by visiting the following link: using Authentication Database.