Description
This article discusses the Fully managed MongoDB Atlas Source/Sink Connector failing with the below error and how to troubleshoot when it occurs.
The connector is having trouble reaching the database. Please check all credentials and network settings, then try again.
MongoDB server is unreachable or does not exist
Applies To
MongoDB Atlas Source/Sink Connectors
Confluent Cloud
Cause
This error typically occurs when the MongoDB Server host is unreachable from Confluent Cloud Network which indicates networking setup issues.
Resolution
Here are some steps to troubleshoot and resolve this error -->
1. Check Connection String: Ensure that the MongoDB connection host address string is correctly specified and also verify other necessary details such as the hostname, port, and authentication credentials. Ensure that the connection host provides a service record (SRV). A standard connection string host address may not work with MongoDB Atlas.
Also, ensure the following -->
- If your MongoDB database username or password includes any of the following characters:
$ : / ? # [ ] @
, you must convert the characters using percent encoding. - The MongoDB database service endpoint and the Kafka cluster must be in the same region.
2. Network Connectivity: Verify that the network settings allow connections to the MongoDB server. Ensure that there are no firewall rules or network policies blocking the connection. Also, ensure the network connectivity from Confluent Cloud Network to your MongoDB server on the corresponding MongoDB port (default port, `27017`) is successful. Refer to this KB here to verify how the MongoDB URLs resolve in the public DNS using nslookup. For more details, see Networking and DNS.
In case of Enterprise Clusters, PrivateLink Networking type is supported. For additional networking considerations, like using Egress PrivateLink Endpoints refer to the documentation for AWS, Azure.