-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.0.0, 2.0.1, 2.0.2, 2.0.3
-
Component/s: None
-
None
-
Environment:ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
mongo (2.0.3)
When initialising the Mongo::Client with '127.0.0.1:27017' it correctly discovers replica members whereas 'localhost:27017' doesn't.
# OK client = Mongo::Client.new([ '127.0.0.1:27017' ], { :database => 'test', :replica_set => 'tank' }) => #<Mongo::Client:0x70330174903860 cluster=127.0.0.1:27017, localhost:27017, localhost:27018, localhost:27019> # Failed client = Mongo::Client.new([ 'localhost:27017' ], { :database => 'test', :replica_set => 'tank' }) => #<Mongo::Client:0x70330175445640 cluster=localhost:27017>
/etc/hosts
127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost
mongo.conf
net: bindIp: 127.0.0.1 port: 27017 # 27018, 27019,
The debug log contains lots of IPv6 related entries:
DEBUG -- : MONGODB | Address family not supported by protocol family - connect(2) for [::1]:27017
Enabling IPv6 and adding ::1 to bindIp didn't resolve it either.
The only scenario where I can make both '127.0.0.1:27017' and 'localhost:27017' function properly is when I remove the IPv6 ::1 localhost entry from the /etc/hosts file.
Any thoughts?