The mongos nodes of an ApsaraDB for MongoDB sharded cluster instance can be connected to process read/write requests. To read the oplogs of shard nodes or the configuration information of ConfigServer nodes in the instance, you can apply for endpoints for the nodes.
Prerequisites
The instance is a sharded cluster instance.
The MongoDB protocol is selected.
Background information
A sharded cluster instance contains three types of nodes: mongos nodes, shard nodes, and ConfigServer nodes. You can configure the specifications and quantity of shard or ConfigServer nodes to create ApsaraDB for MongoDB sharded cluster instances that have different performance capabilities. For more information, see Sharded cluster instances.
Usage notes
After you apply for an endpoint for a shard node in a sharded cluster instance, the system respectively creates an endpoint for the primary, secondary, and read-only nodes in a shard component in the instance. 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 in a sharded cluster instance, the system respectively creates an endpoint for the primary and secondary nodes in the ConfigServer component in the instance. 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 for 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 a sharded cluster instance.
In this topic, the endpoint allocated to a shard or ConfigServer node in a sharded cluster instance is a private endpoint. For Internet access, apply for a public endpoint. For more information, see (Optional) Apply for a public endpoint for an instance.
You can apply for an endpoint only for a shard node in an ApsaraDB for MongoDB instance that runs MongoDB 4.2 or later and uses Enterprise SSDs (ESSDs).
Instances that use local disks
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 parameters.
Log on to the ApsaraDB for MongoDB console .
In the left-side navigation pane, click Sharded Cluster Instances.
In the upper-left corner of the Sharded Cluster Instances page, select the resource group and region to which the desired instance belongs.
Click the ID of the instance or click Manage in the Actions column.
In the left-side navigation pane of the instance details page, click Database Connections.
In the Internal Connections - VPC section, click Create-Shard-Cs-Connections.
In the Create-Shard-Cs-Connections panel, configure the parameters described in the following table.
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 Name
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.
NoteKeywords cannot be used as accounts.
This account is granted read-only permissions.
The account and password are required only when you apply for an endpoint for a shard or ConfigServer node in a sharded cluster instance for the first time.
Account Password
The password of the account. Specify the password based on the following rules:
The password contains at least three of the following character types: uppercase letters, lowercase letters, digits, and specific special characters.
These special characters include ! @ # $ % ^ & * ( ) _ + - =
The password must be 8 to 32 characters in length.
NoteYou can reset the password of an account for a shard or ConfigServer node in a sharded cluster instance. For more information, see Reset the password of an account for an instance.
Confirm Password
Re-enter the password.
Click OK.
On the Database Connections page, view the allocated endpoint.
Wait until the instance state changes from Creating Connection to Running.
In the Internal Connections - VPC section, view the allocated endpoint.
NoteThe following list describes the node types:
Mongos: mongos node
Shard: shard node
CS: ConfigServer node
Instances that use cloud disks
Log on to the ApsaraDB for MongoDB console .
In the left-side navigation pane, click Sharded Cluster Instances.
In the upper-left corner of the Sharded Cluster Instances page, select the resource group and region to which the desired instance belongs.
Click the ID of the instance or click Manage in the Actions column.
(Optional) Create an account for the shard node for which you want to apply for an endpoint.
You must create an account for the shard node only when you apply for an endpoint for the shard node of the current instance for the first time. To create an account for the shard node, perform the following steps:
In the left-side navigation pane of the instance details page, click Accounts.
On the page that appears, click Create Account.
In the Create Account (Shard only) panel, enter the account and password.
NoteThis account is granted read-only permissions.
Parameter
Description
Account Name
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.
NoteKeywords cannot be used as accounts.
This account is granted read-only permissions.
Account Password
The password of the account. Specify the password based on the following rules:
The password contains at least three of the following character types: uppercase letters, lowercase letters, digits, and specific special characters.
These special characters include ! @ # $ % ^ & * ( ) _ + - =
The password must be 8 to 32 characters in length.
NoteYou can reset the password of an account for a shard or ConfigServer node in a sharded cluster instance. For more information, see Reset the password of an account for an instance.
Confirm Password
Re-enter the password.
Click OK.
Apply for an endpoint for the shard node.
In the left-side navigation pane of the instance details page, click Database Connections.
In the Internal Connections - VPC section, click Create-Shard-Cs-Connections.
In the Create-Shard-Cs-Connections panel, configure the parameters described in the following table.
Parameter
Description
Node Type
Set the value to Shard.
Select Node ID
The ID of the node for which you want to apply for an endpoint.
Click OK.
On the Database Connections page, view the allocated endpoint.
Wait until the instance state changes from Creating Connection to Running.
In the Internal Connections - VPC section, view the allocated endpoint.
NoteThe following list describes the node types:
Mongos: mongos node
Shard: shard node
References
If you no longer need the endpoint of a shard or ConfigServer node in a sharded cluster instance, you can release the endpoint. For more information about how to release an endpoint, see Release the endpoint of a shard or ConfigServer node in a sharded cluster instance.