Open rcsanchez97 opened 4 years ago
At first glance it seems like this is a PyMongo "feature". When connecting to "localhost" pymongo will only resolve IPv4: https://jira.mongodb.org/browse/PYTHON-356
To workaround pymongo's behavior here, the user needs to pass a non-"localhost" --hostname
and mlaunch needs to change to connect with the hostname
instead of hard coding "localhost". For example:
https://github.com/p-mongo/mtools/blob/b932e763fb59b9b20972036ea792e0d58b024aba/mtools/mlaunch/mlaunch.py#L86
host = 'localhost:%i' % port
Needs to change to:
host = '%s:%s' % (args['hostname'], port)
I've opened PYTHON-2209 to see if we can make PyMongo more user friendly here but I'm not sure if it will be possible.
In using mlaunch to launch a replica set in order to reproduce a bug reported by a user, an unexpected failure resulted. The problem appears to originate from configuring the MongoDB servers to only bind to IPv6 addresses. It appears that mlaunch successfully launches the MongoDB servers, but then cannot connect to them on the expected localhost IPv4 address.
The command and output are:
Here is the evidence that the severs were launched:
Expected behavior
mlaunch should attempt to connect to the launched servers on the configured IPv6 address.
Actual/current behavior
mlaunch only attempts to connect to the launched servers on the localhost IPv4 address, which results in a connection timeout.
Steps to reproduce the actual/current behavior
See above command and associated output.
Environment