Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-12719

Docs for SERVER-4999: all hostnames should be compared case insensitively

    XMLWordPrintableJSON

Details

    Description

      Description

      Description:

      Hostnames passed in a shell connection string, or passed to addShard, rs.initiate, or rs.reconfig are now case-insensitive. Hostnames are lowercased by translating uppercase ASCII letters to lowercase; non-ASCII characters in hostnames are left alone. If you pass a hostname with an uppercase character to rs.initiate/reconfig, it will appear lowercase in rs.conf or rs.status.

      Engineering Ticket Description:

      It seems like addshard treats hostnames case-sensitively, which is inconsistent with how hostnames work in DNS.

      Here's my replica set, addshard failures below. (I know that using localhost adds some extra stupid to the problem, but I don't have a routable hostname to test with right now.)

      > rs.conf()
      {
              "_id" : "a",
              "version" : 3,
              "members" : [
                      {
                              "_id" : 0,
                              "host" : "LOCALHOST:27017"
                      },
                      {
                              "_id" : 1,
                              "host" : "LOCALHOST:27018"
                      },
                      {
                              "_id" : 2,
                              "host" : "LOCALHOST:27019"
                      }
              ]
      }
      

      Here are a bunch of attempts to add it as a shard:

      mongos> db.adminCommand({addShard:"a/localhost"})
      {
              "ok" : 0,
              "errmsg" : "in seed list a/localhost, host localhost:27017 does not belong to replica set a"
      }
      mongos> db.adminCommand({addShard:"a/localhost:27017"})
      {
              "ok" : 0,
              "errmsg" : "in seed list a/localhost:27017, host localhost:27017 does not belong to replica set a"
      }
      mongos> db.adminCommand({addShard:"a/localhost:27017,localhost:27018"})
      {
              "ok" : 0,
              "errmsg" : "in seed list a/localhost:27017,localhost:27018, host localhost:27017 does not belong to replica set a"
      }
      mongos> db.adminCommand({addShard:"localhost:27017"})
      {
              "ok" : 0,
              "errmsg" : "host is part of set: a use replica set url format <setname>/<server1>,<server2>,...."
      }
      mongos> db.adminCommand({addShard:"LOCALHOST:27017"})
      {
              "ok" : 0,
              "errmsg" : "can't use localhost as a shard since all shards need to communicate. either use all shards and configdbs in localhost or all in actual IPs  host: LOCALHOST:27017 isLocalHost:0"
      }
      mongos> db.adminCommand({addShard:"a/LOCALHOST:27017"})
      {
              "ok" : 0,
              "errmsg" : "can't use localhost as a shard since all shards need to communicate. either use all shards and configdbs in localhost or all in actual IPs  host: LOCALHOST:27017 isLocalHost:0"
      }
      mongos> db.adminCommand({addShard:"a/LOCALHOST:27017,LOCALHOST:27018"})
      {
              "ok" : 0,
              "errmsg" : "can't use localhost as a shard since all shards need to communicate. either use all shards and configdbs in localhost or all in actual IPs  host: LOCALHOST:27017 isLocalHost:0"
      }
      

      Scope of changes

      Impact to Other Docs

      MVP (Work and Date)

      Resources (Scope or Design Docs, Invision, etc.)

      Attachments

        Activity

          People

            Unassigned Unassigned
            kay.kim@mongodb.com Kay Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              4 years, 35 weeks, 1 day ago