All Products
Search
Document Center

ApsaraDB for MongoDB:Apply for an endpoint for a shard

Last Updated:Mar 28, 2026

To read the oplog of a specific shard node—for example, to implement data synchronization or incremental backups—you need a direct connection endpoint for that shard. By default, you connect to an ApsaraDB for MongoDB sharded cluster through a Mongos node, which is sufficient for most read and write workloads but does not expose individual shard oplogs.

Background information

An ApsaraDB for MongoDB sharded cluster instance consists of three components: Mongos, Shard, and Configserver. You can select the number and configuration of shard components to create sharded cluster instances with different performance levels.

Prerequisites

Before you begin, ensure that you have:

  • A sharded cluster instance

  • The MongoDB protocol configured on the instance

Usage notes

  • After you apply for a shard endpoint, the system creates endpoints for the primary, secondary, and read-only nodes in the shard. Each endpoint requires one IP address. Make sure you have enough IP addresses available.

  • The network type of the shard endpoint must match the network type of the Mongos node.

  • A shard endpoint cannot be modified after it is created.

  • This topic describes how to apply for a private endpoint. To access the shard over the Internet, apply for a private endpoint first, set an account and password, and then apply for a public endpoint. For more information, see Apply for a public endpoint for an instance.

  • If your instance uses local disks, you can apply for a direct connection account when you apply for the shard endpoint. If your instance uses cloud disks, you must first create a direct connection account on the Account Management page before you apply for the shard endpoint.

  • You can apply for an endpoint only for a shard in a sharded cluster instance.

Apply for a shard endpoint

The steps differ depending on whether your instance uses cloud disks or local disks. Identify your disk type, then follow the corresponding procedure.

Instances that use cloud disks

Important

Applying for a shard endpoint on a cloud disk instance causes existing connections to experience transient connections. Make sure your application has an automatic reconnection mechanism. Perform this operation during off-peak hours to minimize impact.

You only need to create a shard account the first time you apply for a shard endpoint on this instance. Skip Step 1 for subsequent applications.

Step 1: Create a shard account

  1. Go to the Sharded Cluster Instances page. In the upper-left corner, select a resource group and a region, then click the ID of the target instance.

  2. In the navigation pane, click Accounts.

  3. Click Create Account.

  4. In the Create Account(Only shards are supported.) panel, set the following parameters:

    ParameterDescription
    Account NameMust start with a lowercase letter. Can contain lowercase letters, digits, and underscores (_). Must be 4–16 characters in length. Keywords are not allowed. The account has read-only permissions.
    Account PasswordMust be 8–32 characters in length and include at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters (!@#$%^&*()_+-=). To reset the password later, see Reset a password.
    Confirm PasswordEnter the password again.
  5. Click OK.

Step 2: Create a shard endpoint

  1. In the navigation pane, click Database Connections.

  2. In the Internal Connections section, click Create-Shard-Cs-Connections.

  3. In the Create-Shard-Cs-Connections panel, set the following parameters:

    ParameterDescription
    Node TypeFixed to Shard.
    Select Node IDSelect the ID of the shard node for which you want to create an endpoint.
  4. Click OK.

  5. Wait for the instance status to change from Creating Network Connection to Running.

  6. In the Internal Connections section, view the newly created endpoint.

Instances that use local disks

Alternatively, go to the Basic Information page of the instance, find the Shard List section, and click Add Shard. Enable the direct connection option and apply for an endpoint in the Apply For Shard Direct Connection Endpoint section.
You only need to set an account name and password the first time you apply for a shard or Configserver node endpoint on this instance. For subsequent applications, these fields are not required.
  1. Go to the Sharded Cluster Instances page. In the upper-left corner, select a resource group and a region, then click the ID of the target instance.

  2. In the navigation pane, click Database Connections.

  3. In the Internal Connections section, click Create-Shard-Cs-Connections.

  4. In the Create-Shard-Cs-Connections panel, set the following parameters:

    ParameterDescription
    Node TypeFixed to Shard.
    Select Node IDSelect the ID of the shard node for which you want to create an endpoint.
    Account NameMust start with a lowercase letter. Can contain lowercase letters, digits, and underscores (_). Must be 4–16 characters in length. Keywords are not allowed. The account has read-only permissions.
    Account PasswordMust be 8–32 characters in length and include at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters (!@#$%^&*()_+-=). To reset the password later, see Reset a password.
    Confirm PasswordEnter the password again.
  5. Click OK.

  6. Wait for the instance status to change from Creating Network Connection to Running.

  7. In the Internal Connections section, view the newly created endpoint.

What's next