Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-20965

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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • 3.0.7
    • 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"

    Description

      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"
              }]
          }
      

      Attachments

        Activity

          People

            evin.roesle@mongodb.com Evin Roesle
            tsnee Tom Snee
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: