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

Instance Limit
Standalone instances You can modify only the public and internal endpoints of a primary node.
Replica set instances that run MongoDB 4.2 or earlier You can modify the public and internal endpoints of primary and secondary nodes.
Sharded cluster instances
  • If a sharded cluster instance is compatible with the MongoDB protocol, you can modify only the endpoints of the mongos nodes.
  • If a sharded cluster instance is compatible with the DynamoDB protocol, you can modify the endpoint of the Configserver node.

Procedure

  1. Log on to the ApsaraDB for MongoDB console.
  2. In the upper-left corner of the page, select the resource group and the region of the target instance.
  3. In the left-side navigation pane, click Replica Set Instances, or Sharded Cluster Instances based on the instance type.
  4. Find the target instance and click its ID.
  5. In the left-side navigation pane, click Database Connections.
  6. Perform the corresponding operations based on the instance category:
    • Standalone or replica set instances

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

    • Sharded cluster instances

      In the Internal Connections or Public Connections section, choose More > Update Connection String.

  7. In the Update Connection String panel, specify a new connection string.
    Note Only the prefix of the endpoint can be modified. You must abide by the following rules when you modify the prefix:
    • 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 (-).
    Specify a new endpoint
  8. Click Submit.

What to do next

After you modify the public or internal endpoint of the ApsaraDB for MongoDB instance, connect your client to the instance by using the new endpoint.