I am trying to connect to my Atlas cluster using python/pymongo on my Windows 10 PC. I am using the same uri (excluding +srv) that Compass on my PC uses to connect to the cluster but I am getting [Errno 11001] getaddrinfo failed. Code snippet follows:
uri = “mongodb://m220-student:m220-pwd@m220.c3djr.mongodb.net/test?authSource=admin&replicaSet=atlas-13r6jd-shard-0”
dbproc = MongoClient(uri)
Any help would be greatly appreciated.
1 Like
steevej
(Steeve Juneau)
June 8, 2021, 6:25pm
2
Why
mark_rehert:
excluding +srv
You should use the same URI. The address m220.c3djr.mongodb.net is the address of a replica set cluster.
1 Like
I am using the same UIR but dropped off the +srv because it requires another module that I have not installed
1 Like
steevej
(Steeve Juneau)
June 8, 2021, 6:37pm
4
Well, actually mongodb://… and mongodb+srv://… are 2 very different URI even if you use the same string for the dot dot dot part.
The module that you have not install maps the mongodb+srv into its mongodb counter part.
You have 2 choices:
Install the module that is required
–or–
Go into Atlas and obtain the non-SRV connection string of your cluster.
The latter will contains 3 host addresses that looks like m220-shard-99-99-c3djr.mongodb.net .
1 Like
Thanks very much. I thought the +srv just created a secure connection. I have installed dnspython and it now works.
1 Like
steevej
(Steeve Juneau)
June 8, 2021, 6:51pm
6
For more information you may want to look at:
Pages for logged out editors learn more
A Service record (SRV record) is a specification of data in the Domain Name System defining the location, i.e., the hostname and port number, of servers for specified services. It is defined in RFC 2782, and its type code is 33. Some Internet protocols such as the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP) often require SRV support by network elements.
A SRV record has the form:
An example SRV reco...
1 Like
I had read that once before but my interpretation was that I would need to create that srv entry on my PC, which I have not done. If you don’t mind, what am I not understanding?
1 Like
system
(system)
Closed
June 13, 2021, 6:56pm
8
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.