-
Type:
Improvement
-
Resolution: Done
-
Priority:
Minor - P4
-
None
-
Affects Version/s: 2.0.2
-
Component/s: Replication
-
None
-
Environment:MacOSX, but generally anywhere the hostname resolution behavior is screwy.
-
Replication
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
replSetInitiate with no arguments doesn't work when the mongod's host's name isn't resolvable. (This is the default behavior on MacBooks,
and comes up constantly in trainings.) It's possible to configure the set with an explicit, valid configuration object, of course, though in many training scenarios, the only resolvable hostname you have is localhost, so you have to choose between localhost and IP addresses.
The trouble is I'm not sure what the bug is:
(1) File this as a documentation bug and say that a no-arg initiate doesn't work if your hosts don't know their own names. (We probably don't really want people deploying onto hosts with dodgy hostname resolution behaviors anyway, i.e., say that a good DNS configuration is a prerequisite like NTP is.) This is a principled position, but it means we will continue not to have an easy way to initiate a replica set in these cases.
(2) Otherwise, to support a simple way to initiate even in these cases, let the user give just a "hostname:port" or "hostip:port" string. Patch attached.
Strictly speaking, (2) is an incompatible change, since replSetInitiate currently ignores any non-document argument. (Probably it should have ignored only null arguments, but oh well.) So there's some quibbling possible about whether to do (2).
- is related to
-
SERVER-20965 rs.initiate() with no parameters can choose a poor hostname
-
- Closed
-
- related to
-
SERVER-13858 couldn't initiate : can't find self in the replset config
-
- Closed
-