All Products
Search
Document Center

ApsaraDB for MongoDB:Modify the endpoint and port of an instance

Last Updated:Jul 15, 2024

This topic describes how to change the internal endpoint, public endpoint, or port of an ApsaraDB for MongoDB instance. When you change the connection information of a new ApsaraDB for MongoDB instance, you can replace the endpoint of the instance with that of the original instance without the need to modify the application.

Limits

Instance architecture

Endpoint

Port

Standalone instances

You can modify only the public and internal endpoints of a primary node.

You cannot modify the port of a standalone instance.

Replica set instances

You can modify the endpoints of the primary, secondary, and read-only nodes for an instance that uses local SSDs and Enterprise SSDs (ESSDs).

Note

You cannot modify the connection string URI of a replica set instance. If your application uses the connection string URI of an instance, you must modify the URI on your application after you change the instance.

You can modify the port of an instance that runs MongoDB 4.2 or later and uses ESSDs.

Sharded cluster instances

  • For a MongoDB-compatible sharded cluster instance, you can modify only the endpoints of the mongos nodes.

  • For a DynamoDB-compatible sharded cluster instance, you can modify the endpoint of the ConfigServer node in the instance.

You can modify the port of an instance that runs MongoDB 4.2 or later and uses ESSDs.

Procedure

  1. Go to the Replica Set Instances or Sharded Cluster Instances page. In the top navigation bar, select the region in which the instance resides. Then, find the instance and click the ID of the instance.

  2. In the left-side navigation pane of the instance details page, click Database Connections.

  3. In the Internal Connections - VPC or Public Connections section, click Update Connection String.

    Note

    The Update Connection String option is displayed in the Public Connections section only after you apply for a public endpoint for the instance. For more information about how to apply for a public endpoint, see Apply for a public endpoint.

  4. In the Update Connection String panel, configure the parameters described in the following table.

    Parameter

    Description

    Node

    The node whose endpoint you want to modify. Select the node from the drop-down list.

    Note

    You can modify only the endpoint of a mongos node for a sharded cluster instance.

    Current Connection String

    The current endpoint of the node.

    New Connection String

    The prefix of the new endpoint of the node. The prefix which must meet the following requirements:

    • The prefix must start with a lowercase letter.

    • The prefix must start or end with a lowercase letter or digit.

    • The prefix must be 8 to 64 characters in length and can contain lowercase letters, digits, and hyphens (-).

    Port Number

    The port corresponding to the new endpoint. Valid values: 1000 to 65535.

  5. Click OK.

What to do next

After you modify the endpoint of the node, connect your client to the instance by using the new endpoint and port.