[SERVER-3350] Allow 0.0.0.0 as the bind_ip Created: 30/Jun/11  Updated: 12/Jul/16  Resolved: 25/Jan/12

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: 1.8.2
Fix Version/s: 2.1.1

Type: Bug Priority: Major - P3
Reporter: Jonas Lindholm Assignee: Brandon Diamond
Resolution: Done Votes: 1
Labels: replication
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

CentOS 5.5 64 bits


Issue Links:
Related
is related to SERVER-24280 Starting from 3.2.5 if bind_ip is set... Closed
Operating System: Linux
Participants:

 Description   

I just installed mongo 1.8.2 on a CentOS 64 bits server and try to create a replicate set using the following command:

> rs.initiate()
{
"info2" : "no configuration explicitly specified – making one",
"errmsg" : "couldn't initiate : can't find self in the replset config",
"ok" : 0
}
>

The mongod is started with the following and there are no other replication set on the subnet:

mongod --fork --rest --replSet osm

I've created replicate set without any issues with 1.6.5 on other 32 and 64 bits servers.



 Comments   
Comment by auto [ 23/Jan/12 ]

Author:

{u'login': u'', u'name': u'Brandon Diamond', u'email': u'brandon@10gen.com'}

Message: SERVER-3350: handle 0.0.0.0 for bind_ip
Branch: master
https://github.com/mongodb/mongo/commit/477496bf414fafaa83c8512fcd47b1c0ede80b5e

Comment by John Danner [ 21/Jul/11 ]

I got hit by this last night when trying to bring up replication. I changed the bind parameter to a specific IP. That got the replication working but now my config has the IP vs. the hostname of the server. Not a huge deal but it would be helpful to use the hostname as it clarifies to someone looking at the config where the server is (we are replicating across data centers). Thanks!

Comment by Jonas Lindholm [ 01/Jul/11 ]

Thanks, I appreciate the responsiveness you have to suggestions.

Comment by Kristina Chodorow (Inactive) [ 01/Jul/11 ]

That seems reasonable, I'll see what I can do.

Comment by Jonas Lindholm [ 01/Jul/11 ]

I can see that the resolution is work as design. Well, this is the first application I know about for over 25 years that try to translate 0.0.0.0 to the hostname and not just use it to indicate that the application should bind to all available IP interfaces on the host and use another way to find the host name.

You should modify your code so it works like other application when 0.0.0.0 is used as the bind parameter.

Comment by Jonas Lindholm [ 30/Jun/11 ]

I believe I found the error. In this case it's not a DNS issue but an issue when you specify bind=0.0.0.0 in the mongod.conf file. It seems mongod takes 0.0.0.0 as an IP address and try to translate that to the hostname.
What I could see in the log file was that it tried to insert an entry in system.replset with 0.0.0.0:27017 and not a hostname when I did rs.initialize().

Comment by Kristina Chodorow (Inactive) [ 30/Jun/11 ]

This is generally a DNS issue, it finds a hostname for the local machine but then cannot match it to itself. You can get around it by explicitly specifying a configuration. In 1.9.1+, rs.initiate() will return the address it was trying to resolve.

Generated at Thu Feb 08 03:02:50 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.