All Products
Search
Document Center

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

Last Updated:Dec 28, 2023

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

Limits

Architecture

Endpoint

Port

Standalone instance

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

You cannot modify the port of a standalone instance.

Replica set instance

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

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

Sharded cluster instance

  • 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.

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

Procedure

  1. Log on to the ApsaraDB for MongoDB console.

  2. In the left-side navigation pane, click Replica Set Instances or Sharded Cluster Instances based on the instance type.

  3. In the upper-left corner of the page, select the resource group and region to which the instance belongs.

  4. Click the ID of an instance, or click More icon in the Actions column corresponding to the instance and select Manage.

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

  6. In the Internal Connections or Public Connections section, click Update Connection String.

  7. In the Update Connection String pane, specify the following parameters.

    Parameter

    Description

    Node

    Select the node from the drop-down list.

    Note

    You can modify only the endpoint of the 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, 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.

  8. Click Submit.

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.