-
Type: New Feature
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.2.2
-
Component/s: MongoDB 3.2
-
Empty show more show less
I host a MongoDB cluster for users.
To improve the availability of the cluster, there are multiple mongos instances the users can connect to.
With their username, password and port, each user gets a hostname (like "beajhmfbjx0yfuo.mongodb.clvrcld.net").
Originally, we set up the hostname as a CNAME like that:
beajhmfbjx0yfuo.mongodb.clvrcld.net. 59 IN CNAME mongodb-c1.clvrcld.net. mongodb-c1.clvrcld.net. 59 IN A 195.154.243.92 mongodb-c1.clvrcld.net. 59 IN A 195.154.243.93 mongodb-c1.clvrcld.net. 59 IN A 195.154.243.94
The problem with that is that the node client queries the DNS every time it wants to perform something across the network. Like a cursor.next().
Basically, I can configure the node client with many addresses to setup many mongos endpoints. But if I give one domain name only and that name resolves to multiple IPs, the node client will resolve that name often and may pick a different IP each time, then execute the cursor.next() on a different mongos instance than beforeā¦ and get an error.
Can you either recognize the roundrobin DNS and setup the different IPs as as many endpoints, or run DNS queries once and for all when creating a connection?
- related to
-
NODE-942 Resolved DNS records are not cached for subsequent use by new connections
- Closed