Connection String Options¶
Atlas provides multiple connection strings. These strings allow you to connect to your clusters from both public and private contexts.
Why does my cluster have multiple connection strings?¶
To connect to Atlas, point your applications to a URI to communicate with a cluster. Atlas creates clusters with more than one node or host. Each node has its own hostname that resolves to an IP address. The URI , known as a connection string, to which Atlas connects might have more than one hostname. Configure Atlas to accept connections to the cluster hosts from allowed IP addresses.
Atlas secures connections from public IP address through authentication and TLS . If you want to connect to private IP addresses, you can use:
These features all manage communication over internal IP addresses within secure networks.
Atlas provides more than one connection string when using secure networks. Each network offers a string that resolves to different IP addresses.
All clusters have a standard connection string. This resolves to the cluster's:
- Public IP addresses for Internet connections and
- VPC private IP addresses for AWS clusters when resolved from a peered VPC .
Use this string for applications connecting over the Internet or connecting to peered clusters in AWS .
Clusters with peered networks have a Private IP for Peering connection string. This string resolves to IP addresses available to:
- Peered networks in Azure or GCP
- AWS peered clusters with a custom DNS service.
Use this connection string with applications connecting:
- Within an Azure or GCP peered network
- To AWS clusters when using AWS with custom DNS service.
AWS or Azure clusters in regions with private endpoints configured have one or more connection strings. Each string resolves to the private IP address of a network interface in your VPC or VNet that connects directly to a load balancer in the Atlas VPC or VNet. Use these connection strings with applications connecting with private endpoints.
What does this mean for GCP or Azure clusters in peering-only mode?¶
Before 31 March 2020, you were required to enable peering-only mode to connect to databases on peer networked Azure or GCP clusters. This mode:
- Affected global DNS resolution and
- Limited any database connections outside the peered network.
Multiple horizons lifts these restrictions and unlocks additional features. In projects running MongoDB 3.6 or later clusters, you can use:
To leverage multiple horizons:
- Make sure your clusters use MongoDB 3.6 or later,
- Update your application's existing connection strings to use Private IP for Peering connection strings,
- Disable Peering-Only mode, and
- Connect using the strings outlined in Why does my cluster have multiple connection strings?.
You can keep connecting to your clusters using existing peering-enabled connection strings at this time. Peering-Only mode prevents access to the improved functionality and reduced limitations of multiple horizons. To use the new features and remove the legacy limitations, MongoDB requires that you use the new connection strings.
Can my VNet-peered Azure cluster span multiple regions?¶
Yes.
Change your applications to connect using the Private IP for Peering connection string. This change allows your applications to connect from peered networks using the UI or API.
To expand into more regions, disable Peering-Only mode on existing Azure clusters first.
Private IP for Peering connection strings work with MongoDB 3.6 or later clusters.
How do I disable peering-only mode?¶
To disable Peering-Only mode using the:
Verify all clusters in your project use MongoDB 3.6 or later.¶
- If it is not already displayed, select the organization that contains your desired project from the Organizations menu in the navigation bar.
- If it is not already displayed, select your desired project from the Projects menu in the navigation bar.
- If the Clusters page is not already displayed, click Clusters in the sidebar.
- Check the Version number under the cluster name in each cluster card on the Clusters page.
For each cluster that doesn't run MongoDB 3.6 or later, upgrade the MongoDB version of that cluster.
Update All Applications to Use Private IP for Peering Connection Strings.¶
Change any URL