[DRIVERS-316] Driver is unable to resolve hostnames to IP addresses Created: 15/Jul/16  Updated: 22/Jan/18  Resolved: 22/Jan/18

Status: Closed
Project: Drivers
Component/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Mallika Iyer Assignee: Bernie Hackett
Resolution: Won't Fix Votes: 1
Labels: driver
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Mongodb version : https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon-3.2.7.tgz , this is running on Pivotal Cloud Foundry


Issue Links:
Related
is related to DOCS-8596 Make clear in server docs as well as ... Closed

 Description   

MongoDB ruby driver cannot connect to the replica set.
The driver itself seems to want to resolve the host names of each individual node e.g. mongod-node-0 => 10.0.x.x

Logs from the Mongo adapter: note where "getaddrinfo" fails to resolve the hostname to the IP address.

016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:30.331490 #28 DEBUG – : MONGODB | Adding 10.65.178.135:28000 to the cluster.
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:30.333658 #28 DEBUG – : MONGODB | Adding mongod-node-0:28000 to the cluster.
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:30.335013 #28 DEBUG – : MONGODB | getaddrinfo: Name or service not known
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:30.335204 #28 DEBUG – : MONGODB | Adding mongod-node-1:28000 to the cluster.
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:30.335781 #28 DEBUG – : MONGODB | getaddrinfo: Name or service not known
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:30.335950 #28 DEBUG – : MONGODB | Adding mongod-node-2:28000 to the cluster.
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:30.348431 #28 DEBUG – : MONGODB | getaddrinfo: Name or service not known
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:30.348763 #28 DEBUG – : MONGODB | Adding 10.65.178.133:28000 to the cluster.
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:30.351169 #28 DEBUG – : MONGODB | 10.65.178.135:28000 being removed from the cluster.
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:30.351480 #28 DEBUG – : MONGODB | Server 10.65.178.133:28000 elected as primary in pcf_repl.
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:30.351706 #28 DEBUG – : MONGODB | Adding 10.65.178.134:28000 to the cluster.
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:30.354136 #28 DEBUG – : MONGODB | 10.65.178.133:28000 being removed from the cluster.
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:30.834764 #28 DEBUG – : MONGODB | getaddrinfo: Name or service not known
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:30.835866 #28 DEBUG – : MONGODB | getaddrinfo: Name or service not known
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:30.836627 #28 DEBUG – : MONGODB | getaddrinfo: Name or service not known
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:31.334806 #28 DEBUG – : MONGODB | getaddrinfo: Name or service not known
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:31.335955 #28 DEBUG – : MONGODB | getaddrinfo: Name or service not known
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:31.336675 #28 DEBUG – : MONGODB | getaddrinfo: Name or service not known
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:31.834838 #28 DEBUG – : MONGODB | getaddrinfo: Name or service not known
2016-07-14T15:10:42.35-0700 [APP/0] OUT D, 2016-07-14T22:10:31.835991 #28 DEBUG – : MONGODB | getaddrinfo: Name or service not known

As soon as the driver adds a host, it tries to resolve it's name. This just isn't possible in a container, we can't add host entries.

Is it possible to instruct the driver to use IP addresses only?



 Comments   
Comment by Bernie Hackett [ 22/Jan/18 ]

Closing won't fix. The workaround in this situation is to map hostnames to IPs in /etc/hosts.

Comment by Bernie Hackett [ 19/Jul/16 ]

I've moved this ticket to the DRIVERS project since all MongoDB drivers work the same way. This behavior is defined in the server discover and monitoring spec:

https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#parsing-an-ismaster-response

Comment by Mallika Iyer [ 18/Jul/16 ]

Unfortunately that won't resolve the issue, I would like to leave it open
because it is a critical issue until a workaround can be agreed on.

On Mon, Jul 18, 2016 at 4:46 AM, Emily Stolfo (JIRA) <jira@mongodb.org>


Mallika Iyer | Principal Software Architect // Cloud Platform Engineering |
Pivotal
415.632.7294 | miyer@pivotal.io <miyer@gopivotal.com>

Generated at Thu Feb 08 08:21:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.