The mongos nodes of ApsaraDB for MongoDB sharded cluster instances can be connected to handle read and write requests. To read the oplogs of shard nodes or the configuration information of Configserver nodes, you can apply for endpoints for the corresponding types of nodes.

Prerequisites

A sharded cluster instance that runs MongoDB is created. For more information, see Create a sharded cluster instance.

Background information

A sharded cluster instance contains three types of nodes: mongos, shard, and Configserver nodes. You can configure the specifications and quantity of mongos and shard nodes to create ApsaraDB for MongoDB sharded cluster instances that have different performance capabilities. For more information, see Sharded cluster instances.

Limits

Endpoint application for a shard or Configserver node is not available for sharded cluster instances that run MongoDB 5.0 or 4.4.

Precautions

  • After you apply for an endpoint for a shard node, the system creates an endpoint for the primary, secondary, and read-only nodes in the shard node respectively. Each endpoint has its own IP address. Before you apply for an endpoint, make sure that you have a sufficient number of available IP addresses.
  • After you apply for an endpoint for a Configserver node, the system creates an endpoint for the primary and secondary nodes in the Configserver node respectively. Each endpoint has its own IP address. Before you apply for an endpoint, make sure that you have a sufficient number of available IP addresses.
  • The network type of an endpoint that you want to apply must be the same as that of the current mongos node.
  • You cannot modify the endpoint that is allocated to a shard or Configserver node.
  • In this topic, the endpoint allocated to a shard or Configserver node is a private one. For Internet access, apply for a public endpoint. For more information, see (Optional) Apply for a public endpoint for an ApsaraDB for MongoDB instance.

Procedure

Note You can also click Add Shard in the Shard List section of the Basic Information page. In the panel that appears, set Enable Shard Connection to Yes, and then configure the parameters in the Apply for Shard Private Endpoint section. For more information, see Configure the parameters.
  1. Log on to the ApsaraDB for MongoDB console.
  2. In the left-side navigation pane, click Sharded Cluster Instances.
  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 the instance that you want to manage or find the instance and click Manage in the Actions column.
  5. In the left-side navigation pane of the instance details page, click Database Connections.
  6. In the Internal Connections - VPC section, click Create-Shard-Cs-Connections.
  7. In the Create-Shard-Cs-Connections panel, configure the following parameters.
    Parameter Description
    Node Type The type of the node for which you want to apply for an endpoint. Valid values:
    • Shard: shard node
    • CS: Configserver node
    Select Node ID The ID of the node for which you want to apply for an endpoint.
    Account The account used for endpoint application. Specify the account based on the following rules:
    • The account must start with a lowercase letter.
    • The account can contain lowercase letters, digits, and underscores (_).
    • The account must be 4 to 16 characters in length.
    Note
    • Keywords cannot be used as accounts.
    • The permissions of this account are fixed at read-only.
    • The account and password are required only when you apply for an endpoint for a shard or Configserver node for the first time.
    Password The password of the account. Specify the password based on the following rules:
    • The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.

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

    • The password must be 8 to 32 characters in length.
    Note
    Confirm Password Enter the password again.
  8. Click the Submit tab.
  9. On the Database Connections page, view the allocated endpoint.
    1. Wait until the instance state changes from Establishing Connection to Running.
    2. In the Internal Connections - VPC section, view the allocated endpoint.
      Note The following section describes the node types:
      • Mongos: mongos node
      • Shard: shard node
      • CS: Configserver node

References

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