- Documentation
Document Database for MongoDB
User guide
Network and connection management
Modifying port
Network and connection management
Modifying port
Modifying port
The Document Database for MongoDB supports modifying the port number of the connection address of replica set instances and Mongos nodes in the sharding cluster instances. This topic describes how to modify the port number of the connection address.
Prerequisite
The instance status must be Running. For more details, refer to Instance status. Limits
Currently, only the port number of the connection address of replica set instances and the Mongos nodes in sharding cluster instances can be modified. The port numbers of Shard or ConfigServer nodes in sharding cluster instances cannot be modified. For more information on the connection addresses supported by each instance or component type, refer to Connection addresses supported by different instances. Precautions
- Modifying the port number will cause access to some services to be affected in a short time. Please operate with caution.
- After modifying the port number, the original connection will be disconnected. Please modify the connection information of the client in a timely manner. For specific procedures, refer to Connecting to instance via Mongo shell.
- The effective scopes of new ports vary depending on the instance or component type. The specific effective scopes are shown in the following table. The specific effective scopes are shown in the following table.
Procedure
- In the upper-left corner of the top menu bar, select the project and region for instance.
- Select either Replica set instances or Sharding instances in the left navigation bar depending on the instance type.
- On the target instance type list page, click the target instance name.
- On the instance details page, click on the Connectivity tab.
- In the Network information area under the Connectivity tab, after Database port click
icon.
- In the pop-up dialog box, enter a new port number. The modifiable range of port numbers is 1000 to 65535.
danger
- Modifying the port number will cause access to some services to be affected in a short time. Please operate with caution.
- After modifying the port number, the original connection will be disconnected. Please modify the connection information of the client in a timely manner. For specific procedures, refer to Connecting to instance via Mongo shell.
Relevant APIs
Last updated: 2026.02.12 21:43:25