[SERVER-31454] rs.initiate() does not load default configuration as expected Created: 06/Oct/17 Updated: 27/Oct/23 Resolved: 09/Oct/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Replication |
| Affects Version/s: | 3.5.12 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Bartosz Solowiej | Assignee: | Unassigned |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
|||||||||||||||||||||||||||||||
| Operating System: | ALL | |||||||||||||||||||||||||||||||
| Steps To Reproduce: | Here are the steps:
|
|||||||||||||||||||||||||||||||
| Participants: | ||||||||||||||||||||||||||||||||
| Description |
|
When launching a replicated local 1x1 cluster (a 1 member replicaSet), the default configuration is not applied as expected and the replicaSet remains uninitiated. However, by passing an explicit configuration, it initializes just fine. |
| Comments |
| Comment by Bartosz Solowiej [ 09/Oct/17 ] | |||||||||||||
|
@Spencer T Brody - That makes the most sense to me especially because localhost is the default binding now. Although, I understand what @Andy Schwerin mentioned, it doesn't make sense to attempt CNAME (or any other hostname for that matter) when localhost is default. Thank you both for the feedback. | |||||||||||||
| Comment by Spencer Brody (Inactive) [ 09/Oct/17 ] | |||||||||||||
|
This problem is exacerbated by the behavior change from | |||||||||||||
| Comment by Andy Schwerin [ 09/Oct/17 ] | |||||||||||||
|
When you do not pass an explicit replica set configuration to rs.initiate, the server against which you run the initiate command attempts to guess what host name to put into the configuration. It does this simply by calling the libc function gethostname and accepting the resulting value. This naive approach is rarely what you want for a production system, but can be good for testing. Since you have restricted mongod to only bind to 127.0.0.1, and gethostname returns a name that resolves to another IP address, mongod is unable to find itself in the replica set configuration that it produced. In general, mongod cannot guess the right host name to use use, because you might wish to resolve through a CNAME, your host might have multiple resolving names, or even a more complicated scenario. Because mongod cannot be right all the time, we chose a simple-to-explain mechanism with the expectation that most deployments would instead need to pass a name into rs.initiate. | |||||||||||||
| Comment by Bartosz Solowiej [ 09/Oct/17 ] | |||||||||||||
|
Similar error but without the "info" or "me".
| |||||||||||||
| Comment by Andy Schwerin [ 08/Oct/17 ] | |||||||||||||
|
What happens if you attempt to initiate the set explicitly using the value returned in the "me" field of the failed initiate? In your example, sjca0bsolopro:27017? |