[CSHARP-1915] Respect host names from connection string. Created: 12/Feb/17 Updated: 27/Oct/23 Resolved: 02/Mar/17 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Sebastian Stehle | Assignee: | Robert Stam |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Feature Request: I am running MongoDb inside a kubernetes cluster, but the replica setting uses internal IPs and host names. Therefore I cannot connect to the replica set. But I can connect to each member individually. It would be nice to have a driver mode where the host names from the connection string are respected. Then I can use port forwarding to access the mongodb instances. This is only needed for maintainance tasks and admin tools, not for connecting an app to the replica set. |
| Comments |
| Comment by Sebastian Stehle [ 03/Mar/17 ] | |
|
Yes, I know. But as I mentioned, it is for maintenance tasks. I want to connect to my replica set and remove a collection or something like this. I don't see any good solution at the moment if I don't want to expose these details of my infrastructure. | |
| Comment by Robert Stam [ 02/Mar/17 ] | |
|
When connecting to a replica set the driver must use the same host names that the replica set uses internally. This is so that the driver can track the replica set status and correctly handle the scenario where members are added or removed from a replica set. If you are connecting directly to a single member of the replica set (not recommended unless you are sure of what you are doing) you can add "connect=direct" to your connection string:
|