A sharded cluster instance consists of mongos, shard, and Configserver nodes. Typically, you need only to connect to a mongos node to read and write data. If you want to read the oplog data of a shard node or the configuration information of a Configserver node when you perform specific operations such as data synchronization between clusters, you must apply for an endpoint for the corresponding node.

Precautions

  • After you apply for an endpoint for a Configserver node, the system creates endpoints for the primary and secondary nodes in the Configserver node.
  • After you apply for an endpoint for a shard node, the system creates endpoints for the primary and secondary nodes in the shard node.
  • The network type of the endpoints must be the same as that of the current mongos node.
  • You cannot modify the endpoint of a shard or Configserver node.
  • The endpoints allocated here can only be used to access the node over the internal network. If you want to access the node over the Internet, you can apply for a public endpoint. For more information, see Apply for a public endpoint for a sharded cluster instance.

Overview of the sharded cluster architecture and nodes

For more information, see Architecture of sharded cluster instances.

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 Sharded Cluster Instances.
  4. Find the target instance and click its ID.
  5. In the left-side navigation pane, click Database Connections.
  6. In the upper-right corner, choose More > Apply for Shard or ConfigServer Connection String.
  7. In the Apply for Shard or ConfigServer Connection String panel, specify the following parameters.
    Apply for an endpoint
    Parameter Description
    Node Type Select the type of the node for which you want to apply for an endpoint.
    • Shard: the shard node
    • CS: the Configserver node
    Select Node ID Select the ID of the node for which you want to create an endpoint.
    Account Specify the name of the account based on the following rules:
    • The name must start with a lowercase letter.
    • The name can contain lowercase letters, digits, and underscores (_).
    • The name must be 4 to 16 characters in length.
    Note
    • You need only to set the account name and its password when you first apply for endpoints for shard and Configserver nodes.
    • The permissions of this account are fixed to read-only.
    Password Specify the password based on the following rules:
    • The password can contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. The following special characters can be used:

      !@#$%^&*()_+-=

    • The password must be 8 to 32 characters in length.
    Note If you forget your password, you can reset it. For more information, see Reset the password for an ApsaraDB for MongoDB instance.
    Confirm Password Enter the account password again.
  8. Click Submit.
  9. On the Database Connections page, view the endpoints.
    1. Wait until the instance state changes from Creating Connection to Running.
    2. In the Internal Connections section, view the new endpoints.
      Note
      • Endpoints are displayed only after whitelists are configured. For more information about how to configure a whitelist, see Configure a whitelist for an ApsaraDB for MongoDB instance.
      • The following section describes the node types:
        • Mongos: the mongos node
        • Shard: the shard node
        • CS: the Configserver node

References

If you no longer need the endpoints of shard or Configserver nodes, you can release these endpoints. For more information about how to release endpoints, see Release the connection string of a shard or Configserver node.