-
Type: Task
-
Resolution: Won't Fix
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: manual
-
Labels:None
The warning here:
http://php.net/manual/en/mongo.connecting.rs.php
The host names that you specify in the seed list must match the host names in the replica set configuration. This is because the driver only uses the host names in the replica set configuration to create the hash for its persistent connections.
For example, if an IP address is used in the seed list and the replica set is configured with host names, the driver will discard any seed list connection(s) that differ from the canonical host names reported by the replica set. Effectively, these non-canonical seed list connections will be recreated on each request, greatly reducing the benefit of using persistent connections.
Applies, more or less, to all drivers. A driver must connect to a replica set using the exact same hostnames as the replica set itself uses in its config. So if you have an RS member that listens on "private.com" and "public.com", and the hostname "private.com" is in the RS config but you connect to "mongodb://public.com/?replicaSet=rs", various surprising and inefficient things will happen.
When I did trainings, we emphasized this to customers, as the main mistake to avoid when configuring and connecting to an RS. But I can't find this warning in the manual now.
- related to
-
PHPC-105 Connections to non-canonical seed list hosts are not persisted
- Closed
-
DOCS-4886 To make initial discovery efficient, use the exact same hostnames in your seed list as in your replica set config.
- Closed
-
DOCS-4992 Clarify that the hostname(s) in a Connection String URI is/are a seed host/list
- Closed