The mongos nodes of ApsaraDB for MongoDB sharded cluster instances can be connected to process read/write requests. To read the oplogs of a shard component or the configuration information of a ConfigServer component, you can apply for an endpoint for the corresponding type of component. This topic describes how to apply for an endpoint for a shard or ConfigServer component.
Prerequisites
A sharded cluster instance is used.
The MongoDB protocol is selected.
Background information
The sharded cluster instance contains mongos, shard, and ConfigServer components. You can configure the specifications and quantity of shard and 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 component, the system creates an endpoint for the primary, secondary, and read-only nodes in the component 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 the ConfigServer component, the system creates an endpoint for the primary and secondary nodes in the component 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 for which 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 component.
In this topic, the endpoint that is allocated to a shard or ConfigServer component is a private endpoint. If you want to access a shard or ConfigServer component over the Internet, you must apply for a private endpoint for the corresponding type of component, configure an account name and password, and then apply for a public endpoint. For more information about how to apply for a public endpoint, see (Optional) Apply for a public endpoint for an instance.
You can apply for an endpoint only for a shard component in a sharded cluster instance that runs MongoDB 4.2 or later and uses Enterprise SSDs (ESSDs).
Instance that uses local disks
You can also click Add Shard in the Shard List section of the Basic Information page of an instance. 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.
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 component for which you want to apply for an endpoint. Valid values:
Shard: shard component
CS: ConfigServer component
Select Node ID
The ID of the component 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 account usernames.
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 component 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 is 8 to 32 characters in length.
NoteYou can reset the password of an account for a shard or ConfigServer component. 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 component types:
Mongos: mongos component
Shard: shard component
CS: ConfigServer component
Instance that uses 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 a shard component.
You must create an account for a shard component only when you apply for an endpoint for the shard component of the current instance for the first time. To create an account for the shard component, 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 account usernames.
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 is 8 to 32 characters in length.
NoteYou can reset the password of an account for a shard or ConfigServer component. 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 component.
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 component 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 component types:
Mongos: mongos component
Shard: shard component
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.