This topic describes how to manage public endpoints for ApsaraDB for MongoDB instances, which includes applying for and releasing the endpoints.
Background information
By default, an ApsaraDB for MongoDB instance provides a private endpoint. To connect to the instance over the Internet, you must manually apply for a public endpoint.
Endpoint type | Description |
Private endpoint (VPC) |
|
Public endpoint (connection string) |
|
Apply for a public endpoint
Usage notes
When you apply for a public endpoint for an instance that uses cloud disks, existing connections may experience a transient disruption. Ensure your application has a reconnection mechanism. Perform this operation during off-peak hours.
Before you connect to an instance using a public endpoint, add the public IP address of the client to the instance's whitelist.
For sharded cluster instances that use cloud disks, apply for public endpoints only for Mongos nodes.
Procedure
Go to the MongoDB replica set instances page or the MongoDB sharded cluster instances page, select a resource group and region, and then click the target instance ID.
In the navigation pane on the left, click Database Connections.
Release a public endpoint
Usage notes
After you release the public endpoint of an instance or a node, you cannot connect to the instance or node using the original public endpoint.
After you release a public endpoint, delete the corresponding public IP address from the whitelist to ensure data security.
Procedure
Go to the MongoDB replica set instances page or the MongoDB sharded cluster instances page, select a resource group and region, and then click the target instance ID.
In the navigation pane on the left, click Database Connections.
Follow the steps that correspond to your instance type.
Replica set/standalone instance
NoteAfter you release the public endpoint of a replica set instance, the public endpoints of both the primary and secondary nodes are released.
In the Public Connections section, click Release Public Connection String.
In the Release Public Connection String dialog box, click OK.
Sharded cluster instance
NoteFor a sharded cluster instance, you can release the public endpoint of one or more Mongos, shard, or ConfigServer components. Nodes whose public endpoints are not released remain accessible. For more information about the components of a sharded cluster instance, see Sharded cluster architecture.
After you release the endpoint of a shard or ConfigServer component, the public endpoints of both the primary and secondary nodes in the component are released.
In the Public Connections section, find the endpoint that you want to release and click Release in the Actions column.
In the Release Public Endpoint dialog box, click OK.
To release the public endpoints of multiple nodes in a sharded cluster instance, repeat these steps.
References
For more information about the endpoints of an ApsaraDB for MongoDB instance, see Instance endpoints.
To connect to an instance using a public endpoint, see Connect to a MongoDB instance from a local client over the Internet.
We recommend that you use Secure Sockets Layer (SSL) encryption when you connect to a database using a public endpoint. For more information, see Use the mongo shell to connect to a database with SSL encryption.