[DOCS-4886] To make initial discovery efficient, use the exact same hostnames in your seed list as in your replica set config. Created: 27/Feb/15  Updated: 11/Jan/17  Resolved: 27/Jul/16

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: 01112017-cleanup

Type: Task Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to DOCS-4992 Clarify that the hostname(s) in a Con... Closed
is related to DOCS-4890 Warn against non-canonical replica se... Closed
Participants:
Days since reply: 8 years, 50 weeks, 5 days ago

 Description   

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.


Generated at Thu Feb 08 07:49:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.