Trouble Connecting Elasticsearch Connector to MongoDB Atlas with ServerSelectionTimeoutError

51 Views Asked by At

Stack Overflow community!

I'm currently working on integrating Elasticsearch with MongoDB Atlas using an Elasticsearch connector and have encountered a connectivity issue that I'm unable to resolve. I'm following the official MongoDB documentation for setting up IP access lists (MongoDB Atlas Security) and have configured my MongoDB Atlas cluster to allow access from any IP address (0.0.0.0/0). This setup is intended to enable the Elasticsearch connector, running on Elastic Cloud, to access Atlas as per the guidelines.

However, when I attempt to establish the connection using the connector with the server hostname mongodb+srv://cluster0.lgtepjy.mongodb.net, I encounter the following error: Connector error ServerSelectionTimeoutError: cluster0.lgtepjy.mongodb.net:27017: [Errno -5] No address associated with hostname, Timeout: 30s, Topology Description: <TopologyDescription id: 65c342e9dc0914b43336d726, topology_type: Unknown, servers: [<ServerDescription ('cluster0.lgtepjy.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('cluster0.lgtepjy.mongodb.net:27017: [Errno -5] No address associated with hostname')>]> To diagnose the issue, I've conducted DNS resolution tests using both dig and nslookup commands for _mongodb._tcp.cluster0.lgtepjy.mongodb.net, which successfully return the SRV records. This suggests that DNS resolution is not the problem.

Given that my setup adheres to the official documentation and DNS resolution checks out, I'm puzzled about the root cause of the ServerSelectionTimeoutError and the [Errno -5] No address associated with hostname message.

Has anyone faced a similar issue or can offer insights into potential misconfigurations or steps I might have overlooked? Any guidance on troubleshooting this connectivity problem would be greatly appreciated.

Thank you in advance for your help!

0

There are 0 best solutions below