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

To make initial discovery efficient, use the exact same hostnames in your seed list as in your replica set config.

    • Type: Icon: Task Task
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • 01112017-cleanup
    • Affects Version/s: None
    • Component/s: manual
    • Labels:
      None

      Say you have multiple multiple hostname aliases or IPs for your replica set members. The repl set config is like:

      {
        _id: 'rs',
        members: [
          {_id: 0, host: 'internal-a.com'},
          {_id: 1, host: 'internal-b.com'}
        ]
      }
      

      And you connect to a member like this with a driver:

      mongodb://public-a.com/?replicaSet=rs

      We all know that the driver will reconnect to "internal-a.com" instead, and that the driver must be able to resolve and route internal-a.com.

      This task is: please ensure we also say that switching from one alias to another is inefficient. It requires a second DNS lookup. The first connection is closed and a second one is opened for monitoring.

      Furthermore, in the unlikely event you use non-ASCII hostnames for your mongods and you specify a hostname in the URI with different capitalization from the hostname in the replica set config, the driver won't know the two names are the same. Again, it will have to reconnect using the hostname as it appears in the replica set config. Say you have a lowercase thorn in your hostname as configured in the RS:

      {
        _id: 'weird-rs',
        members: [
          {_id: 0, host: 'Fooþar.com'}
        ]
      }
      

      But you connect with an uppercase thorn:

      mongodb://FooÞar.com.com/?replicaSet=weird-rs

      The driver will disconnect from FooÞar.com (upper) and reconnect to Fooþar.com (lower).

      It happens that we specify drivers must compare ASCII names case-insensitively, so FooBar.com and Foobar.com don't suffer this inefficiency. However that's a distracting detail.

      Our message should be that for reliable and efficient connection to a replica set, specify seeds using the exact same hostnames as in the replica set config, where "exact same" includes capitalization.

            Assignee:
            Unassigned Unassigned
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              9 years, 11 weeks, 5 days ago