rs.initiate() with no parameters can choose a poor hostname

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Major - P3
    • None
    • Affects Version/s: 3.0.7
    • Component/s: Replication
    • None
    • ALL
    • Hide

      Follow the steps outlined in https://docs.mongodb.org/master/tutorial/deploy-replica-set-with-auth/. Examine the configuration object returned by rs.conf().

      Expected: members[0].host is "mongodb0.example.net:27017"

      Actual: members[0].host is "mongodb0:27017"

      Show
      Follow the steps outlined in https://docs.mongodb.org/master/tutorial/deploy-replica-set-with-auth/ . Examine the configuration object returned by rs.conf(). Expected: members[0].host is "mongodb0.example.net:27017" Actual: members[0].host is "mongodb0:27017"
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Calling rs.initiate() (i.e. without a configuration object) will cause MongoDB to create its own replicaSet configuration. Unfortunately, for "host" it chooses the computer name without the domain name. Of course this is only a problem when working with computers across different domains, which is probably why no one has noticed it before now.

      Workaround: call rs.initiate with a configuration object like this:

          {
              _id: "rs0",
              members: [{
                  _id: 0,
                  host: "host.domain.tld:port"
              }]
          }
      

            Assignee:
            Evin Roesle
            Reporter:
            Tom Snee
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: